#7 √ resolved
Luke Francl

weird error with should_be_restful and an empty template variable

Reported by Luke Francl | December 7th, 2007 @ 02:17 PM

I ran across a weird error while using should_be_restful with one of my controllers.

In the update test, I was getting a weird error like this:

test: on PUT to :update with {} should redirect to "account_children_path". (ChildrenControllerTest):

ArgumentError: interning empty string

method to_sym in controller_tests.rb at line 438

method instantiate_variables_from_assigns in controller_tests.rb at line 438

method each in controller_tests.rb at line 435

method instantiate_variables_from_assigns in controller_tests.rb at line 435

method __bind_1197054899_599172 in controller_tests.rb at line 386

method call in context.rb at line 98

method test: on PUT to :update with {} should redirect to "account_children_path". in context.rb at line 98

method run in default.rb at line 7

So I printed out the list of variables that instantiate_variables_from_assigns was working with and I got this:

["", "parent_name", "current_object", "child", "current_user", "view_paths", "parent_object", "save_succeeded"]

I have no idea how the empty string got in there, so I'm not sure if this is a problem with my code or if shoulda should skip the empty string. When I skip it (using: next if name.blank?) the test passes. And the code works fine if I test it manually.

Anyone else seen this problem?

Comments and changes to this ticket

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket