Methods

Files

UbiquoAuthentication::Extensions::TestCase

Public Instance Methods

login_as(ubiquo_user = nil) click to toggle source

This method allows functional test to simulate a ubiquo_user login by setting session value

If the attribute is a Symbol, the user is getted from fixture helper ubiquo_users(fixture_name). For example, if :one is passed, a fixture named with ‘one:’ will be used

If the attribute is a UbiquoUser, that user is used.

If the attribute is nil (or none setted) the ‘admin’ named fixture will be used

If the attribute is a number, this number will be used as a ubiquo_user_id, but don’t validates to be a valid id.

    # File vendor/plugins/ubiquo_authentication/lib/ubiquo_authentication/extensions/test_case.rb, line 14
14:       def login_as(ubiquo_user = nil)
15:         return nil if @request.nil?
16:         ubiquo_user = case ubiquo_user
17:                       when Symbol
18:                         ubiquo_users(ubiquo_user).id
19:                       when UbiquoUser
20:                         ubiquo_user.id
21:                       when nil
22:                         ubiquo_users(:admin).id
23:                       end
24:         @request.session[:ubiquo] ||= {}
25:         @request.session[:ubiquo][:ubiquo_user_id] = ubiquo_user
26:       end

Disabled; run with $DEBUG to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.