How can I assert my Ajax request and test the JSON output from Ruby on Rails functional tests?
As noted, you use JSON.parse to test the JSON, but where you perform that assertion depends on how you are rendering the JSON.
If you are generating the JSON in the controller, you parse the JSON in controller functional tests (as the other answers are showing). If you are rendering JSON, with a view using Jbuilder, rabl or another gem that takes this approach, then parse the JSON in the view unit tests not the controller functional tests. Unit tests are generally faster to execute and easier to write - e.g., you can build models in-memory rather than create them in the database.