Skip to content

Commit

Permalink
Fixed NoMethod error when an IPAddr instance is an argument of Geocod…
Browse files Browse the repository at this point in the history
…er::Query.new

fixes #1673
  • Loading branch information
Matthew Lemieux committed Dec 18, 2024
1 parent 134eacb commit c4264dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/geocoder/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def sanitized_text
text.split(/\s*,\s*/).join(',')
end
else
text.strip
text.to_s.strip
end
end

Expand Down
4 changes: 4 additions & 0 deletions test/unit/query_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ class QueryTest < GeocoderTestCase

def test_detect_ipv4
assert Geocoder::Query.new("232.65.123.94").ip_address?
ip = IPAddr.new("232.65.123.94")
assert Geocoder::Query.new(ip).ip_address?
end

def test_detect_ipv6
assert Geocoder::Query.new("3ffe:0b00:0000:0000:0001:0000:0000:000a").ip_address?
ip = IPAddr.new("3ffe:0b00:0000:0000:0001:0000:0000:000a")
assert Geocoder::Query.new(ip).ip_address?
end

def test_detect_non_ip_address
Expand Down

0 comments on commit c4264dd

Please sign in to comment.