Sha256: 22fd06ac48ae472dc990c442301a83b92f39688f47942d68e8da71d5ba4c90a7

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

require 'minitest/autorun'
require 'spec_helper'

describe Stripe::JavascriptHelper do
  before { Rails.application.config.stripe.publishable_key = 'pub_xxxx' }
  let(:controller)  { ActionView::TestCase::TestController.new }
  let(:view)        { controller.view_context }

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

    describe 'when the v2 option is passed' do
      it 'should default to v2' do
        view.stripe_javascript_tag(:v2).must_include 'https://js.stripe.com/v2/'
      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(:v1).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-1.0.1 test/javascript_helper_spec.rb
stripe-rails-1.0.0 test/javascript_helper_spec.rb