Posts

Showing posts with the label restful authentication

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 the AuthenticatedTestHelper module. Let me show you how. In your functional test, login before you send the request.    class PublicationsControllerTest        fixtures :users        def test_method           login_as (:user_one)           Your test code...        end    end That user is loaded from the users fixtures and will act as the current logged in user. The fixtures must have something like: user_one:     id: 1     login...