Module: Rack::Minitest::Assertions

Included in:
Expectations
Defined in:
lib/rack-minitest/assertions.rb

Instance Method Summary collapse

Instance Method Details

#assert_accepted(response) ⇒ Object



13
14
15
# File 'lib/rack-minitest/assertions.rb', line 13

def assert_accepted(response)
  assert_response_status response, 202
end

#assert_bad_request(response) ⇒ Object



25
26
27
# File 'lib/rack-minitest/assertions.rb', line 25

def assert_bad_request(response)
  assert_response_status response, 400
end

#assert_created(response) ⇒ Object



9
10
11
# File 'lib/rack-minitest/assertions.rb', line 9

def assert_created(response)
  assert_response_status response, 201
end

#assert_forbidden(response) ⇒ Object



33
34
35
# File 'lib/rack-minitest/assertions.rb', line 33

def assert_forbidden(response)
  assert_response_status response, 403
end

#assert_internal_server_error(response) ⇒ Object



45
46
47
# File 'lib/rack-minitest/assertions.rb', line 45

def assert_internal_server_error(response)
  assert_response_status response, 500
end

#assert_moved_permanently(response) ⇒ Object



21
22
23
# File 'lib/rack-minitest/assertions.rb', line 21

def assert_moved_permanently(response)
  assert_response_status response, 301
end

#assert_no_content(response) ⇒ Object



17
18
19
# File 'lib/rack-minitest/assertions.rb', line 17

def assert_no_content(response)
  assert_response_status response, 204
end

#assert_not_found(response) ⇒ Object



37
38
39
# File 'lib/rack-minitest/assertions.rb', line 37

def assert_not_found(response)
  assert_response_status response, 404
end

#assert_ok(response) ⇒ Object



5
6
7
# File 'lib/rack-minitest/assertions.rb', line 5

def assert_ok(response)
  assert_response_status response, 200
end

#assert_response_status(response, status) ⇒ Object



49
50
51
# File 'lib/rack-minitest/assertions.rb', line 49

def assert_response_status(response, status)
  assert response.status == status, "Expected response to be a #{status}, but was a #{response.status}"
end

#assert_unauthorized(response) ⇒ Object



29
30
31
# File 'lib/rack-minitest/assertions.rb', line 29

def assert_unauthorized(response)
  assert_response_status response, 401
end

#assert_unprocessable_entity(response) ⇒ Object



41
42
43
# File 'lib/rack-minitest/assertions.rb', line 41

def assert_unprocessable_entity(response)
  assert_response_status response, 422
end