summaryrefslogtreecommitdiff
path: root/billing/test/functional/customer_controller_test.rb
diff options
context:
space:
mode:
authorjessib <jessib@riseup.net>2013-09-03 10:48:13 -0700
committerjessib <jessib@riseup.net>2013-09-03 10:48:13 -0700
commit07d0f6fe1d80cb730bd12a03a107c18d18779acc (patch)
tree8583a31661ba5032a9cd6ffd6b74273a6c862ab0 /billing/test/functional/customer_controller_test.rb
parentf3e17149116f6a3aeb87f8a6d0ecf29e8e33ad93 (diff)
parent29b306a4d49d395e5753e2e85f8fa1f25d18410c (diff)
Merge pull request #73 from azul/bugfix/3623-teardown-test-data-properly
Bugfix/3623 teardown test data properly
Diffstat (limited to 'billing/test/functional/customer_controller_test.rb')
-rw-r--r--billing/test/functional/customer_controller_test.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/billing/test/functional/customer_controller_test.rb b/billing/test/functional/customer_controller_test.rb
index d62ee95..878ed48 100644
--- a/billing/test/functional/customer_controller_test.rb
+++ b/billing/test/functional/customer_controller_test.rb
@@ -21,7 +21,9 @@ class CustomerControllerTest < ActionController::TestCase
end
test "edit uses params[:id]" do
- customer = FactoryGirl.create :customer_with_payment_info
+ user = find_record :user
+ customer = stub_record :customer_with_payment_info, user: user
+ Customer.stubs(:find_by_user_id).with(user.id).returns(customer)
login customer.user
get :edit, id: customer.user.id
@@ -50,7 +52,10 @@ class CustomerControllerTest < ActionController::TestCase
end
test "customer update" do
- customer = FactoryGirl.create :customer_with_payment_info
+ user = find_record :user
+ customer = stub_record :customer_with_payment_info, user: user
+ customer.expects(:save)
+ Customer.stubs(:find_by_user_id).with(user.id).returns(customer)
login customer.user
Braintree::TransparentRedirect.expects(:confirm).
returns(success_response(customer))
@@ -91,7 +96,9 @@ class CustomerControllerTest < ActionController::TestCase
end
test "failed user update with stubbing" do
- customer = FactoryGirl.create :customer_with_payment_info
+ user = find_record :user
+ customer = stub_record :customer_with_payment_info, user: user
+ Customer.stubs(:find_by_user_id).with(user.id).returns(customer)
login customer.user
Braintree::TransparentRedirect.expects(:confirm).returns(failure_response)
post :confirm, bla: :blub