mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Spec too many variants exported to DFC
This commit is contained in:
28
engines/dfc_provider/spec/services/variant_fetcher_spec.rb
Normal file
28
engines/dfc_provider/spec/services/variant_fetcher_spec.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require DfcProvider::Engine.root.join("spec/spec_helper")
|
||||
|
||||
describe VariantFetcher do
|
||||
subject { VariantFetcher.new(enterprise) }
|
||||
let(:enterprise) { build(:enterprise) }
|
||||
let(:other_enterprise) { build(:enterprise) }
|
||||
|
||||
it "returns an empty set" do
|
||||
expect(subject.scope).to eq []
|
||||
end
|
||||
|
||||
it "returns the variants of a supplier" do
|
||||
product = create(:product, supplier: enterprise)
|
||||
|
||||
pending "ignoring of the master variant"
|
||||
# it currently returns two variants instead of one
|
||||
expect(subject.scope.count).to eq 1
|
||||
expect(subject.scope).to eq product.variants
|
||||
end
|
||||
|
||||
it "ignores the variants of another enterprise" do
|
||||
create(:product, supplier: other_enterprise)
|
||||
|
||||
expect(subject.scope).to eq []
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user