diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-10-06 12:45:03 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-10-06 12:45:03 -0700 |
commit | bcbf1bbba439346b9b16e9b3dbc417d4e3abb717 (patch) | |
tree | 3949860cfea9eecc9260ee4d0a1c28451e422eb7 /actionpack/lib/action_controller | |
parent | 05e9258164658b1fd948311e9d075f5d7a60cbdb (diff) | |
parent | af677da84c6ec6140f7e89ff64ce30e50de325a0 (diff) | |
download | rails-bcbf1bbba439346b9b16e9b3dbc417d4e3abb717.tar.gz rails-bcbf1bbba439346b9b16e9b3dbc417d4e3abb717.tar.bz2 rails-bcbf1bbba439346b9b16e9b3dbc417d4e3abb717.zip |
Merge pull request #7848 from senny/3415_assert_template_has_nil_variable
can't pass :locals to #assert_template without a view test case (#3415)
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/test_case.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 3af378173a..ace5a2c822 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -123,9 +123,13 @@ module ActionController if expected_partial = options[:partial] if expected_locals = options[:locals] - actual_locals = @locals[expected_partial.to_s.sub(/^_/,'')] - expected_locals.each_pair do |k,v| - assert_equal(v, actual_locals[k]) + 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 + else + warn "the :locals option to #assert_template is only supported in a ActionView::TestCase" end elsif expected_count = options[:count] actual_count = @_partials[expected_partial] |