Permalink
Browse files

Fix tests and remove 'kind_of?'

  • Loading branch information...
1 parent 943db04 commit 215e244f79f75ce31d03886f8700cae272593c78 @jferris jferris committed Aug 10, 2012
Showing with 8 additions and 4 deletions.
  1. +1 −1 lib/capybara/webkit/connection.rb
  2. +3 −0 lib/capybara/webkit/socket_debugger.rb
  3. +4 −3 spec/connection_spec.rb
@@ -112,7 +112,7 @@ def connect
def attempt_connect
@socket = @socket_class.open("127.0.0.1", @port)
- if @socket.kind_of?(TCPSocket) and defined?(Socket::TCP_NODELAY)
+ if defined?(Socket::TCP_NODELAY)
@socket.setsockopt(:IPPROTO_TCP, :TCP_NODELAY, 1)
end
rescue Errno::ECONNREFUSED
@@ -29,6 +29,9 @@ def gets
received @socket.gets
end
+ def setsockopt(level, name, value)
+ end
+
private
def sent(content)
View
@@ -35,11 +35,12 @@
end
it 'sets appropriate options on its socket' do
+ socket = stub('socket')
+ TCPSocket.stub(:open).and_return(socket)
if defined?(Socket::TCP_NODELAY)
- args = [:IPPROTO_TCP, :TCP_NODELAY, 1]
- TCPSocket.any_instance.should_receive(:setsockopt).with(*args)
+ socket.should_receive(:setsockopt).with(:IPPROTO_TCP, :TCP_NODELAY, 1)
else
- TCPSocket.any_instance.should_not_receive(:setsockopt)
+ socket.should_not_receive(:setsockopt)
end
Capybara::Webkit::Connection.new
end

0 comments on commit 215e244

Please sign in to comment.