Sha256: 7def5d8f2ec94fd7719f5d325046c8d94f2a103f7af38b1551db80fa0e49a0e2

Contents?: true

Size: 1.04 KB

Versions: 28

Compression:

Stored size: 1.04 KB

Contents

require 'test_helper'

module Workarea
  module Admin
    class FulfillmentTokensIntegrationTest < Workarea::IntegrationTest
      include Admin::IntegrationTest

      def test_create
        sku = create_fulfillment_sku(
          id: 'SKU1',
          policy: 'download',
          file: product_image_file_path
        )

        post admin.fulfillment_sku_tokens_path(sku)

        assert_equal(1, Fulfillment::Token.count)

        token = Fulfillment::Token.first
        assert_equal('SKU1', token.sku)

        assert_redirected_to(
          admin.fulfillment_sku_tokens_path(sku, new_token: token.id)
        )
      end

      def test_update
        sku = create_fulfillment_sku(id: 'SKU1')
        token = Fulfillment::Token.create!(sku: sku.id)

        patch admin.fulfillment_sku_token_path(sku, token),
          params: { token: { enabled: '0' } }

        assert_equal(1, Fulfillment::Token.count)

        assert_redirected_to(admin.fulfillment_sku_tokens_path(sku))

        token.reload
        assert(token.disabled?)
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
workarea-admin-3.5.27 test/integration/workarea/admin/fulfillment_tokens_integration_test.rb
workarea-admin-3.5.26 test/integration/workarea/admin/fulfillment_tokens_integration_test.rb
workarea-admin-3.5.25 test/integration/workarea/admin/fulfillment_tokens_integration_test.rb
workarea-admin-3.5.23 test/integration/workarea/admin/fulfillment_tokens_integration_test.rb
workarea-admin-3.5.22 test/integration/workarea/admin/fulfillment_tokens_integration_test.rb
workarea-admin-3.5.21 test/integration/workarea/admin/fulfillment_tokens_integration_test.rb
workarea-admin-3.5.20 test/integration/workarea/admin/fulfillment_tokens_integration_test.rb
workarea-admin-3.5.19 test/integration/workarea/admin/fulfillment_tokens_integration_test.rb
workarea-admin-3.5.18 test/integration/workarea/admin/fulfillment_tokens_integration_test.rb
workarea-admin-3.5.17 test/integration/workarea/admin/fulfillment_tokens_integration_test.rb
workarea-admin-3.5.16 test/integration/workarea/admin/fulfillment_tokens_integration_test.rb
workarea-admin-3.5.15 test/integration/workarea/admin/fulfillment_tokens_integration_test.rb
workarea-admin-3.5.14 test/integration/workarea/admin/fulfillment_tokens_integration_test.rb
workarea-admin-3.5.13 test/integration/workarea/admin/fulfillment_tokens_integration_test.rb
workarea-admin-3.5.12 test/integration/workarea/admin/fulfillment_tokens_integration_test.rb
workarea-admin-3.5.11 test/integration/workarea/admin/fulfillment_tokens_integration_test.rb
workarea-admin-3.5.10 test/integration/workarea/admin/fulfillment_tokens_integration_test.rb
workarea-admin-3.5.9 test/integration/workarea/admin/fulfillment_tokens_integration_test.rb
workarea-admin-3.5.8 test/integration/workarea/admin/fulfillment_tokens_integration_test.rb
workarea-admin-3.5.7 test/integration/workarea/admin/fulfillment_tokens_integration_test.rb