Sha256: 97772db21e029b0684ed375919927f9270aed9add107345317c7ac10208daf72

Contents?: true

Size: 746 Bytes

Versions: 4

Compression:

Stored size: 746 Bytes

Contents

# rubocop:disable Metrics/AbcSize

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

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

  def to_s
    parts = []
    parts.push(original_error.to_s)
    parts.push("=== #{request.method} #{request.path} =====================")
    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

4 entries across 4 versions & 1 rubygems

Version Path
rspec-httpd-0.0.15 lib/rspec/httpd/expectation_failed.rb
rspec-httpd-0.0.14 lib/rspec/httpd/expectation_failed.rb
rspec-httpd-0.0.12 lib/rspec/httpd/expectation_failed.rb
rspec-httpd-0.0.11 lib/rspec/httpd/expectation_failed.rb