diff --git a/test/fixtures/freegeoip_no_results.json b/test/fixtures/freegeoip_no_results.json new file mode 100644 index 0000000000000000000000000000000000000000..2ac0915dd0c91079a1b0d2eb3fd3c21194e0a77a --- /dev/null +++ b/test/fixtures/freegeoip_no_results.json @@ -0,0 +1 @@ +<html><title>404: Not Found</title><body>404: Not Found</body></html> diff --git a/test/lookup_test.rb b/test/lookup_test.rb index 38b7cea9fd93299c6d53c236590afca38ad936df..3c72d05b84294fce0a7ce0394ee9645d649edf81 100644 --- a/test/lookup_test.rb +++ b/test/lookup_test.rb @@ -4,7 +4,7 @@ require 'test_helper' class LookupTest < Test::Unit::TestCase def test_search_returns_empty_array_when_no_results - street_lookups.each do |l| + all_lookups.each do |l| lookup = Geocoder.send(:get_lookup, l) assert_equal [], lookup.send(:results, "no results"), "Lookup #{l} does not return empty array when no results." diff --git a/test/test_helper.rb b/test/test_helper.rb index f491504aaed96ec1748d11ce86f3640fa1a395cf..5a417d538abba83e1fb27acd27caf787493ae466 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -122,7 +122,11 @@ module Geocoder def fetch_raw_data(query, reverse = false) raise TimeoutError if query == "timeout" raise SocketError if query == "socket_error" - read_fixture "freegeoip_74_200_247_59.json" + file = case query + when "no results"; :no_results + else "74_200_247_59" + end + read_fixture "freegeoip_#{file}.json" end end