Sha256: 4bd5f7bc000d09dbdf7f55a09844e86c1806efa5a9be418ec43d58e7f6acccad

Contents?: true

Size: 892 Bytes

Versions: 6

Compression:

Stored size: 892 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

6 entries across 6 versions & 1 rubygems

Version Path
spree_core-3.3.0.rc1 spec/models/spree/product_filter_spec.rb
spree_core-3.2.1 spec/models/spree/product_filter_spec.rb
spree_core-3.2.0 spec/models/spree/product_filter_spec.rb
spree_core-3.2.0.rc3 spec/models/spree/product_filter_spec.rb
spree_core-3.2.0.rc2 spec/models/spree/product_filter_spec.rb
spree_core-3.2.0.rc1 spec/models/spree/product_filter_spec.rb