ActiveTest Authorisation plugin

Plugin details

The ActiveTest Authorisation is an example, but fully functional, plugin for the ActiveTest::Controller subject. It gives you the ability to test that a controller's action requires a user to have the correct permissions to access it.

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

Documentation

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

It provides two behaviours (+requires_permission_on+ and +accepts_permission_on+) and two assertions (+assert_requires_permission+ and +assert_accepts_permission+).

It assumes the following:

* You are using some variant of Simple Access Control or acl_system2.
* You have +login_as+ and +logout+ methods for logging users in and out (e.g. ActiveTest Authentication)
* You are probably using ActiveTest Authentication as well.

== Example

  class SomeControllerTest < ActiveTest::Controller

    setup
  
    def setup
      login_as :admin
    end
  
    requires_permission_on :index, :login_as => :unprivileged
    accepts_permission_on :index

  end

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: hardway, 6 months ago