Skip to content

Commit

Permalink
Added test case to specify that _assigns returns a Hash in AV::TC
Browse files Browse the repository at this point in the history
[rails#5751 state:resolved]
  • Loading branch information
dchelimsky committed Oct 2, 2010
1 parent f9b5f63 commit 5c73e4c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 1 addition & 3 deletions actionpack/lib/action_view/test_case.rb
Expand Up @@ -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

Expand Down
8 changes: 8 additions & 0 deletions actionpack/test/template/test_case_test.rb
Expand Up @@ -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
Expand Down

0 comments on commit 5c73e4c

Please sign in to comment.