[rspec-users] Order of the get call and xxx.should

Chris Olsen lists at ruby-forum.com
Wed Jan 30 15:54:11 EST 2008

Just out of curiosity, why is that the following .should calls have to
differ to work?

The first is a normal check on the if the user is redirected if not
logged in
it "should redirect the user to the login screen" do
    response.should redirect_to(new_session_url)

The second is checking to ensure that the proper user validation method
is called
it "should validate the user" do

**Note: These are specs from different describe blocks run under
different authorize conditions.

Here is the do_get
def do_get
    get :index, {:account_id => 1}

Notice the difference to where the do_get method is called.  I had an
error and it was due to the order not being as is shown above.  In the
docs it shows the actual request to be made before the assertion
statement, but that doesn't work in the second example.

Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list