Sha256: 97bc295fb5669be9de5fb05d41339d07556e29fde2b1bb74cd2cea16f3ffbf09

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

require 'minitest/autorun'
require 'spec_helper'

describe Stripe::JavascriptHelper do
  before do
    Rails.application.config.stripe.publishable_key = 'pub_xxxx'

    @controller = ActionView::TestCase::TestController.new
    @view       = @controller.view_context
    @view.singleton_class.include(Stripe::JavascriptHelper)
  end

  describe '#stripe_javascript_tag' do
    describe 'when no options are passed' do
      it 'should default to v1' do
        @view.stripe_javascript_tag.must_include 'https://js.stripe.com/v1/'
      end
    end

    describe 'when the v3 option is passed' do
      it 'should default to v3' do
        @view.stripe_javascript_tag(:v3).must_include 'https://js.stripe.com/v3/'
      end
    end

    describe 'when the debug flag is enabled' do
      before { Rails.application.config.stripe.debug_js = true }
      it 'should render the debug js' do
        @view.stripe_javascript_tag.must_include 'https://js.stripe.com/v1/stripe-debug.js'
      end

      describe 'when v3 is selected' do
        it 'should not render debug js' do
          @view.stripe_javascript_tag(:v3).wont_include 'https://js.stripe.com/v1/stripe-debug.js'
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stripe-rails-0.4.1 test/javascript_helper_spec.rb
stripe-rails-0.4.0 test/javascript_helper_spec.rb