aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorAlexey Vakhov <vakhov@gmail.com>2012-04-11 12:45:28 +0600
committerAlexey Vakhov <vakhov@gmail.com>2012-05-04 23:31:09 +0400
commit0d19a081ee12b46791d8709e5c0898429e2ef91f (patch)
tree26ab14ac12a5516c8663bec767d5f6a93ce95ea2 /actionpack/lib/action_controller
parent4bd05a7bdc5003c9ebb090dcb0dc4949e4fb8ad3 (diff)
downloadrails-0d19a081ee12b46791d8709e5c0898429e2ef91f.tar.gz
rails-0d19a081ee12b46791d8709e5c0898429e2ef91f.tar.bz2
rails-0d19a081ee12b46791d8709e5c0898429e2ef91f.zip
Improve assert_template layout checking
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/test_case.rb18
1 files changed, 15 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index f664da4ffe..ad02375f12 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -22,6 +22,9 @@ module ActionController
path = payload[:layout]
if path
@layouts[path] += 1
+ if path =~ /^layouts\/(.*)/
+ @layouts[$1] += 1
+ end
end
end
@@ -61,6 +64,15 @@ module ActionController
# # assert that the exact template "admin/posts/new" was rendered
# assert_template %r{\Aadmin/posts/new\Z}
#
+ # # assert that the layout 'admin' was rendered
+ # assert_template :layout => 'admin'
+ # assert_template :layout => 'layouts/admin'
+ # assert_template :layout => :admin
+ #
+ # # assert that no layout was rendered
+ # assert_template :layout => nil
+ # assert_template :layout => false
+ #
# # assert that the "_customer" partial was rendered twice
# assert_template :partial => '_customer', :count => 2
#
@@ -98,11 +110,11 @@ module ActionController
expected_layout, @layouts.keys)
case expected_layout
- when String
- assert_includes @layouts.keys, expected_layout, msg
+ when String, Symbol
+ assert_includes @layouts.keys, expected_layout.to_s, msg
when Regexp
assert(@layouts.keys.any? {|l| l =~ expected_layout }, msg)
- when nil
+ when nil, false
assert(@layouts.empty?, msg)
end
end