Skip to content

Commit

Permalink
Add trait to skip populating place_id to test geocoder place id
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeheft committed Jul 3, 2024
1 parent 068c869 commit 4c4dadd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions spec/factories/addresses.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@
place_id { Faker::Internet.unique.device_token }
latitude { Faker::Address.latitude }
longitude { Faker::Address.longitude }

trait :with_out_place_id do
place_id { nil }
end
end
end
3 changes: 2 additions & 1 deletion spec/models/address_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@

it "#full_address" do
VCR.use_cassette("initial_geocode") do
address = create(:address, line_1: "711 Oval Drive", city: "Fort Collins", state: "CO",
address = create(:address, :with_out_place_id, line_1: "711 Oval Drive", city: "Fort Collins", state: "CO",
zip_code: "80521")
expect(address.full_address).to eq("711 Oval Drive, Fort Collins, CO, 80521")
expect(address.latitude).to eq(40.577655)
expect(address.longitude).to eq(-105.0817584)
binding.pry
expect(address.place_id).to_not be_nil
end
end
Expand Down

0 comments on commit 4c4dadd

Please sign in to comment.