Hi,
I was writing functional tests for the application. Since, most of the pages
require a login, the login_as method is being used to fake the login [1].
The application makes use of the RESTful Authentication plugin for
authentication.
However, since there are three types of users and each with different level
of access rights, I wanted the tests to be run for each type of users with
appropriate responses being expected and verified. Thus, requiring login and
logout every time the test is to be run for a particular user. However, once
login_as is used, I am not able to use login_as for some other user in the
test. [0] and users.yml at [3]. What I mean to say is the session persists
and I am not able to destroy it.
This is what I tried:
1. Simply try calling login_as again. This would over-write the session.
2. Do @request[session_id] = nil explicitly before trying a new user.
3. Call logout_killing_session [2]. But this throws a no method error for
'reset_session'
3.1 Tried including the Authentication, Authorization and Trustification
modules, but the issue still remains.
4. Made a logout method in authenticated_test_helper.rb which does
@request[session_id] = nil
If you know, please let me know how I could fix this.
[0]
http://pastie.org/1039110
[1]
http://github.com/reddragon/fsoc/blob/master/lib/authenticated_test_helpe...
[2]
http://github.com/reddragon/fsoc/blob/master/lib/authenticated_system.rb#...
[3]
http://pastie.org/1039122
Warm Regards,
--
Gaurav Menghani