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.27 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.26 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.25 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.23 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.22 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.21 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.20 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.19 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.18 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.17 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.16 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.15 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.14 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.13 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.12 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.11 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.10 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.9 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.8 test/models/workarea/search/storefront/product/categories_test.rb
workarea-core-3.5.7 test/models/workarea/search/storefront/product/categories_test.rb