-
Notifications
You must be signed in to change notification settings - Fork 4
/
assertions.rb
54 lines (42 loc) · 1.26 KB
/
assertions.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
module Rack
module Minitest
module Assertions
def assert_ok(response)
assert_response_status response, 200
end
def assert_created(response)
assert_response_status response, 201
end
def assert_accepted(response)
assert_response_status response, 202
end
def assert_no_content(response)
assert_response_status response, 204
end
def assert_moved_permanently(response)
assert_response_status response, 301
end
def assert_bad_request(response)
assert_response_status response, 400
end
def assert_unauthorized(response)
assert_response_status response, 401
end
def assert_forbidden(response)
assert_response_status response, 403
end
def assert_not_found(response)
assert_response_status response, 404
end
def assert_unprocessable_entity(response)
assert_response_status response, 422
end
def assert_internal_server_error(response)
assert_response_status response, 500
end
def assert_response_status(response, status)
assert response.status == status, "Expected response to be a #{status}, but was a #{response.status}"
end
end
end
end