Skip to content

Commit

Permalink
Add spec for new address scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
jjromeo committed Apr 26, 2023
1 parent e14b2f9 commit bd1f334
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions spec/models/waste_carriers_engine/address_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@

module WasteCarriersEngine
RSpec.describe Address do
describe 'scopes' do
let(:address_with_area) { create(:address, area: "Area Name") }
let(:address_without_area) { create(:address, area: "") }
let(:address_with_nil_area) { create(:address, area: nil) }
let(:address_with_postcode) { create(:address, postcode: "BS1 5AH") }
let(:address_without_postcode) { create(:address, postcode: nil) }

describe ".missing_area" do
it "returns addresses with an empty or nil area" do
expect(Address.missing_area).to include(address_without_area, address_with_nil_area)
expect(Address.missing_area).not_to include(address_with_area)
end
end

describe ".with_postcode" do
it "returns addresses with a postcode" do
expect(Address.with_postcode).to include(address_with_postcode)
expect(Address.with_postcode).not_to include(address_without_postcode)
end
end
end

describe "#assign_house_number_and_address_lines" do
let(:address) { build(:address) }

Expand Down

0 comments on commit bd1f334

Please sign in to comment.