Testing only for a redirect

Hello guys,

Quick question: How could I just test if a redirect was made, without
URL
whatsoever?

Thanks,

Marcelo.

On Fri, Jun 25, 2010 at 1:56 PM, Marcelo de Moraes S.
[email protected] wrote:

Hello guys,

Quick question: How could I just test if a redirect was made, without URL
whatsoever?

In rspec-1/rails-2:

response.should be_redirect

This is not in rspec-rails-2 yet, so you can just go with the rails
assertion for now:

assert_response :redirect

HTH,
David

Thanks David! :slight_smile:

Marcelo.

On Jun 25, 2010, at 4:00 PM, Marcelo de Moraes S. wrote:

response.should be_redirect

This is not in rspec-rails-2 yet, so you can just go with the rails
assertion for now:

assert_response :redirect

Thanks David! :slight_smile:

Sure.

FYI - looks like you can use be_redirect in rspec-rails-2 because the
TestResponse object responds to redirect?(). Give it a shot:

response.should be_redirect

Work?

I meant rspec1.x :slight_smile:

On Fri, Jun 25, 2010 at 6:15 PM, Marcelo de Moraes S. <

I’m still on the Rails 2 era… so, it worked like a charm with
response.should be_redirect.

Thanks,

Marcelo.