Undefined `setup 'method for main: Object when trying to run controller tests using authlogic

I'm a little new to RSpec tests, and I'm trying to run some controller tests in my Rails 3 application using RSpec 2 and Authlogic 3 authentication.

Following the instructions provided by the Authlogic documentation ( http://rdoc.info/github/binarylogic/authlogic/master/Authlogic/TestCase ), I received the following codes in my files:

spec_helper.rb

require "authlogic/test_case" # include at the top of test_helper.rb  

events_controller_spec.rb

require 'spec_helper'  
setup :activate_authlogic  

Running tests through rake spec SPEC='spec/controllers/eventos_controller_spec.rb'I received the following error:

events_controller_spec.rb:2: undefined method `setup' for main:Object (NoMethodError)

When I ran the tests before using authlogic, I had no problems.

I am using Ubuntu 11.04 and this configuration:

ruby - 1.8.7  
rails - 3.0.7  
authlogic - 3.0.2  
rspec-rails - 2.4.1  
factory_girl_rails - 1.0.1
+3
source share
1

undefined, Test:: Unit. :

Test:: Unit:: TestCase, , ruby, . , Authlogic:: TestCase .

RSpec, Authlogic:: TestCase activate_authlogic :

require 'spec_helper'

describe EventsController do
  include Authlogic::TestCase

  before(:each) do
    activate_authlogic
  end
end
+1

All Articles