Sha256: 3cb0a5c5651d0b866a9cbb243553e0d1764beb478ef59d46ca0d749edf59ae2b

Contents?: true

Size: 726 Bytes

Versions: 10

Compression:

Stored size: 726 Bytes

Contents

# rubocop:disable Metrics/AbcSize

class RSpec::Httpd::ExpectationFailed < RuntimeError
  attr_reader :original_error, :response

  def initialize(original_error, response:)
    @original_error, @response = original_error, response
  end

  def request
    response.request
  end

  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
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rspec-httpd-0.3.8 lib/rspec/httpd/expectation_failed.rb
rspec-httpd-0.3.7 lib/rspec/httpd/expectation_failed.rb
rspec-httpd-0.3.6 lib/rspec/httpd/expectation_failed.rb
rspec-httpd-0.3.5 lib/rspec/httpd/expectation_failed.rb
rspec-httpd-0.3.4 lib/rspec/httpd/expectation_failed.rb
rspec-httpd-0.3.2 lib/rspec/httpd/expectation_failed.rb
rspec-httpd-0.3.1 lib/rspec/httpd/expectation_failed.rb
rspec-httpd-0.3.0 lib/rspec/httpd/expectation_failed.rb
rspec-httpd-0.1.0 lib/rspec/httpd/expectation_failed.rb
rspec-httpd-0.0.17 lib/rspec/httpd/expectation_failed.rb