Skip to content

Instantly share code, notes, and snippets.

@cyberkni
Created July 14, 2009 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cyberkni/146963 to your computer and use it in GitHub Desktop.
Save cyberkni/146963 to your computer and use it in GitHub Desktop.
<html>
<head>
<%= render partial='header' %>
<body>
<%= render partial='nav' %>
Other stuff
<%= yield %>
</body>
</html>
<%- inside_layout 'base' do -%>
Section Titles
Other Stuff
<%= yield %>
<% end %>
Placeholder new page.
class SampleController < ApplicationController
layout :local
def new
# some setup code here but its not relevant to the view issues I'm having
end
end
def test_new_renders_new_template
get :new
assert_template 'new'
end
This setup worked on Rails 2.1.2. I just upgraded to Rails 2.3.2 and this issue started occurring. My site does use the nested_layouts plugin which can be found here: http://github.com/amatsuda/nested_layouts/tree/master
That plugin implements that inside_layout method I call inside my local layout.
This the test snippet I provided fails like this:
expecting <"new"> but rendering with <"shared/_header.rhtml">
It seems like assert_layout is not taking a look at all the files rendered but just the first partial that was rendered or some variation on that. I've dug in to the @response object and I can't find any references to my app/views/sample/new.rhtml file. The only thing I could find was the contents of the new.rhtml file in a @cached_content_for_layout instance variable inside the @response object.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment