Hello guys, Quick question: How could I just test if a redirect was made, without URL whatsoever? Thanks, Marcelo. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100625/6bc5fc47/attachment.html>
On Fri, Jun 25, 2010 at 1:56 PM, Marcelo de Moraes Serpa <celoserpa at gmail.com> 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! :) Marcelo. On Fri, Jun 25, 2010 at 2:18 PM, David Chelimsky <dchelimsky at gmail.com>wrote:> On Fri, Jun 25, 2010 at 1:56 PM, Marcelo de Moraes Serpa > <celoserpa at gmail.com> 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 > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100625/b769997a/attachment.html>
On Jun 25, 2010, at 4:00 PM, Marcelo de Moraes Serpa wrote:> On Fri, Jun 25, 2010 at 2:18 PM, David Chelimsky <dchelimsky at gmail.com> wrote: > On Fri, Jun 25, 2010 at 1:56 PM, Marcelo de Moraes Serpa > <celoserpa at gmail.com> 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 >> Thanks David! :)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? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100625/be8aeaa5/attachment.html>
I''m still on the Rails 2 era.. so, it worked like a charm with response.should be_redirect. Thanks, Marcelo. On Fri, Jun 25, 2010 at 4:33 PM, David Chelimsky <dchelimsky at gmail.com>wrote:> > On Jun 25, 2010, at 4:00 PM, Marcelo de Moraes Serpa wrote: > > On Fri, Jun 25, 2010 at 2:18 PM, David Chelimsky <dchelimsky at gmail.com>wrote: > >> On Fri, Jun 25, 2010 at 1:56 PM, Marcelo de Moraes Serpa >> <celoserpa at gmail.com> 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 >> >> > Thanks David! :) > > > 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? > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100625/ae3f229c/attachment-0001.html>
I meant rspec1.x :) On Fri, Jun 25, 2010 at 6:15 PM, Marcelo de Moraes Serpa < celoserpa at gmail.com> wrote:> I''m still on the Rails 2 era.. so, it worked like a charm with > response.should be_redirect. > > Thanks, > > Marcelo. > > On Fri, Jun 25, 2010 at 4:33 PM, David Chelimsky <dchelimsky at gmail.com>wrote: > >> >> On Jun 25, 2010, at 4:00 PM, Marcelo de Moraes Serpa wrote: >> >> On Fri, Jun 25, 2010 at 2:18 PM, David Chelimsky <dchelimsky at gmail.com>wrote: >> >>> On Fri, Jun 25, 2010 at 1:56 PM, Marcelo de Moraes Serpa >>> <celoserpa at gmail.com> 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 >>> >>> >> Thanks David! :) >> >> >> 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? >> >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100625/d1ef845e/attachment.html>