gitlabhq/spec/support/login.rb
Nihad Abbasov d62200cad4 clean-up code
* Remove trailing whitespace
  * Converts hard-tabs into two-space soft-tabs
  * Remove consecutive blank lines
2011-10-26 18:46:25 +05:00

31 lines
760 B
Ruby

module LoginMacros
def login_as role
@user = User.create(:email => "user#{User.count}@mail.com",
:name => "John Smith",
:password => "123456",
:password_confirmation => "123456",
:skype => 'user_skype')
if role == :admin
@user.admin = true
@user.save!
end
visit new_user_session_path
fill_in "Email", :with => @user.email
fill_in "Password", :with => "123456"
click_button "Sign in"
end
def login_with(user)
visit new_user_session_path
fill_in "Email", :with => user.email
fill_in "Password", :with => "123456"
click_button "Sign in"
end
def logout
click_link "Logout" rescue nil
end
end