Thursday, May 12, 2011

Sets the current user in the session from the user fixtures while testing

Create a new module file named authenticated_test_helper in libs folder of your rails application. Copy the contents from here "http://svn.topfunky.com/podcast/lib/authenticated_test_helper.rb" to this file.
This file Sets the current user in the session from the user fixtures.

You can set the current user like below in your test cases


user = operators(:username)
UserSession.create(user)

No comments:

Post a Comment