Class: RSpec::Rails::Swagger::ResponseFormatters::JSON

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/rails/swagger/response_formatters.rb

Instance Method Summary collapse

Instance Method Details

#call(resp) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/rspec/rails/swagger/response_formatters.rb', line 7

def call(resp)
  if resp.kind_of? String
    ::JSON.parse(resp)
  else
    resp
  end
rescue ::JSON::ParserError
  resp
end