#22 √ committed
Marc-Andre Gagnon

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

  1. 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

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 »