FooBarWidget/authlogic_rails3_rspec2_test — pull request #2 by ndbroadbent (2012-01-17 18:23:03+00:00)
Title: Fixed specs :)

Automatic session maintenance is a [feature of Authlogic](http://rubydoc.info/github/binarylogic/authlogic/master/Authlogic/ActsAsAuthentic/SessionMaintenance/Config#maintain_sessions-instance_method)

You can turn off the 'automatic login after create' with: `c.maintain_sessions = false`

This is mentioned in the [Authlogic README](https://github.com/binarylogic/authlogic/blob/master/README.rdoc)
(Ctrl+F -> "will automatically log a user in after a successful registration")

'activate_authlogic' is required in the actual controller spec. It doesn't work from the 'RSpec.configure' block because the @request hasn't been defined before it runs. See `authlogic-3.1.0/lib/authlogic/test_case.rb:102`.

To answer the second part of your question, you should use an Authentication controller, and only test `activate_authlogic` there.
For your other controllers, you should mock the Session with a 'require_user' method.

[Here are the authlogic macros that we use in our specs](https://github.com/fatfreecrm/fat_free_crm/blob/master/spec/support/auth_macros.rb).