Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to test for a failed subscription purchase with an existing card? #103

Open
gregblass opened this issue Jul 28, 2015 · 0 comments

Comments

@gregblass
Copy link

I'm trying to test my controller code that would happen if a user tried to create a subscription with an existing card, but that fails (fraud, not enough funds, etc).

I'm checking out the specs for subscriptions here: https://github.com/highfidelity/fake_braintree/blob/master/spec/fake_braintree/subscription_spec.rb

I don't see any example of how I could make Braintree::Subscription.create fail. Calling FakeBraintree.decline_all_cards! doesn't seem to have any effect on creating a subscription with an existing card.

I'm thinking I could just mock it? Is that possible? Or does anyone have any advice for this situation?

In other words, I'm looking for a way for the result returned by Braintree::Subscription.create() to not be success so I can test that my controller does what it is supposed to do in that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant