Skip to content
Snippets Groups Projects
Commit 7959237d authored by Alex Reisner's avatar Alex Reisner
Browse files

Raise exception on bad lookup configuration.

parent 7b2db0ec
No related branches found
No related tags found
No related merge requests found
......@@ -68,6 +68,10 @@ module Geocoder
name = name.to_s
require "geocoder/lookups/#{name}"
eval("Geocoder::Lookup::#{name[0...1].upcase + name[1..-1]}.new")
else
valids = valid_lookups.map{ |l| ":#{l}" }.join(", ")
raise ConfigurationError, "Please specify a valid lookup for Geocoder " +
"(#{name.inspect} is not one of: #{valids})."
end
end
......
......@@ -7,6 +7,16 @@ class GeocoderTest < Test::Unit::TestCase
end
# --- configuration ---
#
def test_exception_raised_on_bad_lookup_config
Geocoder::Configuration.lookup = :stoopid
assert_raises Geocoder::ConfigurationError do
Geocoder.search "something dumb"
end
end
# --- sanity checks ---
def test_distance_between
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment