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: :test
And then execute:
$ bundle
Usage
Include the Blind
module in your controller tests:
class ActionController::TestCase
include Blind
end
If 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
end
Motivation
Check this blog post.