Remove dead code

This commit is contained in:
Luis Ramos
2020-04-18 14:37:07 +01:00
parent 314fed063d
commit 437c7367db
2 changed files with 0 additions and 34 deletions

View File

@@ -10,12 +10,6 @@ module Spree
scope :sorted, -> { order(:name) }
scope :applied_by, ->(enterprise) {
select('DISTINCT spree_properties.*').
joins(:product_properties).
where('spree_product_properties.product_id IN (?)', enterprise.supplied_product_ids)
}
scope :ever_sold_by, ->(shop) {
joins(products: { variants: { exchanges: :order_cycle } }).
merge(Exchange.outgoing).

View File

@@ -3,34 +3,6 @@ require 'spec_helper'
module Spree
describe Property do
describe "scopes" do
describe ".applied_by" do
let(:producer) { create(:supplier_enterprise) }
let(:producer_other) { create(:supplier_enterprise) }
let(:product) { create(:simple_product, supplier: producer) }
let(:product_other_producer) { create(:simple_product, supplier: producer_other) }
let(:product_other_property) { create(:simple_product, supplier: producer) }
let(:property) { product.properties.last }
let(:property_other) { product_other_producer.properties.last }
before do
product.set_property 'Organic', 'NASAA 12345'
product_other_property.set_property 'Organic', 'NASAA 12345'
product_other_producer.set_property 'Biodynamic', 'ASDF 1234'
end
it "returns properties applied to supplied products" do
expect(Spree::Property.applied_by(producer)).to eq [property]
end
it "doesn't return properties not applied" do
expect(Spree::Property.applied_by(producer)).not_to include property_other
end
it "doesn't return duplicates" do
expect(Spree::Property.applied_by(producer).to_a.size).to eq 1
end
end
describe ".currently_sold_by and .ever_sold_by" do
let!(:shop) { create(:distributor_enterprise) }
let!(:shop_other) { create(:distributor_enterprise) }