Sha256: 176e62a89f06723aa8a0fa29de483e782236cf5bf573b9149c92120b17941428

Contents?: true

Size: 1.38 KB

Versions: 27

Compression:

Stored size: 1.38 KB

Contents

require 'test_helper'

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

      def test_create
        post admin.fulfillment_skus_path,
          params: {
            sku: {
              id: 'SKU1',
              policy: 'shipping',
            }
          }

        assert_equal(1, Fulfillment::Sku.count)
        assert_redirected_to(admin.fulfillment_sku_path('SKU1'))

        sku = Fulfillment::Sku.first
        assert_equal('SKU1', sku.id)
        assert_equal('shipping', sku.policy)
      end

      def test_update
        sku = create_fulfillment_sku(id: 'SKU1')

        patch admin.fulfillment_sku_path('SKU1'),
          params: {
            sku: {
              policy: 'download',
              file: Rack::Test::UploadedFile.new(product_image_file_path)
            }
          }

        assert_equal(1, Fulfillment::Sku.count)

        assert_redirected_to(admin.fulfillment_sku_path('SKU1'))

        sku.reload
        assert_equal('SKU1', sku.id)
        assert_equal('download', sku.policy)
        assert(sku.file_name.present?)
      end

      def test_destroy
        sku = create_fulfillment_sku(id: 'SKU1')
        delete admin.fulfillment_sku_path('SKU1')

        assert_equal(0, Fulfillment::Sku.count)
        assert_redirected_to(admin.fulfillment_skus_path)
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

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