[rspec-users] Newbie : How to spec params hash amendment

Elliot Winkler elliot.winkler at gmail.com
Mon Aug 2 09:52:54 EDT 2010

  On 7/30/10 5:53 AM, Martin Hawkins wrote:
> I have no idea how to approach 'rspec'ing the creation of the
> params[:user][:password] and :password_confirmation or the
> random_password method and would very much appreciate it if somebody
> could spare the time to suggest what I should be doing.
You could stub the random_password method with some value, then perform 
the create action, then confirm that the @user variable has that value 
for password and password_confirmation. (I forget if instance variables 
are accessible in a controller test even after a redirect, so I guess 
you'll find out.)

-- Elliot

More information about the rspec-users mailing list