Sha256: 9581d422224a564740cefd9860a0a889e83e0dde8932aed5aa1d72e52e5dcce1

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

require 'test_helper'

module Workarea
  module Storefront
    class PaypalHelperTest < ViewTest
      include PaypalSetup

      def test_include_paypal_javascript_tag
        Workarea.config.paypal_sdk_params = {
          commit: false,
          debug: true
        }

        result = include_paypal_javascript_tag
        assert_includes(result, 'commit=false')
        assert_includes(result, 'debug=true')
        assert_includes(result, "client-id=#{Workarea::Paypal.gateway.client_id}")
        assert_includes(result, 'components=buttons')
        assert_includes(result, 'data-partner-attribution-id="Workarea_SP"')
        refute_includes(result, 'hosted-fields')
        refute_includes(result, 'data-client-token')

        Workarea.config.use_paypal_hosted_fields = true
        result = include_paypal_javascript_tag(
          params: { foo: 'bar' },
          data: { baz: 'qux' }
        )

        assert_includes(result, 'foo=bar')
        assert_includes(result, 'data-baz="qux"')
        assert_includes(result, 'components=buttons%2Chosted-fields')
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
workarea-paypal-3.0.6 test/helpers/workarea/storefront/paypal_helper_test.rb
workarea-paypal-3.0.5 test/helpers/workarea/storefront/paypal_helper_test.rb
workarea-paypal-3.0.4 test/helpers/workarea/storefront/paypal_helper_test.rb
workarea-paypal-3.0.3 test/helpers/workarea/storefront/paypal_helper_test.rb