Sha256: 24dc47381c0b47ffdae9c359a4a3dbc2a7710dcf2dfbe0a1338e7ecdeccaa293

Contents?: true

Size: 969 Bytes

Versions: 62

Compression:

Stored size: 969 Bytes

Contents

require 'test_helper'

module Workarea
  module Search
    class CategorizationTest < TestCase
      include TestCase::SearchIndexing

      def test_categorization_filtering
        create_product
        product_one = create_product
        product_two = create_product
        category_one = create_category(product_ids: [product_one.id])
        category_two = create_category(product_ids: [product_two.id])
        BulkIndexProducts.perform

        search = Categorization.new(category_ids: [category_one.id])
        assert_equal([product_one], search.results)

        search = Categorization.new(category_ids: [category_two.id])
        assert_equal([product_two], search.results)

        search = Categorization.new(
          category_ids: [category_one.id, category_two.id]
        )
        assert_equal(2, search.total)
        assert_includes(search.results, product_one)
        assert_includes(search.results, product_two)
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

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