Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Whois::Client#query is no longer case sensitive (closes GH-151).

  • Loading branch information...
commit e569a0c2ebfe6d9105390dbe22aa52261a14d149 1 parent 24a1ed7
@weppos authored
Showing with 13 additions and 4 deletions.
  1. +2 −0  CHANGELOG.md
  2. +1 −1  lib/whois/client.rb
  3. +10 −3 spec/whois/client_spec.rb
View
2  CHANGELOG.md
@@ -16,6 +16,8 @@
* CHANGED: Placed "core_ext" under "whois" namespace (GH-149).
+* CHANGED: Whois::Client#query is no longer case sensitive (GH-151).
+
* FIXED: whois.nic.gl parser must support `Delegate' status.
* FIXED: whois.godaddy.com partially changed response format (GH-148).
View
2  lib/whois/client.rb
@@ -83,7 +83,7 @@ def initialize(settings = {})
# # => #<Whois::Record>
#
def query(object)
- string = object.to_s
+ string = object.to_s.downcase
Timeout::timeout(timeout) do
@server = Server.guess(string)
@server.configure(settings)
View
13 spec/whois/client_spec.rb
@@ -41,16 +41,23 @@
end
describe "#query" do
- it "coerces the argument to string" do
+ it "converts the argument to string" do
# I can't use the String in place of instance_of(String)
# because Array#to_s behaves differently
# on Ruby 1.8.7 and Ruby 1.9.1
# http://redmine.ruby-lang.org/issues/show/2617
- server = Whois::Server::Adapters::Base.new(:tld, ".test", "example.test")
+ server = Whois::Server::Adapters::Base.new(:tld, ".test", "whois.test")
server.expects(:query).with(instance_of(String))
Whois::Server.expects(:guess).with(instance_of(String)).returns(server)
- klass.new.query(["google", ".", "test"])
+ klass.new.query(["example", ".", "test"])
+ end
+
+ it "converts the argument to downcase" do
+ server = Whois::Server::Adapters::Base.new(:tld, ".test", "whois.test")
+ server.expects(:query).with("example.test")
+ Whois::Server.expects(:guess).with(instance_of(String)).returns(server)
+ klass.new.query("Example.TEST")
end
it "detects email" do
Please sign in to comment.
Something went wrong with that request. Please try again.