From 4c4dadd9294ba674d4f395946b3e9a08834eea56 Mon Sep 17 00:00:00 2001 From: Mike Heft Date: Wed, 3 Jul 2024 11:32:42 -0600 Subject: [PATCH] Add trait to skip populating place_id to test geocoder place id --- spec/factories/addresses.rb | 4 ++++ spec/models/address_spec.rb | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/spec/factories/addresses.rb b/spec/factories/addresses.rb index 4566130..b3a179d 100644 --- a/spec/factories/addresses.rb +++ b/spec/factories/addresses.rb @@ -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 diff --git a/spec/models/address_spec.rb b/spec/models/address_spec.rb index 2851962..26c6170 100644 --- a/spec/models/address_spec.rb +++ b/spec/models/address_spec.rb @@ -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