Plugins - ActiveTest Authentication

StarAdd to favorites

ActiveTest Authentication

Description

The ActiveTest Authentication 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 be logged in.

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

mabs29

http://www.mathewabonyi.com/articles/2006/11/19/two-activetest-plugins/

http://mabs29.googlecode.com/svn/trunk/plugins/active_test_authentication

Rails' (MIT)

  • Currently 3.0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Testing

Tags

Comments

Add a comment

Search Plugins

Query syntax

Plugins by Category

Sponsors

Rails Kits: Get Code. Get Moving.

Have a comment?