[rspec-devel] [ rspec-Feature Requests-6511 ] controller.should_assign

noreply at rubyforge.org noreply at rubyforge.org
Sun Jan 28 23:20:49 EST 2007


Feature Requests item #6511, was opened at 2006-11-06 03:23
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=6511&group_id=797

Category: rails plugin
Group: None
>Status: Closed
Priority: 3
Submitted By: David Chelimsky (dchelimsky)
>Assigned to: David Chelimsky (dchelimsky)
Summary: controller.should_assign

Initial Comment:
(reopened 6502)

In 0.7, there are a number of expectations added to the controller designed to be expressed in advance of the action:

controller.should_redirect_to 'destination'
controller.should_render :template => 'blah'
etc

but to set expectations about assigns, we have to use this:

assigns[key].should_eql value

I'd like to add controller.should_assign. Here are a couple of syntax candidates:

controller.should_assign(value).to(:variable_name)
controller.should_assign(:variable_name).value(value)
controller.should_assign { @variable_name = value }

My personal favorite is the last one because you see @variable_name the same way you see it in your views, so there's
less context shifting. It also makes more clear which is the variable and which is the value.



----------------------------------------------------------------------

>Comment By: David Chelimsky (dchelimsky)
Date: 2007-01-29 04:20

Message:
Never mind.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=6511&group_id=797


More information about the rspec-devel mailing list