On 7 May 2009, at 11:26, Kyle Peyton <rails-mailing-l...@andreas- 
s.net> wrote:

>
> 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
>
>        session[:user_id] = 'someid'
>        get project_index_path
>        assert_response :success
>      end
>    end
>  end
> end
>
> I'm getting this error:
>
> test_truth(ProjectIntegrationTest):
> NoMethodError: undefined method `user' for
> #<ActionController::Integration::Session:0x21d7c50>
> method method_missing in test_process.rb at line 464
> method send! in integration.rb at line 448
> method method_missing in integration.rb at line 448
> method user_for_test in project_integration_test.rb at line 11
>
> Line 11 is the line where "session[:user_id] = 'someid'" is being set.
> What am I doing wrong for setting the session?
>
> -Kyle
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to