Sha256: 51e21be6a77b312a267a67db37fc6c9f033fc4862328a9bf80dce0f63b3ce4c1

Contents?: true

Size: 1.22 KB

Versions: 62

Compression:

Stored size: 1.22 KB

Contents

require 'test_helper'

module Workarea
  class BulkAction
    class SequentialProductEditTest < Workarea::IntegrationTest
      def test_finding_product_by_index
        one = create_product
        two = create_product(name: 'Foo A')
        three = create_product(name: 'Foo B')
        four = create_product(name: 'Foo C')

        edit = SequentialProductEdit.new(
          ids: [
            one.to_global_id,
            two.to_global_id,
            three.to_global_id,
            four.to_global_id
          ]
        )

        assert_equal(one, edit.find_product(0))
        assert_equal(two, edit.find_product(1))
        assert_equal(three, edit.find_product(2))
        assert_equal(four, edit.find_product(3))

        assert_equal(one, edit.find_product('0'))
        assert_equal(two, edit.find_product('1'))
        assert_equal(three, edit.find_product('2'))
        assert_equal(four, edit.find_product('3'))

        query = Search::AdminProducts.new(q: 'foo', sort: 'name_asc')
        edit = SequentialProductEdit.new(query_id: query.to_global_id)

        assert_equal(two, edit.find_product(0))
        assert_equal(three, edit.find_product(1))
        assert_equal(four, edit.find_product(2))
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.5.15 test/models/workarea/bulk_action/sequential_product_edit_test.rb
workarea-core-3.4.36 test/models/workarea/bulk_action/sequential_product_edit_test.rb
workarea-core-3.5.14 test/models/workarea/bulk_action/sequential_product_edit_test.rb
workarea-core-3.4.35 test/models/workarea/bulk_action/sequential_product_edit_test.rb
workarea-core-3.5.13 test/models/workarea/bulk_action/sequential_product_edit_test.rb
workarea-core-3.4.34 test/models/workarea/bulk_action/sequential_product_edit_test.rb
workarea-core-3.5.12 test/models/workarea/bulk_action/sequential_product_edit_test.rb
workarea-core-3.4.33 test/models/workarea/bulk_action/sequential_product_edit_test.rb
workarea-core-3.5.11 test/models/workarea/bulk_action/sequential_product_edit_test.rb
workarea-core-3.5.10 test/models/workarea/bulk_action/sequential_product_edit_test.rb
workarea-core-3.4.32 test/models/workarea/bulk_action/sequential_product_edit_test.rb
workarea-core-3.5.9 test/models/workarea/bulk_action/sequential_product_edit_test.rb
workarea-core-3.4.31 test/models/workarea/bulk_action/sequential_product_edit_test.rb
workarea-core-3.5.8 test/models/workarea/bulk_action/sequential_product_edit_test.rb
workarea-core-3.4.30 test/models/workarea/bulk_action/sequential_product_edit_test.rb
workarea-core-3.5.7 test/models/workarea/bulk_action/sequential_product_edit_test.rb
workarea-core-3.4.29 test/models/workarea/bulk_action/sequential_product_edit_test.rb
workarea-core-3.5.6 test/models/workarea/bulk_action/sequential_product_edit_test.rb
workarea-core-3.4.28 test/models/workarea/bulk_action/sequential_product_edit_test.rb
workarea-core-3.5.5 test/models/workarea/bulk_action/sequential_product_edit_test.rb