在 rspec 中打印响应 [英] Printing response in rspec

查看:30
本文介绍了在 rspec 中打印响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个测试无法开始工作,所以我想通过打印响应来调试我的规范.

I have a test I can't get to work, so I want to debug my spec by printing the reponse.

我尝试在我的规范中使用 print response.body,但在 test.log 或控制台中都没有输出.

I've tried using print response.body in my spec, but there's no output in either test.log or the console.

我可能遗漏了一些东西.我应该尝试什么?

I'm probably missing something. What should I try?

谢谢!

推荐答案

您可以使用以下方法打印响应:

You can print the response using:

raise response.body 

这篇关于在 rspec 中打印响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆