class RspecWebServiceOutputter::Response

Public Class Methods

new(response) click to toggle source
# File lib/rspec-webservice-outputter/base.rb, line 57
def initialize(response)
  @response = response
end

Public Instance Methods

to_s() click to toggle source
# File lib/rspec-webservice-outputter/base.rb, line 61
def to_s
  "RESPONSE (#{@response.code}):\n#{response_body}"
end

Private Instance Methods

response_body() click to toggle source
# File lib/rspec-webservice-outputter/base.rb, line 67
def response_body
  if @response.body
    begin
      JSON.pretty_generate(JSON.parse(@response.body))
    rescue
      "[Non-JSON response body]"
    end
  else
    "[Empty response body]"
  end
end