Spec too many variants exported to DFC

This commit is contained in:
Maikel Linke
2023-03-14 14:13:39 +11:00
parent b8338fb9af
commit 6e514acc77

View 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