Sha256: f55b4522c45ec9c4bb841f99d0bb653d8436d4128fa08845196f2113e4becc0f
Contents?: true
Size: 1.59 KB
Versions: 1
Compression:
Stored size: 1.59 KB
Contents
require File.join(File.dirname(__FILE__), "helper") Geokit::Geocoders::CaGeocoder.key = "SOMEKEYVALUE" class CaGeocoderTest < BaseGeocoderTest #:nodoc: all CA_SUCCESS = <<-EOF <?xml version="1.0" encoding="UTF-8" ?> <geodata> <latt>49.243086</latt><longt>-123.153684</longt> <postal>V6L2J7</postal> <standard> <stnumber>2105</stnumber> <staddress>32nd AVE W</staddress><city>Vancouver</city><prov>BC</prov> <confidence>0.8</confidence></standard> </geodata> EOF def setup @ca_full_hash = { street_address: "2105 West 32nd Avenue", city: "Vancouver", province: "BC", state: "BC" } @ca_full_txt = "2105 West 32nd Avenue Vancouver BC" end def test_geocoder_with_geo_loc_with_account response = MockSuccess.new response.expects(:body).returns(CA_SUCCESS) url = "http://geocoder.ca/?locate=2105+West+32nd+Avenue+Vancouver+BC&auth=SOMEKEYVALUE&geoit=xml" Geokit::Geocoders::CaGeocoder.expects(:call_geocoder_service).with(url).returns(response) verify(Geokit::Geocoders::CaGeocoder.geocode(@ca_full_txt)) end def test_service_unavailable response = MockFailure.new url = "http://geocoder.ca/?locate=2105+West+32nd+Avenue+Vancouver+BC&auth=SOMEKEYVALUE&geoit=xml" Geokit::Geocoders::CaGeocoder.expects(:call_geocoder_service).with(url).returns(response) assert !Geokit::Geocoders::CaGeocoder.geocode(@ca_full_txt).success end private def verify(location) assert_equal "BC", location.province assert_equal "Vancouver", location.city assert_equal "49.243086,-123.153684", location.ll assert !location.is_us? end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
geokit-1.10.0 | test/test_ca_geocoder.rb |