mirror of https://github.com/rails/rails
Fix assert_template assertion with :layout option
This commit is contained in:
parent
9ce057d8cc
commit
df36c5f7ff
|
@ -120,7 +120,7 @@ module ActionController
|
||||||
options[:partial], @partials.keys)
|
options[:partial], @partials.keys)
|
||||||
assert_includes @partials, expected_partial, msg
|
assert_includes @partials, expected_partial, msg
|
||||||
end
|
end
|
||||||
else
|
elsif options.key?(:partial)
|
||||||
assert @partials.empty?,
|
assert @partials.empty?,
|
||||||
"Expected no partials to be rendered"
|
"Expected no partials to be rendered"
|
||||||
end
|
end
|
||||||
|
|
|
@ -76,6 +76,11 @@ class ActionPackAssertionsController < ActionController::Base
|
||||||
render "test/hello_world", :layout => "layouts/standard"
|
render "test/hello_world", :layout => "layouts/standard"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def render_with_layout_and_partial
|
||||||
|
@variable_for_layout = nil
|
||||||
|
render "test/hello_world_with_partial", :layout => "layouts/standard"
|
||||||
|
end
|
||||||
|
|
||||||
def session_stuffing
|
def session_stuffing
|
||||||
session['xmas'] = 'turkey'
|
session['xmas'] = 'turkey'
|
||||||
render :text => "ho ho ho"
|
render :text => "ho ho ho"
|
||||||
|
@ -478,6 +483,11 @@ class AssertTemplateTest < ActionController::TestCase
|
||||||
assert_template :layout => "layouts/standard"
|
assert_template :layout => "layouts/standard"
|
||||||
end
|
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
|
def test_assert_template_reset_between_requests
|
||||||
get :hello_world
|
get :hello_world
|
||||||
assert_template 'test/hello_world'
|
assert_template 'test/hello_world'
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Hello world!
|
||||||
|
<%= render '/test/partial' %>
|
Loading…
Reference in New Issue