2014-01-27 09:53:59 -05:00
|
|
|
module SharedUser
|
|
|
|
include Spinach::DSL
|
|
|
|
|
2014-02-07 11:59:55 -05:00
|
|
|
step 'User "John Doe" exists' do
|
2015-06-22 08:21:34 -04:00
|
|
|
user_exists("John Doe", { username: "john_doe" })
|
2014-01-27 09:53:59 -05:00
|
|
|
end
|
|
|
|
|
2014-02-07 11:59:55 -05:00
|
|
|
step 'User "Mary Jane" exists' do
|
2015-06-22 08:21:34 -04:00
|
|
|
user_exists("Mary Jane", { username: "mary_jane" })
|
2014-02-07 11:59:55 -05:00
|
|
|
end
|
|
|
|
|
2015-11-25 05:44:39 -05:00
|
|
|
step 'gitlab user "Mike"' do
|
|
|
|
create(:user, name: "Mike")
|
|
|
|
end
|
|
|
|
|
2014-02-07 11:59:55 -05:00
|
|
|
protected
|
|
|
|
|
|
|
|
def user_exists(name, options = {})
|
2015-06-22 08:21:34 -04:00
|
|
|
User.find_by(name: name) || create(:user, { name: name, admin: false }.merge(options))
|
2014-01-27 09:53:59 -05:00
|
|
|
end
|
2015-12-08 20:02:53 -05:00
|
|
|
|
|
|
|
step 'I have an ssh key' do
|
2015-12-09 12:09:00 -05:00
|
|
|
create(:personal_key, user: @user)
|
2015-12-08 20:02:53 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I have no ssh keys' do
|
2015-12-09 12:09:00 -05:00
|
|
|
@user.keys.delete_all
|
2015-12-08 20:02:53 -05:00
|
|
|
end
|
2014-01-27 09:53:59 -05:00
|
|
|
end
|