aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/test_case.rb
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-02-04 05:51:36 -0800
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-02-04 05:51:36 -0800
commit65113fd2c8d5bcee2fab60d28ccdb912ceaa4367 (patch)
tree917af7c7434d28e0efa626648708b16a7e4fb71c /actionpack/lib/action_controller/test_case.rb
parente16110c4b86e7ba5eb7d4accf8871e98122a10e5 (diff)
parentcce94e7232fdd53d5212d85b6f6ecc411baa0b16 (diff)
downloadrails-65113fd2c8d5bcee2fab60d28ccdb912ceaa4367.tar.gz
rails-65113fd2c8d5bcee2fab60d28ccdb912ceaa4367.tar.bz2
rails-65113fd2c8d5bcee2fab60d28ccdb912ceaa4367.zip
Merge pull request #8520 from senny/8516_assert_template_with_locals
Improved `assert_template` when matching :locals with partials
Diffstat (limited to 'actionpack/lib/action_controller/test_case.rb')
-rw-r--r--actionpack/lib/action_controller/test_case.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index 5ae5dd331a..bba1f1e201 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -126,7 +126,11 @@ module ActionController
if expected_partial = options[:partial]
if expected_locals = options[:locals]
if defined?(@_rendered_views)
- view = expected_partial.to_s.sub(/^_/,'')
+ view = expected_partial.to_s.sub(/^_/, '').sub(/\/_(?=[^\/]+\z)/, '/')
+
+ partial_was_not_rendered_msg = "expected %s to be rendered but it was not." % view
+ assert_includes @_rendered_views.rendered_views, view, partial_was_not_rendered_msg
+
msg = 'expecting %s to be rendered with %s but was with %s' % [expected_partial,
expected_locals,
@_rendered_views.locals_for(view)]