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.15 test/queries/workarea/search/categorization_test.rb
workarea-core-3.4.36 test/queries/workarea/search/categorization_test.rb
workarea-core-3.5.14 test/queries/workarea/search/categorization_test.rb
workarea-core-3.4.35 test/queries/workarea/search/categorization_test.rb
workarea-core-3.5.13 test/queries/workarea/search/categorization_test.rb
workarea-core-3.4.34 test/queries/workarea/search/categorization_test.rb
workarea-core-3.5.12 test/queries/workarea/search/categorization_test.rb
workarea-core-3.4.33 test/queries/workarea/search/categorization_test.rb
workarea-core-3.5.11 test/queries/workarea/search/categorization_test.rb
workarea-core-3.5.10 test/queries/workarea/search/categorization_test.rb
workarea-core-3.4.32 test/queries/workarea/search/categorization_test.rb
workarea-core-3.5.9 test/queries/workarea/search/categorization_test.rb
workarea-core-3.4.31 test/queries/workarea/search/categorization_test.rb
workarea-core-3.5.8 test/queries/workarea/search/categorization_test.rb
workarea-core-3.4.30 test/queries/workarea/search/categorization_test.rb
workarea-core-3.5.7 test/queries/workarea/search/categorization_test.rb
workarea-core-3.4.29 test/queries/workarea/search/categorization_test.rb
workarea-core-3.5.6 test/queries/workarea/search/categorization_test.rb
workarea-core-3.4.28 test/queries/workarea/search/categorization_test.rb
workarea-core-3.5.5 test/queries/workarea/search/categorization_test.rb