module RspecExtensions::JsonResponse

Public Instance Methods

json_response() click to toggle source
# File lib/rspec_tapas/json_response.rb, line 3
def json_response
  parsed_json = JSON.parse(response.body)
  if parsed_json.is_a?(Hash)
    HashWithIndifferentAccess.new(parsed_json)
  else
    parsed_json.map do |entry|
      entry.is_a?(Hash) ? HashWithIndifferentAccess.new(entry) : entry
    end
  end
end