Sha256: 02ddd42be3976c42d956a5b1a6ce024556f83587b8e07272c12019da6d688a23

Contents?: true

Size: 1.05 KB

Versions: 28

Compression:

Stored size: 1.05 KB

Contents

require 'test_helper'

module Workarea
  module Search
    class Storefront
      class Product
        class CategoriesTest < TestCase
          include TestCase::SearchIndexing

          def test_includes_featured_category_ids_the_product_has
            product = create_product(name: 'Foo')
            category = create_category(
              product_rules: [
                { name: 'search', operator: 'equals', value: 'foo' }
              ]
            )

            IndexProduct.perform(product)
            CategoryQuery.new(category).create

            category_1 = create_category(product_ids: [product.id])
            category_2 = create_category(product_ids: [product.id])
            category_3 = create_category(product_ids: [product.id])

            results = Product.new(product).category_id
            assert_equal(3, results.length)
            assert_includes(results, category_1.id)
            assert_includes(results, category_2.id)
            assert_includes(results, category_3.id)
          end
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
workarea-core-3.5.6 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.5 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.4 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.3 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.2 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.1 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.0 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.0.beta.1 test/models/workarea/search/storefront/product/categories_test.rb