aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/action_pack_assertions_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2013-03-24 13:19:20 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2013-03-24 13:19:20 -0700
commitdbd26e92a7b943a57c2826a749ae25e3ce9e143c (patch)
treee450d94452a4d59fd3cd112a9c414cbea9014175 /actionpack/test/controller/action_pack_assertions_test.rb
parent029dd435e4e13eb4c9490fc0d65f5f976bdffa0a (diff)
parent74e59ea8b674fac08a6ea4da03e58e29fc57a709 (diff)
downloadrails-dbd26e92a7b943a57c2826a749ae25e3ce9e143c.tar.gz
rails-dbd26e92a7b943a57c2826a749ae25e3ce9e143c.tar.bz2
rails-dbd26e92a7b943a57c2826a749ae25e3ce9e143c.zip
Merge pull request #9899 from macksmind/backport_5808
Backport #5808
Diffstat (limited to 'actionpack/test/controller/action_pack_assertions_test.rb')
-rw-r--r--actionpack/test/controller/action_pack_assertions_test.rb37
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 5252e43c25..3b5a515e84 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"
@@ -483,11 +488,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'