Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding test for GeocodeError

git-svn-id: http://geokit.rubyforge.org/svn/trunk@17 9265c765-0211-4c68-b2df-6d1bd6e20c4d
  • Loading branch information...
commit 739363b342e940bbcf31831344f0e00d51827f1d 1 parent 4d68901
bill_eisenhauer authored
Showing with 6 additions and 1 deletion.
  1. +1 −1  lib/geo_kit/mappable.rb
  2. +5 −0 test/acts_as_mappable_test.rb
View
2  lib/geo_kit/mappable.rb
@@ -49,7 +49,7 @@ def distance_between(from, to, options={})
def geocode(location)
res = Geocoders::MultiGeocoder.geocode(location)
return res if res.success
- raise Geocoders::GeocodeError
+ raise GeoKit::Geocoders::GeocodeError
end
protected
View
5 test/acts_as_mappable_test.rb
@@ -77,6 +77,11 @@ def test_distance_to_geocoded
assert_equal 0, @custom_loc_a.distance_to("Irving, TX")
end
+ def test_distance_to_geocoded_error
+ GeoKit::Geocoders::MultiGeocoder.expects(:geocode).with("Irving, TX").returns(GeoKit::GeoLoc.new)
+ assert_raise(GeoKit::Geocoders::GeocodeError) { @custom_loc_a.distance_to("Irving, TX") }
+ end
+
def test_custom_attributes_distance_calculations
assert_equal 0, @custom_loc_a.distance_to(@loc_a)
assert_equal 0, CustomLocation.distance_between(@custom_loc_a, @loc_a)
Please sign in to comment.
Something went wrong with that request. Please try again.