Skip to content

Commit

Permalink
Improved geocoding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Oct 2, 2023
1 parent 1b8c2cf commit 830d9b1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/geocode_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ def test_geocode_true
assert_enqueued_with(job: Ahoy::GeocodeV2Job, queue: "ahoy") do
get products_url
end
perform_enqueued_jobs
visit = Ahoy::Visit.last
perform_enqueued_jobs
visit.reload
assert_equal "Country", visit.country
assert_equal "Region", visit.region
assert_equal "City", visit.city
Expand All @@ -35,8 +36,9 @@ def test_geocode_true_cookies_none
assert_enqueued_with(job: Ahoy::GeocodeV2Job, queue: "ahoy") do
get products_url
end
perform_enqueued_jobs
visit = Ahoy::Visit.last
perform_enqueued_jobs
visit.reload
assert_equal "Country", visit.country
assert_equal "Region", visit.region
assert_equal "City", visit.city
Expand All @@ -50,10 +52,11 @@ def test_geocode_failed
assert_enqueued_with(job: Ahoy::GeocodeV2Job, queue: "ahoy") do
get products_url
end
visit = Ahoy::Visit.last
Geocoder.stub(:search, []) do
perform_enqueued_jobs
end
visit = Ahoy::Visit.last
visit.reload
assert_nil visit.country
assert_nil visit.region
assert_nil visit.city
Expand Down

0 comments on commit 830d9b1

Please sign in to comment.