From 1c40963194aa6f1dc985b949fb3c05e70f7530c0 Mon Sep 17 00:00:00 2001 From: Azul Date: Mon, 1 Jul 2013 13:13:02 +0200 Subject: use fake_braintree, fix and test customer with braintree info --- .../test/unit/customer_with_payment_info_test.rb | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 billing/test/unit/customer_with_payment_info_test.rb (limited to 'billing/test/unit/customer_with_payment_info_test.rb') diff --git a/billing/test/unit/customer_with_payment_info_test.rb b/billing/test/unit/customer_with_payment_info_test.rb new file mode 100644 index 0000000..f887674 --- /dev/null +++ b/billing/test/unit/customer_with_payment_info_test.rb @@ -0,0 +1,27 @@ +require 'test_helper' +require 'fake_braintree' + +class CustomerWithPaymentInfoTest < ActiveSupport::TestCase + + setup do + @customer = FactoryGirl.build(:customer_with_payment_info) + end + + test "has payment_info" do + assert @customer.braintree_customer_id + assert @customer.has_payment_info? + end + + test "constructs customer with braintree data" do + @customer.with_braintree_data! + assert_equal 'Big', @customer.first_name + assert_equal 'Spender', @customer.last_name + assert_equal 1, @customer.credit_cards.size + assert_equal Hash.new, @customer.custom_fields + end + + test "sets default_credit_card" do + @customer.with_braintree_data! + assert_equal @customer.credit_cards.first, @customer.default_credit_card + end +end -- cgit v1.2.3