Skip to content

Commit

Permalink
Don't worry about Ruby 1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
weppos committed Oct 29, 2012
1 parent 73d24c2 commit 555a362
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions spec/whois/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,18 @@

describe "#query" 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
query = ["example", ".", "test"]
query.instance_eval do
def to_s
join
end
end

server = Whois::Server::Adapters::Base.new(:tld, ".test", "whois.test")
server.expects(:lookup).with(instance_of(String))
Whois::Server.expects(:guess).with(instance_of(String)).returns(server)
server.expects(:lookup).with("example.test")
Whois::Server.expects(:guess).with("example.test").returns(server)

klass.new.query(["example", ".", "test"])
klass.new.query(query)
end

it "converts the argument to downcase" do
Expand Down

0 comments on commit 555a362

Please sign in to comment.