1 require File.join(File.dirname(__FILE__), 'base_geocoder_test')
3 GeoKit::Geocoders::geocoder_ca = "SOMEKEYVALUE"
5 class CaGeocoderTest < BaseGeocoderTest #:nodoc: all
8 <?xml version="1.0" encoding="UTF-8" ?>
9 <geodata><latt>49.243086</latt><longt>-123.153684</longt></geodata>
13 @ca_full_hash = {:street_address=>"2105 West 32nd Avenue",:city=>"Vancouver", :state=>"BC"}
14 @ca_full_loc = GeoKit::GeoLoc.new(@ca_full_hash)
17 def test_geocoder_with_geo_loc_with_account
18 response = MockSuccess.new
19 response.expects(:body).returns(CA_SUCCESS)
20 url = "http://geocoder.ca/?stno=2105&addresst=West+32nd+Avenue&city=Vancouver&prov=BC&auth=SOMEKEYVALUE&geoit=xml"
21 GeoKit::Geocoders::CaGeocoder.expects(:call_geocoder_service).with(url).returns(response)
22 verify(GeoKit::Geocoders::CaGeocoder.geocode(@ca_full_loc))
25 def test_service_unavailable
26 response = MockFailure.new
27 #Net::HTTP.expects(:get_response).with(URI.parse("http://geocoder.ca/?stno=2105&addresst=West+32nd+Avenue&city=Vancouver&prov=BC&auth=SOMEKEYVALUE&geoit=xml")).returns(response)
28 url = "http://geocoder.ca/?stno=2105&addresst=West+32nd+Avenue&city=Vancouver&prov=BC&auth=SOMEKEYVALUE&geoit=xml"
29 GeoKit::Geocoders::CaGeocoder.expects(:call_geocoder_service).with(url).returns(response)
30 assert !GeoKit::Geocoders::CaGeocoder.geocode(@ca_full_loc).success
36 assert_equal "BC", location.state
37 assert_equal "Vancouver", location.city
38 assert_equal "49.243086,-123.153684", location.ll
39 assert !location.is_us?