aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-10-02 11:28:48 +0200
committerJosé Valim <jose.valim@gmail.com>2011-10-02 11:29:13 +0200
commit6e8fe1bf021139a2fbd06a10778ad2c6b67930ef (patch)
tree2f03dd143a8210bffaeb3bf400d43a284f31ed35 /actionpack/test
parent63f6da050acb1108a3f22c2bd393a8c2c05caeea (diff)
downloadrails-6e8fe1bf021139a2fbd06a10778ad2c6b67930ef.tar.gz
rails-6e8fe1bf021139a2fbd06a10778ad2c6b67930ef.tar.bz2
rails-6e8fe1bf021139a2fbd06a10778ad2c6b67930ef.zip
TestCase should respect the view_assigns API instead of pulling variables on its own.
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/test_test.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb
index cba3aded2f..ca87cda2a3 100644
--- a/actionpack/test/controller/test_test.rb
+++ b/actionpack/test/controller/test_test.rb
@@ -146,6 +146,17 @@ XML
end
end
+ class ViewAssignsController < ActionController::Base
+ def test_assigns
+ @foo = "foo"
+ render :nothing => true
+ end
+
+ def view_assigns
+ { "bar" => "bar" }
+ end
+ end
+
def test_raw_post_handling
params = ActiveSupport::OrderedHash[:page, {:name => 'page name'}, 'some key', 123]
post :render_raw_post, params.dup
@@ -256,6 +267,15 @@ XML
assert_equal "foo", assigns["foo"]
end
+ def test_view_assigns
+ @controller = ViewAssignsController.new
+ process :test_assigns
+ assert_equal nil, assigns(:foo)
+ assert_equal nil, assigns[:foo]
+ assert_equal "bar", assigns(:bar)
+ assert_equal "bar", assigns[:bar]
+ end
+
def test_assert_tag_tag
process :test_html_output