Reputation: 511
I would like to write some unit test with a logged user using Authlogic. To start right, I used some code hosted in http://github.com/binarylogic/authlogic_example. But I get an error after rake test, because of "test_helper.rb" and the following class:
class ActionController::TestCase
setup :activate_authlogic
end
Here is my error:
NameError: undefined local variable or method `activate_authlogic' for
I think this Authlogic example is mapped over Rails 2; maybe it's a little bit different on Rails 3. Is there an other example where I can take example about unit test?
Many thanks.
Upvotes: 3
Views: 2442
Reputation: 507
I don't realize where to put include Authlogic::TestCase
, so I put this after the requires in spec_helper.rb
and it worked. There is a better place for it?
Upvotes: 1
Reputation: 9118
As of Rails 3.1 and Authlogic 3.0.3, the only thing I've had to add to activate authlogic was
features/support/env.rb
Before do
activate_authlogic
end
Upvotes: 1
Reputation: 2267
Do you require 'authlogic/test_case'
and include Authlogic::TestCase
?
I had a similar issue (using rspec, though) and read through the code at http://github.com/trevmex/authlogic_rails3_example
Upvotes: 16