diff options
author | José Valim <jose.valim@gmail.com> | 2012-05-04 12:39:51 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2012-05-04 12:39:51 -0700 |
commit | 2919fd8980dd753a72c4121c77768470e4aafd6b (patch) | |
tree | 26ab14ac12a5516c8663bec767d5f6a93ce95ea2 /actionpack/test/controller/action_pack_assertions_test.rb | |
parent | 9ce057d8ccc799eb4844494e3c6ee553969a66d3 (diff) | |
parent | 0d19a081ee12b46791d8709e5c0898429e2ef91f (diff) | |
download | rails-2919fd8980dd753a72c4121c77768470e4aafd6b.tar.gz rails-2919fd8980dd753a72c4121c77768470e4aafd6b.tar.bz2 rails-2919fd8980dd753a72c4121c77768470e4aafd6b.zip |
Merge pull request #5808 from avakhov/assert-template-layout-improve
Assert template layout improve
Diffstat (limited to 'actionpack/test/controller/action_pack_assertions_test.rb')
-rw-r--r-- | actionpack/test/controller/action_pack_assertions_test.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb index f5f397c9c0..9b0d4d0f4c 100644 --- a/actionpack/test/controller/action_pack_assertions_test.rb +++ b/actionpack/test/controller/action_pack_assertions_test.rb @@ -76,6 +76,11 @@ class ActionPackAssertionsController < ActionController::Base 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" @@ -473,11 +478,43 @@ class AssertTemplateTest < ActionController::TestCase end end + def test_fails_expecting_no_layout + get :render_with_layout + assert_raise(ActiveSupport::TestCase::Assertion) do + assert_template :layout => nil + end + end + def test_passes_with_correct_layout get :render_with_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_passed_with_no_layout + get :hello_world + assert_template :layout => nil + end + + def test_passed_with_no_layout_false + get :hello_world + assert_template :layout => false + end + + def test_passes_with_correct_layout_without_layouts_prefix + get :render_with_layout + assert_template :layout => "standard" + end + + def test_passes_with_correct_layout_symbol + get :render_with_layout + assert_template :layout => :standard + end + def test_assert_template_reset_between_requests get :hello_world assert_template 'test/hello_world' |