diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-10-11 05:40:53 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-10-11 05:40:53 -0700 |
commit | 888a7a5bdc10bf5e2aceaad1cd40979a2388e4c0 (patch) | |
tree | 45e598b462d05a71b6a0e85c25a4608946462a58 /actionpack/lib/action_controller | |
parent | eec8924277a481b8d703913b688bc65ffcbad707 (diff) | |
parent | d6524d78687b39c72e0814e61b80e3e6b6d9997e (diff) | |
download | rails-888a7a5bdc10bf5e2aceaad1cd40979a2388e4c0.tar.gz rails-888a7a5bdc10bf5e2aceaad1cd40979a2388e4c0.tar.bz2 rails-888a7a5bdc10bf5e2aceaad1cd40979a2388e4c0.zip |
Merge pull request #7886 from senny/3675_assert_template_twice_against_same_partial
assert_template works when the same partial was rendered multiple times
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/test_case.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index ace5a2c822..d911d47a1d 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -123,11 +123,12 @@ module ActionController if expected_partial = options[:partial] if expected_locals = options[:locals] - if defined?(@locals) - actual_locals = @locals[expected_partial.to_s.sub(/^_/,'')] - expected_locals.each_pair do |k,v| - assert_equal(v, actual_locals[k]) - end + if defined?(@_rendered_views) + view = expected_partial.to_s.sub(/^_/,'') + msg = 'expecting %s to be rendered with %s but was with %s' % [expected_partial, + expected_locals, + @_rendered_views.locals_for(view)] + assert(@_rendered_views.view_rendered?(view, options[:locals]), msg) else warn "the :locals option to #assert_template is only supported in a ActionView::TestCase" end |