Module: Simple::HTTP::Assertions
- Defined in:
- lib/simple/http/assertions.rb
Overview
- Author
-
radiospiel ([email protected])
- Copyright
-
Copyright © 2011-2015 radiospiel
- License
-
Distributes under the terms of the Modified BSD License, see LICENSE.BSD for details.
Instance Method Summary collapse
- #assert_http_error(expected_status, &block) ⇒ Object
- #assert_http_redirects_to(expected_location, &block) ⇒ Object
Instance Method Details
#assert_http_error(expected_status, &block) ⇒ Object
6 7 8 9 |
# File 'lib/simple/http/assertions.rb', line 6 def assert_http_error(expected_status, &block) http_error = assert_raises(Simple::HTTP::Error, &block) assert_equal(expected_status, http_error.code) end |
#assert_http_redirects_to(expected_location, &block) ⇒ Object
11 12 13 14 15 |
# File 'lib/simple/http/assertions.rb', line 11 def assert_http_redirects_to(expected_location, &block) http_error = assert_raises(Simple::HTTP::Error, &block) assert_includes([301, 302], http_error.code) assert_equal(expected_location, http_error.response["Location"]) end |