test/test_geoplugin_geocoder.rb in geokit-1.6.0 vs test/test_geoplugin_geocoder.rb in geokit-1.6.5
- old
+ new
@@ -1,10 +1,10 @@
# encoding: utf-8
require File.join(File.dirname(__FILE__), 'test_base_geocoder')
class IpGeocoderTest < BaseGeocoderTest #:nodoc: all
-
+
IP_SUCCESS=<<-EOF
<?xml version="1.0" encoding="UTF-8"?>
<geoPlugin>
<geoplugin_city>Belo Horizonte</geoplugin_city>
<geoplugin_region>Minas Gerais</geoplugin_region>
@@ -22,12 +22,12 @@
EOF
def setup
super
@success.provider = "geoPlugin"
- end
-
+ end
+
def test_successful_lookup
success = MockSuccess.new
success.expects(:body).returns(IP_SUCCESS)
url = 'http://www.geoplugin.net/xml.gp?ip=200.150.38.66'
GeoKit::Geocoders::GeoPluginGeocoder.expects(:call_geocoder_service).with(url).returns(success)
@@ -45,15 +45,15 @@
def test_invalid_ip
location = GeoKit::Geocoders::GeoPluginGeocoder.geocode("pixrum")
assert_not_nil location
assert !location.success?
end
-
+
def test_service_unavailable
failure = MockFailure.new
url = 'http://www.geoplugin.net/xml.gp?ip=10.10.10.10'
GeoKit::Geocoders::GeoPluginGeocoder.expects(:call_geocoder_service).with(url).returns(failure)
location = GeoKit::Geocoders::GeoPluginGeocoder.geocode("10.10.10.10")
assert_not_nil location
assert !location.success?
- end
+ end
end