Sha256: 0d1862082e19edd7ab82d9dc83b901bd282173ebc2a5bd759da2c82d8d5e0e01

Contents?: true

Size: 915 Bytes

Versions: 34

Compression:

Stored size: 915 Bytes

Contents

require 'test_helper'

module Workarea
  module Inventory
    class CollectionTest < TestCase
      setup :set_skus

      def set_skus
        @collection = Collection.new(%w(SKU1 SKU2 SKU3))
        Sku.create(id: 'SKU1', policy: 'standard', available: 10)
        Sku.create(id: 'SKU2', policy: 'standard', available: 9)
      end

      def test_returns_an_existing_record
        sku = @collection.for_sku('SKU1')

        assert_equal('SKU1', sku.id)
        assert_equal('standard', sku.policy)
        assert_equal(10, sku.available)
      end

      def test_returns_a_record_for_skus_missing_inventory
        sku = @collection.for_sku('SKU3')

        assert_equal('SKU3', sku.id)
        assert_equal('ignore', sku.policy)
      end

      def test_available_to_sell
        @collection = Collection.new(%w(SKU1 SKU2))
        assert_equal(19, @collection.available_to_sell)
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
workarea-core-3.4.45 test/models/workarea/inventory/collection_test.rb
workarea-core-3.4.44 test/models/workarea/inventory/collection_test.rb
workarea-core-3.4.43 test/models/workarea/inventory/collection_test.rb
workarea-core-3.4.42 test/models/workarea/inventory/collection_test.rb
workarea-core-3.4.41 test/models/workarea/inventory/collection_test.rb
workarea-core-3.4.40 test/models/workarea/inventory/collection_test.rb
workarea-core-3.4.39 test/models/workarea/inventory/collection_test.rb
workarea-core-3.4.38 test/models/workarea/inventory/collection_test.rb
workarea-core-3.4.37 test/models/workarea/inventory/collection_test.rb
workarea-core-3.4.36 test/models/workarea/inventory/collection_test.rb
workarea-core-3.4.35 test/models/workarea/inventory/collection_test.rb
workarea-core-3.4.34 test/models/workarea/inventory/collection_test.rb
workarea-core-3.4.33 test/models/workarea/inventory/collection_test.rb
workarea-core-3.4.32 test/models/workarea/inventory/collection_test.rb
workarea-core-3.4.31 test/models/workarea/inventory/collection_test.rb
workarea-core-3.4.30 test/models/workarea/inventory/collection_test.rb
workarea-core-3.4.29 test/models/workarea/inventory/collection_test.rb
workarea-core-3.4.28 test/models/workarea/inventory/collection_test.rb
workarea-core-3.4.27 test/models/workarea/inventory/collection_test.rb
workarea-core-3.4.26 test/models/workarea/inventory/collection_test.rb