Sha256: 3d72fed204caecd7379dc0b99b4286707c5f2bcb58fac983c980c9811f89850a

Contents?: true

Size: 901 Bytes

Versions: 25

Compression:

Stored size: 901 Bytes

Contents

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

describe 'product filters', :type => :model do
  # Regression test for #1709
  context 'finds products filtered by brand' do
    let(:product) { create(:product) }
    before do
      property = 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
      expect { Spree::Core::ProductFilters.brand_filter }.not_to raise_error
    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)
      expect { Spree::Core::ProductFilters.brand_filter[:labels] }.not_to raise_error
    end
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
solidus_core-1.1.4 spec/models/spree/product_filter_spec.rb
solidus_core-1.0.7 spec/models/spree/product_filter_spec.rb
spree_core-3.1.5 spec/models/spree/product_filter_spec.rb
spree_core-3.1.4 spec/models/spree/product_filter_spec.rb
spree_core-3.1.3 spec/models/spree/product_filter_spec.rb
spree_core-3.1.2 spec/models/spree/product_filter_spec.rb
spree_core-3.0.10 spec/models/spree/product_filter_spec.rb
spree_core-3.1.1 spec/models/spree/product_filter_spec.rb
spree_core-3.1.0 spec/models/spree/product_filter_spec.rb
spree_core-3.1.0.rc4 spec/models/spree/product_filter_spec.rb
spree_core-3.0.9 spec/models/spree/product_filter_spec.rb
spree_core-3.1.0.rc3 spec/models/spree/product_filter_spec.rb
spree_core-3.1.0.rc2 spec/models/spree/product_filter_spec.rb
spree_core-3.1.0.rc1 spec/models/spree/product_filter_spec.rb
solidus_core-1.0.6 spec/models/spree/product_filter_spec.rb
spree_core-3.0.8 spec/models/spree/product_filter_spec.rb
spree_core-3.0.7 spec/models/spree/product_filter_spec.rb
solidus_core-1.1.3 spec/models/spree/product_filter_spec.rb
solidus_core-1.0.5 spec/models/spree/product_filter_spec.rb
spree_core-3.0.6.1 spec/models/spree/product_filter_spec.rb