How to check for a JSON response using RSpec?

后端 未结 14 1302
谎友^
谎友^ 2020-11-29 16:03

I have the following code in my controller:

format.json { render :json => { 
        :flashcard  => @flashcard,
        :lesson     => @lesson,
             


        
14条回答
  •  悲&欢浪女
    2020-11-29 16:28

    Building off of Kevin Trowbridge's answer

    response.header['Content-Type'].should include 'application/json'
    

提交回复
热议问题