Permalink
Browse files

Added test case to specify that _assigns returns a Hash in AV::TC

[#5751 state:resolved]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
  • Loading branch information...
1 parent ebfbb2a commit 2380c71601e12bcedc849e99d7a4f4ef6151baf2 @dchelimsky dchelimsky committed with spastorino Oct 2, 2010
Showing with 9 additions and 3 deletions.
  1. +1 −3 actionpack/lib/action_view/test_case.rb
  2. +8 −0 actionpack/test/template/test_case_test.rb
View
4 actionpack/lib/action_view/test_case.rb
@@ -190,9 +190,7 @@ def _instance_variables
def _assigns
_instance_variables.inject({}) do |hash, var|
- name = var[1..-1].to_sym
- hash[name] = instance_variable_get(var)
- hash
+ hash.merge(var.sub('@','').to_sym => instance_variable_get(var))
end
end
View
8 actionpack/test/template/test_case_test.rb
@@ -116,6 +116,14 @@ def render_from_helper
end
end
+ class AssignsTest < ActionView::TestCase
+ test "_assigns returns a Hash of local ivars" do
+ @a = 'b'
+ @c = 'd'
+ assert_equal({:a => 'b', :c => 'd'}, _assigns)
+ end
+ end
+
class HelperExposureTest < ActionView::TestCase
helper(Module.new do
def render_from_helper

0 comments on commit 2380c71

Please sign in to comment.