[rspec-users] Problems with redirect_to

Maurício Linhares mauricio.linhares at gmail.com
Fri Feb 22 08:50:49 EST 2008


Hello guys,

I have the following spec:

    describe 'With successful save' do

      it 'Should redirect to the new page' do
        do_post
        response.should be_redirect
        response.should redirect_to( :action => 'show', :id =>
@static_page.permalink ) ## this is the line 118
      end

    end

And when I try to run it it gives me the following error:

1)
ActionController::MethodNotAllowed in 'StaticPagesController Handling
POST /pages With successful save Should redirect to the new page'
Only get, put, and delete requests are allowed.
./spec/controllers/static_pages_controller_spec.rb:118:
script/spec:4:

So, the response is a redirect (the "response.should be_redirect"
passes) but when i try to be sure that it redirected to the right page
it throws this weird error to me. Any ideas about what I've done
wrong?

I'm using RSpec 1.1.3 and Rails 2.0.2.

-- 
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) |
http://codeshooter.wordpress.com/ (en)
João Pessoa, PB, +55 83 8867-7208


More information about the rspec-users mailing list