On 1/20/06, Lance Ball <[EMAIL PROTECTED]> wrote:
Bad form to follow up my own post, but I'll elaborate.
You don't necessarily have to use a symbol, you could use the "string_segment" string if you want, but all of the cool kids use symbols. :-)
I am not sure when the assigns hash changed to a method call, but the info in this doc seems to be outdated (http://manuals.rubyonrails.com/read/chapter/28#page233 ). If you look at the rails code, action_controller/test_process.rb has this method:
module Test
module Unit
class TestCase #:nodoc:
# ...
def assigns(key = nil)
if key.nil ?
@response.template.assigns
else
@response.template.assigns[key.to_s]
end
end
# ...
end
So it appears that the hash itself has moved into @response.template and that you're calling this method when you are testing for assignments in your controller tests.
Lance
I think you want this instead:
assert_equal "howdy", assigns(:string_segment)
Lance
Bad form to follow up my own post, but I'll elaborate.
You don't necessarily have to use a symbol, you could use the "string_segment" string if you want, but all of the cool kids use symbols. :-)
I am not sure when the assigns hash changed to a method call, but the info in this doc seems to be outdated (http://manuals.rubyonrails.com/read/chapter/28#page233 ). If you look at the rails code, action_controller/test_process.rb has this method:
module Test
module Unit
class TestCase #:nodoc:
# ...
def assigns(key = nil)
if key.nil ?
@response.template.assigns
else
@response.template.assigns[key.to_s]
end
end
# ...
end
So it appears that the hash itself has moved into @response.template and that you're calling this method when you are testing for assignments in your controller tests.
Lance
--
Lance Ball
http://lance.langwell-ball.com
_______________________________________________ engine-users mailing list [email protected] http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org
