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."
   end
end

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 "/"
  end
end

However the code does work manually testing with browser.

Thanks for any help,
Priit
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to