diff options
author | David Chelimsky <dchelimsky@gmail.com> | 2010-10-02 12:35:17 -0500 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-10-03 13:30:31 -0200 |
commit | f656796d05715174568536cfe119a3959a020f23 (patch) | |
tree | 4172a679622123335442ef51c9a62d57d3605301 /actionpack/test | |
parent | 49cc01002e82208596439bb94d04805b85b75d8d (diff) | |
download | rails-f656796d05715174568536cfe119a3959a020f23.tar.gz rails-f656796d05715174568536cfe119a3959a020f23.tar.bz2 rails-f656796d05715174568536cfe119a3959a020f23.zip |
Rename _assigns to view_assigns in AV::TC
- also add tests
- also deprecate _assigns
[#5751 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/template/test_case_test.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/actionpack/test/template/test_case_test.rb b/actionpack/test/template/test_case_test.rb index 8526db61cc..a745999622 100644 --- a/actionpack/test/template/test_case_test.rb +++ b/actionpack/test/template/test_case_test.rb @@ -116,6 +116,37 @@ module ActionView end end + class AssignsTest < ActionView::TestCase + setup do + ActiveSupport::Deprecation.stubs(:warn) + end + + test "_assigns delegates to user_defined_ivars" do + self.expects(:view_assigns) + _assigns + end + + test "_assigns is deprecated" do + ActiveSupport::Deprecation.expects(:warn) + _assigns + end + end + + class ViewAssignsTest < ActionView::TestCase + test "view_assigns returns a Hash of user defined ivars" do + @a = 'b' + @c = 'd' + assert_equal({:a => 'b', :c => 'd'}, view_assigns) + end + + test "view_assigns excludes internal ivars" do + INTERNAL_IVARS.each do |ivar| + assert defined?(ivar), "expected #{ivar} to be defined" + assert !view_assigns.keys.include?(ivar.sub('@','').to_sym), "expected #{ivar} to be excluded from view_assigns" + end + end + end + class HelperExposureTest < ActionView::TestCase helper(Module.new do def render_from_helper |