is it ok if i define my login_as in test_helper.rb ???

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??

In test_helper.rb you usually put all the global methods and data required, so it looks typically fine to me.

Kristian Hellquist

thank u so much kristian :slight_smile: :slight_smile: i ve been trying to figure this out from a long time..thanks :slight_smile: