Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A Braintree fake so that you can avoid hitting Braintree servers in tests.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
Changelog.md
Gemfile
README.md
Rakefile
fake_braintree.gemspec

README.md

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.

Something went wrong with that request. Please try again.