Exception: RSpec::Httpd::ExpectationFailed
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- RSpec::Httpd::ExpectationFailed
- Defined in:
- lib/rspec/httpd/expectation_failed.rb
Overview
rubocop:disable Metrics/AbcSize
Instance Attribute Summary collapse
-
#original_error ⇒ Object
readonly
Returns the value of attribute original_error.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(original_error, response:) ⇒ ExpectationFailed
constructor
A new instance of ExpectationFailed.
- #request ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(original_error, response:) ⇒ ExpectationFailed
Returns a new instance of ExpectationFailed.
6 7 8 |
# File 'lib/rspec/httpd/expectation_failed.rb', line 6 def initialize(original_error, response:) @original_error, @response = original_error, response end |
Instance Attribute Details
#original_error ⇒ Object (readonly)
Returns the value of attribute original_error.
4 5 6 |
# File 'lib/rspec/httpd/expectation_failed.rb', line 4 def original_error @original_error end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
4 5 6 |
# File 'lib/rspec/httpd/expectation_failed.rb', line 4 def response @response end |
Instance Method Details
#request ⇒ Object
10 11 12 |
# File 'lib/rspec/httpd/expectation_failed.rb', line 10 def request response.request end |
#to_s ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rspec/httpd/expectation_failed.rb', line 14 def to_s parts = [] parts.push(original_error.to_s) parts.push("=== #{request} =====================") parts.push("> " + request.body.gsub("\n", "\n> ")) if request.body parts.push("--- response ------------------------------------") parts.push("< " + response.body.gsub("\n", "\n< ")) if response.body parts.push("==================================================================") parts.join("\n") end |