Module: RspecExtensions::JsonResponse
- Defined in:
- lib/rspec_tapas/json_response.rb
Instance Method Summary collapse
Instance Method Details
#json_response ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# 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 |