Creating Functional Tests for Restful Authencation based websites
At eSpace we stress on having automated tests to cover our code.
If you are using Restful Authentication plugin in your rails application, You will have to bypass the authentication filter that is processed before your controller actions.Restful authentication helps you does that through the login_as() method of theAuthenticatedTestHelper module. Let me show you how.
In your functional test, login before you send the request.
class PublicationsControllerTest < ActionController::TestCase
Your test code...
That user is loaded from the users fixtures and will act as the current logged in user. The fixtures must have something like:
crypted_password: 00742970dc9e6319f8019fd54864d3ea740f04b1 # test
The login_as method is defined in the AuthenticatedTestHelper module, so you need to make sure you are including that module (preferably in the test helper)
Now you can create functional tests for controllers that requires login.