File tree 3 files changed +17
-4
lines changed
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
6
6
class NoSuchTargetError < Error ; end
7
7
class NotImplementedError < Error ; end
8
8
class BinaryNotFoundError < Error ; end
9
- class EmptyPathError < Error ; end
9
+ class EmptyPathError < Error ; end
10
+ class ServerError < Error ; end
10
11
11
12
class StatusError < Error
12
13
def initialize ( url , message = nil )
Original file line number Diff line number Diff line change 40
40
)
41
41
end
42
42
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
43
51
end
44
52
end
45
53
Original file line number Diff line number Diff line change @@ -241,7 +241,7 @@ def requires_credentials(login, password)
241
241
return if authorized? ( login , password )
242
242
243
243
headers [ "WWW-Authenticate" ] = %(Basic realm="Restricted Area")
244
- halt 401 , "Not authorized\n "
244
+ halt ( 401 , "Not authorized\n " )
245
245
end
246
246
247
247
def authorized? ( login , password )
@@ -271,7 +271,11 @@ def authorized?(login, password)
271
271
end
272
272
273
273
get "/ferrum/unexist.png" do
274
- halt 404
274
+ halt ( 404 )
275
+ end
276
+
277
+ get "/ferrum/server_error" do
278
+ halt ( 500 )
275
279
end
276
280
277
281
get "/ferrum/status/:status" do
@@ -329,7 +333,7 @@ def authorized?(login, password)
329
333
post "/ferrum/ping" do
330
334
# Sleeping to simulate a server that does not send a response to PING requests
331
335
sleep 5
332
- halt 204
336
+ halt ( 204 )
333
337
end
334
338
335
339
protected
You can’t perform that action at this time.
0 commit comments