octo-g
Last Updated: February 25, 2016
·
1.27K
· gvaughn

Rails controller test output visualization

I find myself digging into controller tests that I'm not deeply familiar with and just want to get something tactical accomplished. Assuming a Mac, you can put this after a call to a controller method to easily see the resulting html. Often there's enough of a clue in there for me to figure out what other setup or validation the test needs.

File.open('tmp.html', 'w+') {|f| f.write(@response.body)}
system 'open tmp.html'

1 Response
Add your response

4158

Nice, the launchy gem is another great alternative

over 1 year ago ·