[rspec-users] should_redirect_to in advance - feels unnatural

Jay Levitt lists-rspec at shopwatch.org
Tue Nov 7 14:31:22 EST 2006

I can understand that it's easier for rspec to set up a mock in advance 
of the controller call.  But it makes it difficult to do something like:

context "The HarkController, given Louie the logged-in user" do
  setup do
    post :login, :username => 'louie', :password => 'atest'

  specify "should redirect Louie to the home page"...

  specify "should set Louie to be the current user"...


Instead, I have to break out the should-redirect into its own call, 
since the post is done at setup time, but that's not an appropriate 
place for a spec.

What's the right solution?

Jay Levitt

More information about the rspec-users mailing list