How to test JSON result from Ruby on Rails functional tests?

前端 未结 9 533
暗喜
暗喜 2021-01-29 23:35

How can I assert my Ajax request and test the JSON output from Ruby on Rails functional tests?

9条回答
  •  故里飘歌
    2021-01-29 23:58

    Actually, you can use implicitly the JSON module:

    assert_equal assigns(:user).to_json, @response.body
    

提交回复
热议问题