is it ok if i define my login_as in test_helper.rb ??? def login_as(admin) @request.session[:admins] = admin ? admins(admin).id : nil end and then use login_as:sanj in my functional tests..it does not show any errors...but is it logically correct?? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Kristian Hellquist
2009-Dec-05 08:52 UTC
Re: is it ok if i define my login_as in test_helper.rb ???
In test_helper.rb you usually put all the global methods and data required, so it looks typically fine to me. Kristian Hellquist 2009/12/5 sanjanad <d_sanjana7-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>:> > > is it ok if i define my login_as in test_helper.rb ??? > > def login_as(admin) > @request.session[:admins] = admin ? admins(admin).id : nil > end > > and then use login_as:sanj > > in my functional tests..it does not show any errors...but is it > logically correct?? > > -- > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
thank u so much kristian :) :) i ve been trying to figure this out from a long time..thanks :) On Dec 5, 12:52 am, Kristian Hellquist <kristian.hellqu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> In test_helper.rb you usually put all the global methods and data > required, so it looks typically fine to me. > > Kristian Hellquist > > 09/12/5 sanjanad <d_sanja...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>: > > > > > is it ok if i define my login_as in test_helper.rb ??? > > > def login_as(admin) > > @request.session[:admins] = admin ? admins(admin).id : nil > > end > > > and then use login_as:sanj > > > in my functional tests..it does not show any errors...but is it > > logically correct?? > > > -- > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.