Sha256: d7391249642cd40eae7e19d5f7f3fd404498ca59d3c733c5c422be3700142924

Contents?: true

Size: 858 Bytes

Versions: 32

Compression:

Stored size: 858 Bytes

Contents

require 'spec_helper'
require 'spree/core/product_filters'

describe 'product filters', type: :model do
  # Regression test for https://github.com/spree/spree/issues/1709
  context 'finds products filtered by brand' do
    let(:product) { create(:product) }
    before do
      Spree::Property.create!(name: "brand", presentation: "brand")
      product.set_property("brand", "Nike")
    end

    it "does not attempt to call value method on Arel::Table" do
      Spree::Core::ProductFilters.brand_filter
    end

    it "can find products in the 'Nike' brand" do
      expect(Spree::Product.brand_any("Nike")).to include(product)
    end
    it "sorts products without brand specified" do
      product.set_property("brand", "Nike")
      create(:product).set_property("brand", nil)
      Spree::Core::ProductFilters.brand_filter[:labels]
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
solidus_core-2.3.1 spec/models/spree/product_filter_spec.rb
solidus_core-2.2.2 spec/models/spree/product_filter_spec.rb
solidus_core-2.1.1 spec/models/spree/product_filter_spec.rb
solidus_core-2.0.3 spec/models/spree/product_filter_spec.rb
solidus_core-1.4.2 spec/models/spree/product_filter_spec.rb
solidus_core-1.3.2 spec/models/spree/product_filter_spec.rb
solidus_core-2.3.0 spec/models/spree/product_filter_spec.rb
solidus_core-2.3.0.rc3 spec/models/spree/product_filter_spec.rb
solidus_core-2.3.0.rc2 spec/models/spree/product_filter_spec.rb
solidus_core-2.3.0.rc1 spec/models/spree/product_filter_spec.rb
solidus_core-2.3.0.beta1 spec/models/spree/product_filter_spec.rb
solidus_core-2.0.2 spec/models/spree/product_filter_spec.rb
solidus_core-1.4.1 spec/models/spree/product_filter_spec.rb
solidus_core-2.2.1 spec/models/spree/product_filter_spec.rb
solidus_core-2.2.0 spec/models/spree/product_filter_spec.rb
solidus_core-2.2.0.rc1 spec/models/spree/product_filter_spec.rb
solidus_core-2.2.0.beta1 spec/models/spree/product_filter_spec.rb
solidus_core-2.1.0 spec/models/spree/product_filter_spec.rb
solidus_core-2.1.0.rc1 spec/models/spree/product_filter_spec.rb
solidus_core-2.0.1 spec/models/spree/product_filter_spec.rb