Enabling view rendering for controller specs
Views are normally (for good reason) not rendered in controller specs. If you need it to happen, use:
RSpec 1 (Rails 2):
integrate_views
Show archive.org snapshot
RSpec 2 (Rails 3):
render_views
Show archive.org snapshot
Note that you can't use that inside it
blocks but need to put it in the nesting example group, like this:
describe '#update' do
context 'when rendering views' do
integrate_views
it 'should not fail' do
# This will detect errors that happen during view rendering as well:
expect { put :update, :id => 23 }.to_not raise_error
end
end
end
Wrap spec examples into their own "rendering" context so you don't render views for other specs that don't need it to happen.