Setting Session Variables in Integration Tests

All I want to do is set a session variable when I make a request. Here's my code:

class ProjectIntegrationTest < ActionController::IntegrationTest def test_truth    user = user_for_test    user.access_project_index_page end

def user_for_test    open_session do |thing|      def user.access_project_index_page

Actually it is the above line that is raising the exception - there is
no user variable / method in scope here. This code lois pretty strange - are you really trying to define
singleton methods on users?

Fred

I'm pretty new to integration testing and I'm not sure how to define tests. I saw an example of someone doing it this way, so that's the way I formed mine. What is the best way to write a normal test that allows me to set the "user_id" session variable so that the "get" can successfully happen?

-Kyle

Frederick Cheung wrote: