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 536cf67 commit 069cd2e
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions test/geocode_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ def self.search(ip)
require "ostruct"

[OpenStruct.new(
country: "Test"
country: "Country",
state: "Region",
city: "City",
latitude: 1,
longitude: 2
)]
end
end
Expand All @@ -17,7 +21,12 @@ def test_geocode_true
get products_url
end
perform_enqueued_jobs
assert_equal "Test", Ahoy::Visit.last.country
visit = Ahoy::Visit.last
assert_equal "Country", visit.country
assert_equal "Region", visit.region
assert_equal "City", visit.city
assert_equal 1, visit.latitude
assert_equal 2, visit.longitude
end
end

Expand All @@ -27,7 +36,12 @@ def test_geocode_true_cookies_none
get products_url
end
perform_enqueued_jobs
assert_equal "Test", Ahoy::Visit.last.country
visit = Ahoy::Visit.last
assert_equal "Country", visit.country
assert_equal "Region", visit.region
assert_equal "City", visit.city
assert_equal 1, visit.latitude
assert_equal 2, visit.longitude
end
end

Expand Down

0 comments on commit 069cd2e

Please sign in to comment.