# Functional test with Authlogic

**URL:** <https://www.ruby-forum.com/t/functional-test-with-authlogic/179715>\
**Category:** Rails\
**Created:** [December 2, 2009, 3:02pm UTC](https://www.ruby-forum.com/t/functional-test-with-authlogic/179715 "2009-12-02T15:02:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![spitfire](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a5b964/32.png) [@spitfire](https://www.ruby-forum.com/u/spitfire)\
**Post date:** [December 2, 2009, 3:02pm UTC](https://www.ruby-forum.com/t/functional-test-with-authlogic/179715/1 "2009-12-02T15:02:08Z")

</div>

I am trying to make a simple functional test whith Authlogic.  
I followed this how to:  
[http://rdoc.info/rdoc/binarylogic/authlogic/blob/f2e95179acf87f11b44c7a58e6083cf84cddff27/Authlogic/TestCase.html](http://rdoc.info/rdoc/binarylogic/authlogic/blob/f2e95179acf87f11b44c7a58e6083cf84cddff27/Authlogic/TestCase.html)

but I have an error during “setup :activate\_authlogic”

This is my users\_controller\_test.rb:

test “should get index” do  
setup :activate\_authlogic # \<—error  
user = operators(:ale)  
UserSession.create(user)  
get :index  
assert\_response :success  
end

I have to login with authlogic (I am using it),  
then I added require “authlogic/test\_case” in test\_helper.rb:

ENV[“RAILS\_ENV”] = “test”  
require File.expand\_path(File.dirname( **FILE** ) +  
“/…/config/environment”)  
require “authlogic/test\_case” # \<—  
…

and then I added these lines in users\_controller\_test.rb :

setup :activate\_authlogic # \< — Error  
user = operators(:ale)  
UserSession.create(user)

When I run the test I get this error :

1. Error:  
test\_should\_get\_index(AlarmsControllerTest):  
ArgumentError: wrong number of arguments (1 for 0)

as if I have not inserted the require “authlogic/test\_case” in  
test\_helper.rb  
Someone can tell where is the bug ?

thank you,  
Alessandro
