blind
No view rendering in Rails controller testing.
Installation
As usual, you can install it using rubygems.
$ gem install blind
If you"re using Bundler, add this line to your application"s Gemfile:
gem "blind", group: :testAnd then execute:
$ bundleUsage
Include the Blind module in your controller tests:
class ActionController::TestCase
include Blind
endIf you want to assert against the contents of the
rendered view, you can use the render_views! method:
class HomeControllerTest < ActionController::TestCase
render_views!
def test_body
get :index
assert_match /content/, response.body
end
endMotivation
Check this blog post.