Sha256: ff1ddc92efd0f7c18def2a9ba863b2ecb6411df542bd0209e1a1b50e4d7f50eb

Contents?: true

Size: 1.65 KB

Versions: 62

Compression:

Stored size: 1.65 KB

Contents

require 'test_helper'

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

      def test_creation
        post admin.pricing_skus_path,
          params: {
            sku: {
              id: 'SKU1',
              tax_code: '001',
              on_sale: 'true',
              discountable: 'true',
              msrp: ''
            },
            prices: [
              { regular: '10', sale: '', min_quantity: 1 },
              { regular: '', min_quantity: 1 }
            ]
          }

        assert_equal(1, Pricing::Sku.count)

        sku = Pricing::Sku.first
        assert_equal('SKU1', sku.id)
        assert_equal('001', sku.tax_code)
        assert(sku.on_sale?)
        assert(sku.discountable?)
        assert_nil(sku.msrp)
        assert_equal(1, sku.prices.count)
        assert_equal(10.to_m, sku.prices.first.regular)
        assert_nil(sku.prices.first.sale)
      end

      def test_updating
        post admin.pricing_skus_path,
          params: {
            sku: {
              id: 'SKU1',
              tax_code: '001',
              on_sale: 'true',
              discountable: 'true'
            }
          }

        patch admin.pricing_sku_path('SKU1'),
          params: {
            sku: {
              tax_code: '002',
              on_sale: 'false',
              discountable: 'false'
            }
          }

        assert_equal(1, Pricing::Sku.count)

        sku = Pricing::Sku.first
        assert_equal('SKU1', sku.id)
        assert_equal('002', sku.tax_code)
        refute(sku.on_sale?)
        refute(sku.discountable?)
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-admin-3.5.27 test/integration/workarea/admin/pricing_skus_integration_test.rb
workarea-admin-3.5.26 test/integration/workarea/admin/pricing_skus_integration_test.rb
workarea-admin-3.4.45 test/integration/workarea/admin/pricing_skus_integration_test.rb
workarea-admin-3.5.25 test/integration/workarea/admin/pricing_skus_integration_test.rb
workarea-admin-3.5.23 test/integration/workarea/admin/pricing_skus_integration_test.rb
workarea-admin-3.4.44 test/integration/workarea/admin/pricing_skus_integration_test.rb
workarea-admin-3.5.22 test/integration/workarea/admin/pricing_skus_integration_test.rb
workarea-admin-3.4.43 test/integration/workarea/admin/pricing_skus_integration_test.rb
workarea-admin-3.5.21 test/integration/workarea/admin/pricing_skus_integration_test.rb
workarea-admin-3.4.42 test/integration/workarea/admin/pricing_skus_integration_test.rb
workarea-admin-3.5.20 test/integration/workarea/admin/pricing_skus_integration_test.rb
workarea-admin-3.4.41 test/integration/workarea/admin/pricing_skus_integration_test.rb
workarea-admin-3.5.19 test/integration/workarea/admin/pricing_skus_integration_test.rb
workarea-admin-3.4.40 test/integration/workarea/admin/pricing_skus_integration_test.rb
workarea-admin-3.5.18 test/integration/workarea/admin/pricing_skus_integration_test.rb
workarea-admin-3.4.39 test/integration/workarea/admin/pricing_skus_integration_test.rb
workarea-admin-3.5.17 test/integration/workarea/admin/pricing_skus_integration_test.rb
workarea-admin-3.4.38 test/integration/workarea/admin/pricing_skus_integration_test.rb
workarea-admin-3.5.16 test/integration/workarea/admin/pricing_skus_integration_test.rb
workarea-admin-3.4.37 test/integration/workarea/admin/pricing_skus_integration_test.rb