mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-30 21:27:17 +00:00
DRY DFC enterprise spec
This commit is contained in:
@@ -8,35 +8,27 @@ describe EnterpriseBuilder do
|
||||
let(:variant) { create(:product, name: "Apple").variants.first }
|
||||
|
||||
describe ".enterprise" do
|
||||
it "assigns a semantic id" do
|
||||
result = builder.enterprise(enterprise)
|
||||
let(:result) { builder.enterprise(enterprise) }
|
||||
|
||||
it "assigns a semantic id" do
|
||||
expect(result.semanticId).to eq(
|
||||
"http://test.host/api/dfc-v1.7/enterprises/#{enterprise.id}"
|
||||
)
|
||||
end
|
||||
|
||||
it "assigns a name" do
|
||||
result = builder.enterprise(enterprise)
|
||||
|
||||
expect(result.name).to eq(enterprise.name)
|
||||
end
|
||||
|
||||
it "assigns a description" do
|
||||
result = builder.enterprise(enterprise)
|
||||
|
||||
expect(result.description).to eq(enterprise.description)
|
||||
end
|
||||
|
||||
it "assigns a VAT Number (ABN in australia)" do
|
||||
result = builder.enterprise(enterprise)
|
||||
|
||||
expect(result.vatNumber).to eq(enterprise.abn)
|
||||
end
|
||||
|
||||
it "assignes products" do
|
||||
result = builder.enterprise(enterprise)
|
||||
|
||||
expect(result.suppliedProducts.count).to eq 1
|
||||
expect(result.suppliedProducts[0].name).to eq "Apple"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user