You could parse the response body like this:
parsed_body = JSON.parse(response.body)
Then you can make your assertions against that parsed content.
parsed_body["foo"].should == "bar"
More Related Contents:
- How to set request headers in rspec request spec?
- How do I parse JSON with Ruby on Rails? [duplicate]
- Why isn’t my CORS configuration causing the server to filter incoming requests? How can I make the server only accept requests from a specific origin?
- How to override to_json in Rails?
- Reducing n+1 queries using the Bullet and RSpec gems
- How can I test the page title with Capybara 2.0?
- Add virtual attribute to json output
- Storing arrays in database : JSON vs. serialized array
- How to spec a private method
- POST JSON to API using Rails and HTTParty
- POST json to rails server
- undefined method `get’ for #
- rails dates with json
- Visit method not found in my rspec
- Suppress Ruby warnings when running specs
- Rails rspec set subdomain
- Include associated model when rendering JSON in Rails
- How to check a checkbox in capybara?
- undefined method `visit’ when using RSpec and Capybara in rails
- Controller spec unknown keyword: id
- ActiveRecord serialize using JSON instead of YAML
- Set Rspec default GET request format to JSON
- Why not use shared ActiveRecord connections for Rspec + Selenium?
- JSON encoding wrongly escaped (Rails 3, Ruby 1.9.2)
- Why is Rspec saying “Failure/Error: Unable to find matching line from backtrace”?
- Rspec and capybara, difference between visit and get methods, with regards to the current_path object
- Why does adding “sleep 1” in an after hook cause this Rspec/Capybara test to pass?
- Rails Object Relationships and JSON Rendering
- Configuring Warden for use in RSpec controller specs
- Incompatible library version: nokogiri.bundle requires version 11.0.0 or later, but libxml2.2.dylib