Sha256: d6f26ac965a8fe595fd62064d71f601fd2d93f8f4fcd7994f2b5c0684ec6fb38

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

require 'test_helper'

module Workarea
  module Storefront
    class FlowIoOrderRedirectTest < Workarea::IntegrationTest
      setup :set_organization_id
      teardown :reset_organization_id

      def test_domestic_order_is_not_redirected
        cookies['_f60_session'] = 1

        product = create_product

        post storefront.cart_items_path,
          params: {
            product_id: product.id,
            sku: product.skus.first,
            quantity: 2
          }

        get storefront.checkout_path
        assert_redirected_to storefront.checkout_addresses_url
      end

      def test_foreign_order_is_redirected
        cookies['_f60_session'] = 2

        product = create_product

        post storefront.cart_items_path,
          params: {
            product_id: product.id,
            sku: product.skus.first,
            quantity: 2
          }

        get storefront.checkout_path

        assert_redirected_to %r(\Ahttps://checkout.flow.io)
      end

      private

        def set_organization_id
          Rails.application.secrets.flow_io ||= {}
          @_old_organization_id = Rails.application.secrets.flow_io[:organization_id]
          Rails.application.secrets.flow_io[:organization_id] = "workarea-sandbox"
        end

        def reset_organization_id
          Rails.application.secrets.flow_io[:organization_id] = @_old_organization_id
        end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
workarea-flow_io-1.2.1 test/integration/workarea/storefront/flow_io_order_redirect_test.rb