Active Test Authentication plugin

Plugin details

Active Test Authentication gives you the ability to test that a controller's action requires a user to be logged in.

Websitehttp://www.mathewabonyi.com/articles/2006/11/19/two-activetest-plugins/ Repositoryhttp://mabs29.googlecode.com/svn/trunk/plugins/active_test_authentication Author Mathew Abonyi Tags Auth, Test LicenseUnknown

Documentation

Install the plugin:
ruby script/plugin install http://mabs29.googlecode.com/svn/trunk/plugins/active_test_authentication

It provides two behaviours (+requires_login_on+ and +accepts_login_on+), two helper methods (+login_as+ and +logout+), and two assertions (+assert_requires_login+ and +assert_accepts_login+).

It assumes the following:

* You are using some variant of Acts As Authenticated (AAA).
* You have a +users+ fixture.
* You are using a User model for your users.
* +@controller.current_user+ is set to a User object.
* +@controller.current_user+ is the proof of being logged in (as per AAA).

== Example

  class SomeControllerTest < ActiveTest::Controller

    setup
  
    def setup
      login_as :admin
    end
  
    requires_login_on :index
    accepts_login_on :index

  end

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | Back in time (2 older versions) | Last edited by: scott, 6 months ago