[rspec-users] nuby: how spec redirect_to at ApplicationController

Priit Tamboom priit.tamboom at gmail.com
Wed Aug 15 15:14:18 EDT 2007

Good morning rspec people!

Still rspec nuby: I must do something wrong obviously.

How can I spec about redirect_to at ApplicationController

describe ApplicationController do
   it "method login_required should redirect to home path without login" do
     pending "I tried to use controller.login_required.should be_redirected
        and got NoMethodError with nil object didn't expect error."

class ApplicationController < ActionController::Base
  # using it with before_filter
  def login_required
     # I took out everything except redirecting to make the point simple
     redirect_to home_path  # tried also redirect_to "/"

However the code does work manually testing with browser.

Thanks for any help,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070816/9f4d994e/attachment.html 

More information about the rspec-users mailing list