gitlab-org--gitlab-foss/features/steps/shared/user.rb

46 lines
996 B
Ruby
Raw Normal View History

module SharedUser
include Spinach::DSL
2014-02-07 11:59:55 -05:00
step 'User "John Doe" exists' do
user_exists("John Doe", { username: "john_doe" })
end
2014-02-07 11:59:55 -05:00
step 'User "Mary Jane" exists' do
user_exists("Mary Jane", { username: "mary_jane" })
2014-02-07 11:59:55 -05:00
end
step 'gitlab user "Mike"' do
create(:user, name: "Mike")
end
2014-02-07 11:59:55 -05:00
protected
def user_exists(name, options = {})
User.find_by(name: name) || create(:user, { name: name, admin: false }.merge(options))
end
step 'I have an ssh key' do
2015-12-09 12:09:00 -05:00
create(:personal_key, user: @user)
end
step 'I have no ssh keys' do
2015-12-09 12:09:00 -05:00
@user.keys.delete_all
end
2016-03-01 17:42:39 -05:00
step 'I click on "Personal projects" tab' do
page.within '.nav-links' do
click_link 'Personal projects'
end
expect(page).to have_css('.tab-content #projects.active')
end
step 'I click on "Contributed projects" tab' do
page.within '.nav-links' do
click_link 'Contributed projects'
end
expect(page).to have_css('.tab-content #contributed.active')
end
end