[rspec-users] Problems with redirect_to

David Chelimsky dchelimsky at gmail.com
Fri Feb 22 09:00:32 EST 2008


On Fri, Feb 22, 2008 at 7:50 AM, Maurício Linhares
<mauricio.linhares at gmail.com> wrote:
> 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?

Can you post the full backtrace?

script/spec ./spec/controllers/static_pages_controller_spec.rb -b

>
>  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
>  _______________________________________________
>  rspec-users mailing list
>  rspec-users at rubyforge.org
>  http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list