mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-05 02:41:33 +00:00
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.
38 lines
790 B
Ruby
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
|