How do I access the session object in a Rails performance test? -
I am writing some performance tests and I want to login the user:
Class companiesjst & lieutenant; ActionController :: PerformanceTest fixtures: All def setup login_as (: cyrille) end def test_homepage get '/' end end
The problem is: How should I apply login_as?
I tried:
Private Df login_as (user) @request = ActionController :: TestRequest.new @ request.session [: user] = Users? User (user) .id: zero end
but the session [: user] is blank when it is checked by the application.
Obviously there should be a session object created by PerformanceTest, but I can not see how I want to access it.
I will attempt to remove this line:
@request = ActionController :: TestRequest.new
PerformanceTest
is a sub-class unity test
such as @request
Must be defined already.
Comments
Post a Comment