I have a spec for testing a controller as below
require 'spec_helper'
describe ProductsController do
setup :activate_authlogic
describe "user not logged in" do
it "should not GET index" do
get :index
response.should redirect_to(login_path)
end
end
describe "user logged in" do
before(:each) do
UserSession.create :username => "rohit", :password => "test123"
end
it "should GET index" do
get :index
response.should redirect_to(products_path)
end
end
end
I have also used this line in spec_helper.rb
require "authlogic/testcase"
The test for "user not logged in passes" but for "user logged in" fails with
'ProductsController user is logged in should GET index' FAILED
expected redirect to "/products", got no redirect