Sha256: 090f62e84553b5924e99facbf7974f332d7534f50235e81035dfda237b26c202

Contents?: true

Size: 704 Bytes

Versions: 11

Compression:

Stored size: 704 Bytes

Contents

require 'capybara'
require 'capybara/server'
require 'sinatra/base'

module FakeStripe
  class StubStripeJS < Sinatra::Base
    get '/v1/' do
      file_path = File.join(File.dirname(__FILE__), '/assets/v1.js')

      content_type 'text/javascript'
      status 200
      IO.read(file_path)
    end

    get '/v2/' do
      file_path = File.join(File.dirname(__FILE__), '/assets/v2.js')
      mock_file_path = File.join(File.dirname(__FILE__), '/assets/v2-mock.js')

      content_type 'text/javascript'
      status 200
      IO.read(file_path) + IO.read(mock_file_path)
    end

    def self.boot
      instance = new
      Capybara::Server.new(instance).tap { |server| server.boot }
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

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