graticule 1.0.0.pre2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/geocode +0 -0
- data/lib/graticule.rb +2 -0
- data/lib/graticule/geocoder/bogus.rb +1 -1
- data/lib/graticule/geocoder/geonames.rb +1 -1
- data/lib/graticule/geocoder/google.rb +4 -1
- data/lib/graticule/geocoder/host_ip.rb +1 -1
- data/lib/graticule/version.rb +3 -0
- metadata +73 -131
- data/.autotest +0 -13
- data/.gitignore +0 -6
- data/Rakefile +0 -123
- data/VERSION +0 -1
- data/graticule.gemspec +0 -199
- data/init.rb +0 -2
- data/site/index.html +0 -114
- data/site/plugin.html +0 -82
- data/site/stylesheets/style.css +0 -69
- data/test/config.yml.default +0 -33
- data/test/fixtures/responses/freethepostcode/not_found.txt +0 -3
- data/test/fixtures/responses/freethepostcode/success.txt +0 -2
- data/test/fixtures/responses/geocoder_ca/success.xml +0 -12
- data/test/fixtures/responses/geocoder_us/success.xml +0 -8
- data/test/fixtures/responses/geocoder_us/unknown.xml +0 -1
- data/test/fixtures/responses/geonames/missing.xml +0 -4
- data/test/fixtures/responses/geonames/success.xml +0 -14
- data/test/fixtures/responses/geonames/unknown.xml +0 -4
- data/test/fixtures/responses/google/badkey.xml +0 -1
- data/test/fixtures/responses/google/limit.xml +0 -10
- data/test/fixtures/responses/google/missing_address.xml +0 -1
- data/test/fixtures/responses/google/only_coordinates.xml +0 -1
- data/test/fixtures/responses/google/partial.xml +0 -16
- data/test/fixtures/responses/google/server_error.xml +0 -10
- data/test/fixtures/responses/google/success.xml +0 -16
- data/test/fixtures/responses/google/success_multiple_results.xml +0 -88
- data/test/fixtures/responses/google/unavailable.xml +0 -1
- data/test/fixtures/responses/google/unknown_address.xml +0 -8
- data/test/fixtures/responses/host_ip/private.txt +0 -4
- data/test/fixtures/responses/host_ip/success.txt +0 -4
- data/test/fixtures/responses/host_ip/unknown.txt +0 -4
- data/test/fixtures/responses/local_search_maps/empty.txt +0 -1
- data/test/fixtures/responses/local_search_maps/not_found.txt +0 -1
- data/test/fixtures/responses/local_search_maps/success.txt +0 -1
- data/test/fixtures/responses/mapquest/multi_result.xml +0 -1
- data/test/fixtures/responses/mapquest/success.xml +0 -1
- data/test/fixtures/responses/multimap/missing_params.xml +0 -4
- data/test/fixtures/responses/multimap/no_matches.xml +0 -4
- data/test/fixtures/responses/multimap/success.xml +0 -19
- data/test/fixtures/responses/yahoo/success.xml +0 -3
- data/test/fixtures/responses/yahoo/unknown_address.xml +0 -6
- data/test/graticule/distance_test.rb +0 -58
- data/test/graticule/geocoder/freethepostcode_test.rb +0 -36
- data/test/graticule/geocoder/geocoder_ca_test.rb +0 -41
- data/test/graticule/geocoder/geocoder_us_test.rb +0 -43
- data/test/graticule/geocoder/geocoders.rb +0 -55
- data/test/graticule/geocoder/geonames_test.rb +0 -48
- data/test/graticule/geocoder/google_test.rb +0 -107
- data/test/graticule/geocoder/host_ip_test.rb +0 -40
- data/test/graticule/geocoder/local_search_maps_test.rb +0 -30
- data/test/graticule/geocoder/mapquest_test.rb +0 -49
- data/test/graticule/geocoder/multi_test.rb +0 -51
- data/test/graticule/geocoder/multimap_test.rb +0 -52
- data/test/graticule/geocoder/yahoo_test.rb +0 -49
- data/test/graticule/geocoder_test.rb +0 -23
- data/test/graticule/location_test.rb +0 -86
- data/test/graticule/precision_test.rb +0 -37
- data/test/mocks/uri.rb +0 -52
- data/test/test_helper.rb +0 -30
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Graticule
|
4
|
-
module Geocoder
|
5
|
-
class GeocoderUsTest < Test::Unit::TestCase
|
6
|
-
|
7
|
-
def setup
|
8
|
-
URI::HTTP.responses = []
|
9
|
-
URI::HTTP.uris = []
|
10
|
-
|
11
|
-
@geocoder = GeocoderUs.new
|
12
|
-
@location = Location.new(
|
13
|
-
:street => "1600 Pennsylvania Ave NW, Washington DC 20502",
|
14
|
-
:longitude => -77.037684,
|
15
|
-
:latitude => 38.898748
|
16
|
-
)
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_success
|
20
|
-
prepare_response(:success)
|
21
|
-
assert_equal @location, @geocoder.locate('1600 Pennsylvania Ave, Washington DC')
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_url
|
25
|
-
prepare_response(:success)
|
26
|
-
@geocoder.locate('1600 Pennsylvania Ave, Washington DC')
|
27
|
-
assert_equal 'http://rpc.geocoder.us/service/rest/geocode?address=1600%20Pennsylvania%20Ave,%20Washington%20DC',
|
28
|
-
URI::HTTP.uris.first
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_locate_bad_address
|
32
|
-
prepare_response(:unknown)
|
33
|
-
assert_raises(AddressError) { @geocoder.locate('yuck') }
|
34
|
-
end
|
35
|
-
|
36
|
-
protected
|
37
|
-
def prepare_response(id)
|
38
|
-
URI::HTTP.responses << response('geocoder_us', id)
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Graticule
|
4
|
-
|
5
|
-
# Generic tests for all geocoders (theoretically)
|
6
|
-
module GeocodersTestCase
|
7
|
-
|
8
|
-
def test_success
|
9
|
-
return unless prepare_response(:success)
|
10
|
-
|
11
|
-
location = Location.new(
|
12
|
-
:street => "1600 Amphitheatre Pkwy",
|
13
|
-
:city => "Mountain View",
|
14
|
-
:state => "CA",
|
15
|
-
:zip => "94043",
|
16
|
-
:country => "US",
|
17
|
-
:longitude => -122.083739,
|
18
|
-
:latitude => 37.423021,
|
19
|
-
:precision => :address
|
20
|
-
)
|
21
|
-
assert_equal location, @geocoder.locate('1600 Amphitheatre Parkway, Mountain View, CA')
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_bad_key
|
25
|
-
return unless prepare_response(:badkey)
|
26
|
-
assert_raises(CredentialsError) { @geocoder.locate('x') }
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_locate_missing_address
|
30
|
-
return unless prepare_response(:missing_address)
|
31
|
-
assert_raises(AddressError) { @geocoder.locate 'x' }
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_locate_server_error
|
35
|
-
return unless prepare_response(:server_error)
|
36
|
-
assert_raises(Error) { @geocoder.locate 'x' }
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_locate_too_many_queries
|
40
|
-
return unless prepare_response(:limit)
|
41
|
-
assert_raises(CredentialsError) { @geocoder.locate 'x' }
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_locate_unavailable_address
|
45
|
-
return unless prepare_response(:unavailable)
|
46
|
-
assert_raises(AddressError) { @geocoder.locate 'x' }
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_locate_unknown_address
|
50
|
-
return unless prepare_response(:unknown_address)
|
51
|
-
assert_raises(AddressError) { @geocoder.locate 'x' }
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
55
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Graticule
|
4
|
-
module Geocoder
|
5
|
-
class GeonamesTest < Test::Unit::TestCase
|
6
|
-
def setup
|
7
|
-
URI::HTTP.responses = []
|
8
|
-
URI::HTTP.uris = []
|
9
|
-
@geocoder = Geonames.new
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_time_zone
|
13
|
-
return unless prepare_response(:success)
|
14
|
-
|
15
|
-
chicago = Location.new(:latitude => 41.85, :longitude => -87.65)
|
16
|
-
assert_equal 'America/Chicago', @geocoder.time_zone(chicago)
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
# def test_locate_server_error
|
21
|
-
# return unless prepare_response(:server_error)
|
22
|
-
# assert_raises(Error) { @geocoder.locate 'x' }
|
23
|
-
# end
|
24
|
-
#
|
25
|
-
# def test_locate_too_many_queries
|
26
|
-
# return unless prepare_response(:limit)
|
27
|
-
# assert_raises(CredentialsError) { @geocoder.locate 'x' }
|
28
|
-
# end
|
29
|
-
#
|
30
|
-
# def test_locate_unavailable_address
|
31
|
-
# return unless prepare_response(:unavailable)
|
32
|
-
# assert_raises(AddressError) { @geocoder.locate 'x' }
|
33
|
-
# end
|
34
|
-
#
|
35
|
-
# def test_locate_unknown_address
|
36
|
-
# return unless prepare_response(:unknown_address)
|
37
|
-
# assert_raises(AddressError) { @geocoder.locate 'x' }
|
38
|
-
# end
|
39
|
-
|
40
|
-
protected
|
41
|
-
|
42
|
-
def prepare_response(id = :success)
|
43
|
-
URI::HTTP.responses << response('geonames', id)
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,107 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Graticule
|
4
|
-
module Geocoder
|
5
|
-
class GoogleTest < Test::Unit::TestCase
|
6
|
-
def setup
|
7
|
-
URI::HTTP.responses = []
|
8
|
-
URI::HTTP.uris = []
|
9
|
-
@geocoder = Google.new('APP_ID')
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_success
|
13
|
-
return unless prepare_response(:success)
|
14
|
-
|
15
|
-
location = Location.new(
|
16
|
-
:street => "1600 Amphitheatre Pkwy",
|
17
|
-
:locality => "Mountain View",
|
18
|
-
:region => "CA",
|
19
|
-
:postal_code => "94043",
|
20
|
-
:country => "US",
|
21
|
-
:longitude => -122.0850350,
|
22
|
-
:latitude => 37.4231390,
|
23
|
-
:precision => :address
|
24
|
-
)
|
25
|
-
assert_equal location, @geocoder.locate('1600 Amphitheatre Parkway, Mountain View, CA')
|
26
|
-
end
|
27
|
-
|
28
|
-
# The #locate parameters are broad, so the XML response contains
|
29
|
-
# multiple results at street-level precision. We expect to get the
|
30
|
-
# first result back, and it should not contain a postal code.
|
31
|
-
def test_success_multiple_results
|
32
|
-
return unless prepare_response(:success_multiple_results)
|
33
|
-
|
34
|
-
location = Location.new(
|
35
|
-
:street => "Queen St W",
|
36
|
-
:locality => "Toronto",
|
37
|
-
:region => "ON",
|
38
|
-
:postal_code => nil,
|
39
|
-
:country => "CA",
|
40
|
-
:longitude => -79.4125590,
|
41
|
-
:latitude => 43.6455030,
|
42
|
-
:precision => :street
|
43
|
-
)
|
44
|
-
assert_equal location, @geocoder.locate('Queen St West, Toronto, ON CA')
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_only_coordinates
|
48
|
-
return unless prepare_response(:only_coordinates)
|
49
|
-
|
50
|
-
location = Location.new(:longitude => -17.000000, :latitude => 15.000000)
|
51
|
-
assert_equal location, @geocoder.locate('15-17 & 16 Railroad Square, Nashua, NH, 03064')
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_partial
|
55
|
-
return unless prepare_response(:partial)
|
56
|
-
|
57
|
-
location = Location.new(
|
58
|
-
:locality => "San Francisco",
|
59
|
-
:region => "CA",
|
60
|
-
:country => "US",
|
61
|
-
:longitude => -122.419209,
|
62
|
-
:latitude => 37.775206,
|
63
|
-
:precision => :locality
|
64
|
-
)
|
65
|
-
|
66
|
-
assert_equal location, @geocoder.locate('sf ca')
|
67
|
-
end
|
68
|
-
|
69
|
-
def test_locate_missing_address
|
70
|
-
return unless prepare_response(:missing_address)
|
71
|
-
assert_raises(AddressError) { @geocoder.locate 'x' }
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_locate_server_error
|
75
|
-
return unless prepare_response(:server_error)
|
76
|
-
assert_raises(Error) { @geocoder.locate 'x' }
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_locate_too_many_queries
|
80
|
-
return unless prepare_response(:limit)
|
81
|
-
assert_raises(CredentialsError) { @geocoder.locate 'x' }
|
82
|
-
end
|
83
|
-
|
84
|
-
def test_locate_unavailable_address
|
85
|
-
return unless prepare_response(:unavailable)
|
86
|
-
assert_raises(AddressError) { @geocoder.locate 'x' }
|
87
|
-
end
|
88
|
-
|
89
|
-
def test_locate_unknown_address
|
90
|
-
return unless prepare_response(:unknown_address)
|
91
|
-
assert_raises(AddressError) { @geocoder.locate 'x' }
|
92
|
-
end
|
93
|
-
|
94
|
-
def test_bad_key
|
95
|
-
return unless prepare_response(:badkey)
|
96
|
-
assert_raises(CredentialsError) { @geocoder.locate('x') }
|
97
|
-
end
|
98
|
-
|
99
|
-
protected
|
100
|
-
|
101
|
-
def prepare_response(id = :success)
|
102
|
-
URI::HTTP.responses << response('google', id)
|
103
|
-
end
|
104
|
-
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Graticule
|
4
|
-
module Geocoder
|
5
|
-
class HostIpTest < Test::Unit::TestCase
|
6
|
-
|
7
|
-
def setup
|
8
|
-
@geocoder = HostIp.new
|
9
|
-
URI::HTTP.responses = []
|
10
|
-
URI::HTTP.uris = []
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_success
|
14
|
-
prepare_response :success
|
15
|
-
|
16
|
-
location = Location.new :country => 'US', :locality => 'Mountain View',
|
17
|
-
:region => 'CA', :latitude => 37.402, :longitude => -122.078
|
18
|
-
|
19
|
-
assert_equal location, @geocoder.locate('64.233.167.99')
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_unknown
|
23
|
-
prepare_response :unknown
|
24
|
-
assert_raises(AddressError) { @geocoder.locate('127.0.0.1') }
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_private_ip
|
28
|
-
prepare_response :private
|
29
|
-
assert_raises(AddressError) { @geocoder.locate('127.0.0.1') }
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def prepare_response(id = :success)
|
35
|
-
URI::HTTP.responses << response('host_ip', id, 'txt')
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Graticule
|
4
|
-
module Geocoder
|
5
|
-
class LocalSearchMapsTest < Test::Unit::TestCase
|
6
|
-
|
7
|
-
def setup
|
8
|
-
@geocoder = LocalSearchMaps.new
|
9
|
-
URI::HTTP.responses = []
|
10
|
-
URI::HTTP.uris = []
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_success
|
14
|
-
prepare_response :success
|
15
|
-
|
16
|
-
location = Location.new :latitude => 51.510036, :longitude => -0.130427
|
17
|
-
|
18
|
-
assert_equal location, @geocoder.locate(:street => '48 Leicester Square',
|
19
|
-
:locality => 'London', :country => 'UK')
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def prepare_response(id = :success)
|
25
|
-
URI::HTTP.responses << response('local_search_maps', id, 'txt')
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Graticule
|
4
|
-
module Geocoder
|
5
|
-
class MapquestTest < Test::Unit::TestCase
|
6
|
-
def setup
|
7
|
-
URI::HTTP.responses = []
|
8
|
-
URI::HTTP.uris = []
|
9
|
-
@geocoder = Mapquest.new('client_id', 'password')
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_success
|
13
|
-
prepare_response(:success)
|
14
|
-
location = Location.new(
|
15
|
-
:country => "US",
|
16
|
-
:latitude => 44.152019,
|
17
|
-
:locality => "Lovell",
|
18
|
-
:longitude => -70.892706,
|
19
|
-
:postal_code => "04051-3919",
|
20
|
-
:precision => :address,
|
21
|
-
:region => "ME",
|
22
|
-
:street => "44 Allen Rd"
|
23
|
-
)
|
24
|
-
assert_equal(location, @geocoder.locate('44 Allen Rd., Lovell, ME 04051'))
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_multi_result
|
28
|
-
prepare_response(:multi_result)
|
29
|
-
location = Location.new(
|
30
|
-
:country => "US",
|
31
|
-
:latitude => 40.925598,
|
32
|
-
:locality => "Stony Brook",
|
33
|
-
:longitude => -73.141403,
|
34
|
-
:postal_code => nil,
|
35
|
-
:precision => :locality,
|
36
|
-
:region => "NY",
|
37
|
-
:street => nil
|
38
|
-
)
|
39
|
-
assert_equal(location, @geocoder.locate('217 Union St., NY'))
|
40
|
-
end
|
41
|
-
|
42
|
-
protected
|
43
|
-
|
44
|
-
def prepare_response(id)
|
45
|
-
URI::HTTP.responses << response('mapquest', id)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Graticule
|
4
|
-
module Geocoder
|
5
|
-
class MultiTest < Test::Unit::TestCase
|
6
|
-
|
7
|
-
def setup
|
8
|
-
@mock_geocoders = [mock("geocoder 1"), mock("geocoder 2")]
|
9
|
-
@mock_geocoders.each {|g| g.stubs(:locate) }
|
10
|
-
@geocoder = Multi.new(*@mock_geocoders)
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_locate_calls_each_geocoder_and_raises_error
|
14
|
-
@mock_geocoders.each do |g|
|
15
|
-
g.expects(:locate).with('test').raises(Graticule::AddressError)
|
16
|
-
end
|
17
|
-
assert_raises(Graticule::AddressError) { @geocoder.locate 'test' }
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_locate_returns_first_result_without_calling_others
|
21
|
-
result = mock("result")
|
22
|
-
@mock_geocoders.first.expects(:locate).returns(result)
|
23
|
-
@mock_geocoders.last.expects(:locate).never
|
24
|
-
assert_equal result, @geocoder.locate('test')
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_locate_with_custom_block
|
28
|
-
@mock_geocoders.first.expects(:locate).returns(1)
|
29
|
-
@mock_geocoders.last.expects(:locate).returns(2)
|
30
|
-
@geocoder = Multi.new(*@mock_geocoders) {|r| r == 2 }
|
31
|
-
assert_equal 2, @geocoder.locate('test')
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_locate_with_custom_block_and_no_match
|
35
|
-
@mock_geocoders.first.expects(:locate).returns(1)
|
36
|
-
@mock_geocoders.last.expects(:locate).returns(2)
|
37
|
-
@geocoder = Multi.new(*@mock_geocoders) {|r| r == 3 }
|
38
|
-
assert_raises(Graticule::AddressError) { @geocoder.locate('test') }
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_timeout
|
42
|
-
@mock = @mock_geocoders.first
|
43
|
-
def @mock.locate(*x)
|
44
|
-
sleep 1
|
45
|
-
end
|
46
|
-
@geocoder = Multi.new(@mock, :timeout => 0.1)
|
47
|
-
assert_raise(Timeout::Error) { @geocoder.locate('foo') }
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Graticule
|
4
|
-
module Geocoder
|
5
|
-
class MultimapTest < Test::Unit::TestCase
|
6
|
-
|
7
|
-
def setup
|
8
|
-
URI::HTTP.responses = []
|
9
|
-
URI::HTTP.uris = []
|
10
|
-
@geocoder = Multimap.new 'API_KEY'
|
11
|
-
@location = Location.new(
|
12
|
-
:street => "Oxford Street",
|
13
|
-
:locality => "LONDON",
|
14
|
-
:postal_code => "W1",
|
15
|
-
:country => "GB",
|
16
|
-
:longitude => -0.14839,
|
17
|
-
:latitude => 51.51452,
|
18
|
-
:precision => :address
|
19
|
-
)
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_locate
|
23
|
-
prepare_response(:success)
|
24
|
-
assert_equal @location, @geocoder.locate('Oxford Street, LONDON, W1')
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_url_from_string
|
28
|
-
prepare_response(:success)
|
29
|
-
@geocoder.locate('Oxford Street, LONDON, W1')
|
30
|
-
assert_equal 'http://clients.multimap.com/API/geocode/1.2/API_KEY?qs=Oxford%20Street,%20LONDON,%20W1', URI::HTTP.uris.first
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_url_from_location
|
34
|
-
prepare_response(:success)
|
35
|
-
@geocoder.locate(:street => 'Oxford Street', :locality => 'London')
|
36
|
-
assert_equal 'http://clients.multimap.com/API/geocode/1.2/API_KEY?city=London&countryCode=&postalCode=®ion=&street=Oxford%20Street', URI::HTTP.uris.first
|
37
|
-
end
|
38
|
-
|
39
|
-
|
40
|
-
def test_locate_bad_address
|
41
|
-
prepare_response(:no_matches)
|
42
|
-
assert_raise(Error) { @geocoder.locate('yucksthoeusthaoeusnhtaosu') }
|
43
|
-
end
|
44
|
-
|
45
|
-
protected
|
46
|
-
def prepare_response(id)
|
47
|
-
URI::HTTP.responses << response('multimap', id)
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|