Modify should_assign_to to accept array of params
Reported by Marc-Andre Gagnon | February 29th, 2008 @ 09:00 AM
I think should_assign_to should be modified to accept an array. That way I can use
should_assign_to :var1, :var2, :var3
instead of ...
should_assign_to :var1
should_assign_to :var2
should_assign_to :var3
####
klass = ThoughtBot::Shoulda::Controller::ClassMethods
klass.module_eval do
- Overidde should_assign_to to allow an array of values
def should_assign_to(*args)
args.each {|name|
should "assign @#{name}" do
assert assigns(name.to_sym), "The action isn't assigning to @#{name}"
end
}
end
end
####
Thanks for your work, nice plugin
Comments and changes to this ticket
-
Ryan McGeary July 30th, 2008 @ 10:14 AM
- → State changed from new to needs-git-fork
- → Tag cleared.
- → Assigned user cleared.
This should be applied to
should_not_assign_toas well. -

Bob Showalter July 31st, 2008 @ 11:34 AM
Here's a branch that implements this, with test coverage and doc changes:
-
Ryan McGeary July 31st, 2008 @ 01:43 PM
- → State changed from needs-git-fork to committed
- → Assigned user changed from to Ryan McGeary
Bob, Thank you much!
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 »
