Skip to content

Commit

Permalink
Fix assert_template assertion with :layout option
Browse files Browse the repository at this point in the history
  • Loading branch information
avakhov committed May 4, 2012
1 parent 9ce057d commit df36c5f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/test_case.rb
Expand Up @@ -120,7 +120,7 @@ def assert_template(options = {}, message = nil)
options[:partial], @partials.keys)
assert_includes @partials, expected_partial, msg
end
else
elsif options.key?(:partial)
assert @partials.empty?,
"Expected no partials to be rendered"
end
Expand Down
10 changes: 10 additions & 0 deletions actionpack/test/controller/action_pack_assertions_test.rb
Expand Up @@ -76,6 +76,11 @@ def render_with_layout
render "test/hello_world", :layout => "layouts/standard"
end

def render_with_layout_and_partial
@variable_for_layout = nil
render "test/hello_world_with_partial", :layout => "layouts/standard"
end

def session_stuffing
session['xmas'] = 'turkey'
render :text => "ho ho ho"
Expand Down Expand Up @@ -478,6 +483,11 @@ def test_passes_with_correct_layout
assert_template :layout => "layouts/standard"
end

def test_passes_with_layout_and_partial
get :render_with_layout_and_partial
assert_template :layout => "layouts/standard"
end

def test_assert_template_reset_between_requests
get :hello_world
assert_template 'test/hello_world'
Expand Down
@@ -0,0 +1,2 @@
Hello world!
<%= render '/test/partial' %>

0 comments on commit df36c5f

Please sign in to comment.