File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed
Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ class NoSuchPageError < Error; end
66 class NoSuchTargetError < Error ; end
77 class NotImplementedError < Error ; end
88 class BinaryNotFoundError < Error ; end
9- class EmptyPathError < Error ; end
9+ class EmptyPathError < Error ; end
10+ class ServerError < Error ; end
1011
1112 class StatusError < Error
1213 def initialize ( url , message = nil )
Original file line number Diff line number Diff line change 4040 )
4141 end
4242 end
43+
44+ it "handles server error" do
45+ expect { page . go_to ( "/ferrum/server_error" ) } . not_to raise_error
46+
47+ expect ( page . network . status ) . to eq ( 500 )
48+ expect ( page . network . traffic . last . error . description )
49+ . to eq ( "Failed to load resource: the server responded with a status of 500 (Internal Server Error)" )
50+ end
4351 end
4452 end
4553
Original file line number Diff line number Diff line change @@ -241,7 +241,7 @@ def requires_credentials(login, password)
241241 return if authorized? ( login , password )
242242
243243 headers [ "WWW-Authenticate" ] = %(Basic realm="Restricted Area")
244- halt 401 , "Not authorized\n "
244+ halt ( 401 , "Not authorized\n " )
245245 end
246246
247247 def authorized? ( login , password )
@@ -271,7 +271,11 @@ def authorized?(login, password)
271271 end
272272
273273 get "/ferrum/unexist.png" do
274- halt 404
274+ halt ( 404 )
275+ end
276+
277+ get "/ferrum/server_error" do
278+ halt ( 500 )
275279 end
276280
277281 get "/ferrum/status/:status" do
@@ -329,7 +333,7 @@ def authorized?(login, password)
329333 post "/ferrum/ping" do
330334 # Sleeping to simulate a server that does not send a response to PING requests
331335 sleep 5
332- halt 204
336+ halt ( 204 )
333337 end
334338
335339 protected
You can’t perform that action at this time.
0 commit comments