Module: FakeStripe

Extended by:
Configuration
Defined in:
lib/fake_stripe.rb,
lib/fake_stripe/utils.rb,
lib/fake_stripe/version.rb,
lib/fake_stripe/stub_app.rb,
lib/fake_stripe/configuration.rb,
lib/fake_stripe/stub_stripe_js.rb,
lib/fake_stripe/stub_stripe_connect.rb

Defined Under Namespace

Modules: Configuration Classes: StubApp, StubStripeConnect, StubStripeJS, Utils

Constant Summary collapse

VALID_CARD_NUMBER =
'4242424242424242'
STRIPE_OBJECTS =
%w{card charge coupon customer invoice invoiceitem plan
recipient refund subscription token transfer}.freeze
CARD_OBJECT_TYPE =
"card"
BANK_ACCOUNT_OBJECT_TYPE =
"bank_account"
VERSION =
'0.3.0'

Constants included from Configuration

Configuration::DEFAULT_FIXTURE_PATH

Instance Attribute Summary

Attributes included from Configuration

#fixture_path

Class Method Summary collapse

Methods included from Configuration

configure

Class Method Details

.resetObject


27
28
29
30
31
# File 'lib/fake_stripe.rb', line 27

def self.reset
  STRIPE_OBJECTS.each do |object|
    instance_variable_set("@#{object}_count", 0)
  end
end

.stub_stripeObject


33
34
35
36
37
38
39
# File 'lib/fake_stripe.rb', line 33

def self.stub_stripe
  Stripe.api_key = 'FAKE_STRIPE_API_KEY'
  FakeStripe.reset
  FakeStripe::StubStripeJS.boot_once
  FakeStripe::StubStripeConnect.boot_once
  stub_request(:any, /api.stripe.com/).to_rack(FakeStripe::StubApp)
end