In ApplicationHelper, I have this code:
def inside_layout layout = 'application', &block
@template.instance_variable_set '@content_for_layout', capture(&block)
concat \
@template.render :file => "layouts/#{layout}", :use_full_path => true
end
which behaves as follows:
application.html.haml:
!!!
%html
%head
...
%body
= yield
common_pages.html.haml:
- inside_layout do
...
Then the layout_pages layout is displayed in the application layout.
How can I check this helper with RSpec?
When I call in_layout from the spec file:
helper.inside_layout { }
RSpec says the error:
ActionView::MissingTemplate in 'ApplicationHelper inside_layout should render nested layout within application layout'
Missing layout layouts/application.erb in view path
But the application works fine.
source
share