Como verificar uma resposta JSON usando o RSpec?
Eu tenho o seguinte código no meu controlador:
format.json { render :json => {
:flashcard => @flashcard,
:lesson => @lesson,
:success => true
}
No meu teste do controlador RSpec, quero verificar se um determinado cenário recebe uma resposta json bem-sucedida, portanto, tive a seguinte linha:
controller.should_receive(:render).with(hash_including(:success => true))
Embora ao executar meus testes, recebo o seguinte erro:
Failure/Error: controller.should_receive(:render).with(hash_including(:success => false))
(#<AnnoController:0x00000002de0560>).render(hash_including(:success=>false))
expected: 1 time
received: 0 times
Estou verificando a resposta incorretamente?