test/server/adapters/standard_test.rb in whois-1.1.4 vs test/server/adapters/standard_test.rb in whois-1.1.5
- old
+ new
@@ -7,23 +7,30 @@
@klass = Whois::Server::Adapters::Standard
@server = @klass.new(*@definition)
end
def test_query
- @server.expects(:ask_the_socket).with("domain.foo", "whois.foo", 43).returns("Whois Response")
- response = @server.query("domain.foo")
- assert_equal "Whois Response", response.to_s
+ response = "Whois Response"
+ expected = response
+ @server.expects(:ask_the_socket).with("domain.foo", "whois.foo", 43).returns(response)
+ answer = @server.query("domain.foo")
+
+ assert_equal expected,
+ answer.to_s
assert_equal [Whois::Answer::Part.new(response, "whois.foo")],
- @server.buffer
+ answer.parts
end
def test_query_with_port
+ response = "Whois Response"
+ expected = response
@server = @klass.new(:tld, ".foo", "whois.foo", { :port => 20 })
- @server.expects(:ask_the_socket).with("domain.foo", "whois.foo", 20).returns("Whois Response")
- response = @server.query("domain.foo")
- assert_equal "Whois Response",
- response.to_s
+ @server.expects(:ask_the_socket).with("domain.foo", "whois.foo", 20).returns(response)
+ answer = @server.query("domain.foo")
+
+ assert_equal expected,
+ answer.to_s
assert_equal [Whois::Answer::Part.new(response, "whois.foo")],
- @server.buffer
+ answer.parts
end
end
\ No newline at end of file