fake_braintree, a Braintree fake
Currently in alpha.
Quick start
Call FakeBraintree.activate!
to make it go. FakeBraintree.clear!
will clear
all data, which you probably want to do before each test.
Example, in spec_helper.rb:
FakeBraintree.activate!
RSpec.configure do |c|
c.before do
FakeBraintree.clear!
end
end
Verifying credit cards
To verify every credit card you try to use, call:
FakeBraintree.verify_all_cards!
This will stay "on" until you set
FakeBraintree.verify_all_cards = false
Calling FakeBraintree.clear! will not change this setting. It does very basic verification: it only matches the credit card number against these: http://www.braintreepayments.com/docs/ruby/reference/sandbox and rejects them if they aren't one of the listed numbers.