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.
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.