test/cache_test.rb in geocoder-1.1.8 vs test/cache_test.rb in geocoder-1.1.9

- old
+ new

@@ -14,6 +14,22 @@ results = Geocoder.search("Madison Square Garden") assert results.first.cache_hit, "Lookup #{l} did not return cached result." end end + + def test_google_over_query_limit_does_not_hit_cache + Geocoder.configure(:cache => {}) + Geocoder.configure(:lookup => :google) + set_api_key!(:google) + Geocoder.configure(:always_raise => :all) + assert_raises Geocoder::OverQueryLimitError do + Geocoder.search("over limit") + end + lookup = Geocoder::Lookup.get(:google) + assert_equal false, lookup.instance_variable_get(:@cache_hit) + assert_raises Geocoder::OverQueryLimitError do + Geocoder.search("over limit") + end + assert_equal false, lookup.instance_variable_get(:@cache_hit) + end end