开发者

How do you actually see the html output during a functional test in rails

One of my assert_selects is driving me up the wall. Its failing and of course its开发者_如何学C telling me what it expected but Id like to see what was actually there on that page when it rendered to track down this bug.

Ive already tried using my browser and the app is behaving as it should but thats using development data.

Is there a command i can use to print the html to console or my test log?


Just do

puts @response.body 

right before the problematic assertion and you should see the thing.


Webrat does this very thing with the command save_and_open_page.


on a Rails 5.x environment, using parsed_body worked for me, while just plain body did not:

puts @response.parsed_body
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜