Files
openfoodnetwork/engines/dfc_provider/spec/services/address_builder_spec.rb
Maikel Linke 2175c59a6b Load spec helper not knowing Rails
When the application is not preloaded then running Rspec doesn't know
Rails until the spec helper is loaded. So we can't use Rails to find the
path of the spec helper. This has been fixed before but the DFC Address
code was developed at the same time and missed.
2023-09-21 08:54:32 +10:00

38 lines
790 B
Ruby

# frozen_string_literal: true
require_relative "../spec_helper"
describe AddressBuilder do
subject(:result) { described_class.address(address) }
let(:address) {
build(
:address,
id: 1, address1: "Paradise 15", zipcode: "0001", city: "Goosnargh",
)
}
describe ".address" do
it "assigns a semantic id" do
expect(result.semanticId).to eq(
"http://test.host/api/dfc/addresses/1"
)
end
it "assigns a street" do
expect(result.street).to eq "Paradise 15"
end
it "assigns a postal code" do
expect(result.postalCode).to eq "0001"
end
it "assigns a city" do
expect(result.city).to eq "Goosnargh"
end
it "assigns a country" do
expect(result.country).to eq "Australia"
end
end
end