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

Allow forcing of query to be street address.

parent e065f6de
No related branches found
No related tags found
No related merge requests found
......@@ -32,7 +32,7 @@ module Geocoder
# appropriate to the Query text.
#
def lookup
if options[:ip_address] || ip_address?
if !options[:street_address] and (options[:ip_address] or ip_address?)
name = options[:ip_lookup] || Configuration.ip_lookup || Geocoder::Lookup.ip_services.first
else
name = options[:lookup] || Configuration.lookup || Geocoder::Lookup.street_services.first
......
......@@ -57,6 +57,13 @@ class QueryTest < GeocoderTestCase
assert_instance_of Geocoder::Lookup::Google, query.lookup
end
def test_force_specify_street_address
Geocoder.configure({:lookup => :google, :ip_lookup => :freegeoip})
query = Geocoder::Query.new("4.1.0.2", {street_address: true})
assert query.ip_address?
assert_instance_of Geocoder::Lookup::Google, query.lookup
end
def test_force_specify_ip_address_with_ip_lookup
query = Geocoder::Query.new("address", {:ip_address => true, :ip_lookup => :google})
assert !query.ip_address?
......
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