Sha256: 1a9c23365e4b5696fa8cfeeb85a90ca04b8115d5508e5e0f681e6f2450c272ce

Contents?: true

Size: 830 Bytes

Versions: 62

Compression:

Stored size: 830 Bytes

Contents

require 'test_helper'

module Workarea
  module Storefront
    class ShippingViewModelTest < TestCase
      def test_items
        order = create_order(
          items: [
            { product_id: 'PRODUCT', sku: 'SKU1', quantity: 1 },
            { product_id: 'PRODUCT', sku: 'SKU2', quantity: 2 }
          ]
        )

        shipping = create_shipping(
          order_id: order.id,
          quantities: { order.items.second.id => 1 }
        )

        view_model = ShippingViewModel.wrap(shipping)

        assert_equal(1, view_model.items.size)
        assert(view_model.items.first.is_a?(OrderItemViewModel))
        assert_equal('PRODUCT', view_model.items.first.product_id)
        assert_equal('SKU2', view_model.items.first.sku)
        assert_equal(1, view_model.items.first.quantity)
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

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