Sha256: 541db6e6c2555ff8270fc621f90c80b246361e8a7f2f08be109d98b2414844ce

Contents?: true

Size: 1.06 KB

Versions: 9

Compression:

Stored size: 1.06 KB

Contents

require 'fake_stripe/configuration'
require 'fake_stripe/initializers/webmock'
require 'fake_stripe/stub_app'
require 'fake_stripe/stub_stripe_js'

module FakeStripe
  extend Configuration

  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"


  STRIPE_OBJECTS.each do |object|
    define_singleton_method "#{object}_count" do
      instance_variable_get("@#{object}_count")
    end

    define_singleton_method "#{object}_count=" do |count|
      instance_variable_set("@#{object}_count", count)
    end
  end

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

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

server = FakeStripe::StubStripeJS.boot
STRIPE_JS_HOST = "http://#{server.host}:#{server.port}"

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fake_stripe-0.0.12 lib/fake_stripe.rb
fake_stripe-0.0.11 lib/fake_stripe.rb
fake_stripe-0.0.10.6 lib/fake_stripe.rb
fake_stripe-0.0.10.5 lib/fake_stripe.rb
fake_stripe-0.0.10.4 lib/fake_stripe.rb
fake_stripe-0.0.10.3 lib/fake_stripe.rb
fake_stripe-0.0.10.2 lib/fake_stripe.rb
fake_stripe-0.0.10.1 lib/fake_stripe.rb
fake_stripe-0.0.10 lib/fake_stripe.rb