[rspec-users] should_redirect_to in rspec-0.8.0 / rspec_on_rails 1453

s.ross cwdinfo at gmail.com
Thu Feb 1 14:23:09 EST 2007

I have a spec:

   specify "a post with no user id should add a record" do
     post :edit_or_create, :user => {:login => 'joeschmoe', :email =>  
'joe at shmoe.com', :email_confirmation => 'joe at shmoe.com', :full_name  
=> 'Joe Schmoe'}
     flash[:notice].should_match(/user added/)
     puts "redirecting to #{response.redirect_url}"
     puts "this response was #{response.redirect?}"
     controller.should_redirect_to 'http://test.host/user'

the puts statements output the following:

redirecting to http://test.host/user
this response was true

Any idea why this line:

controller.should_redirect_to 'http://test.host/user'

would fail with the message:

'Given a UserController edit a post with no user id should add a  
record' FAILED
controller expected call to redirect_to "http://test.host/user" but  
it was never received

More information about the rspec-users mailing list