Sha256: 3aec2f016cb0e0ae1003b0f0cb11acffd03e649789f74d861e72e0b3d8e04809

Contents?: true

Size: 682 Bytes

Versions: 62

Compression:

Stored size: 682 Bytes

Contents

require 'test_helper'

module Workarea
  module Admin
    class ProductImagesViewModelTest < TestCase
      def test_groups_ordered_images_by_their_option_value
        product = create_product
        green_2 = product.images.build(option: 'green', position: 2)
        green_1 = product.images.build(option: 'green', position: 1)

        red_2 = product.images.build(option: 'red', position: 2)
        red_1 = product.images.build(option: 'red', position: 1)

        view_model = ProductImagesViewModel.new(product)
        assert_equal(
          { 'Red' => [red_1, red_2], 'Green' => [green_1, green_2] },
          view_model.by_option
        )
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-admin-3.4.13 test/view_models/workarea/admin/product_images_view_model_test.rb
workarea-admin-3.4.12 test/view_models/workarea/admin/product_images_view_model_test.rb