Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1015 from jwilger/responsive_rescues_system_call_…

…error

Server#responsive? now rescues all SystemCallError exceptions
  • Loading branch information...
commit d0a605dcebe0a73187722b4b3fa910dae3d67ae6 2 parents 4772f50 + 04413c2
Jonas Nicklas jnicklas authored
Showing with 8 additions and 1 deletion.
  1. +1 −1  lib/capybara/server.rb
  2. +7 −0 spec/server_spec.rb
2  lib/capybara/server.rb
View
@@ -62,7 +62,7 @@ def responsive?
if res.is_a?(Net::HTTPSuccess) or res.is_a?(Net::HTTPRedirection)
return res.body == @app.object_id.to_s
end
- rescue Errno::ECONNREFUSED, Errno::EBADF
+ rescue SystemCallError
return false
end
7 spec/server_spec.rb
View
@@ -98,4 +98,11 @@
Capybara.server {|app, port| Capybara.run_default_server(app, port)}
end
end
+
+ it "is not #responsive? when Net::HTTP raises a SystemCallError" do
+ app = lambda { [200, {}, ['Hello, world']] }
+ server = Capybara::Server.new(app)
+ Net::HTTP.should_receive(:start).and_raise(SystemCallError.allocate)
+ expect(server.responsive?).to eq false
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.