Sha256: 474bd88dc3caa295f44b838544500b30562fa79b1d69fb95b4c7c580cf28ca9a

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

RSpec.describe SolidusAfterpay::AfterpayHelper, type: :helper do
  describe '#include_afterpay_js' do
    subject { helper.include_afterpay_js(test_mode: test_mode) }

    context 'when test_mode is false' do
      let(:test_mode) { false }

      it 'includes the production javascript' do
        is_expected
          .to eq(
            <<-SCRIPT.squish
              <script src="https://portal.afterpay.com/afterpay-async.js"
                async="async"
                defer="defer"
                onload="initAfterpay()"></script>
            SCRIPT
          )
      end
    end

    context 'when test_mode is true' do
      let(:test_mode) { true }

      it 'includes the sandbox javascript' do
        is_expected
          .to eq(
            <<-SCRIPT.squish
              <script src="https://portal.sandbox.afterpay.com/afterpay-async.js"
                async="async"
                defer="defer"
                onload="initAfterpay()"></script>
            SCRIPT
          )
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_afterpay-0.2.0 spec/helpers/solidus_afterpay/afterpay_helper_spec.rb