gitlab-org--gitlab-foss/features/steps/shared/user.rb
Dmitriy Zaporozhets f167f37e5a
Fix rubocop issues at feature/ directory
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-22 14:21:34 +02:00

17 lines
389 B
Ruby

module SharedUser
include Spinach::DSL
step 'User "John Doe" exists' do
user_exists("John Doe", { username: "john_doe" })
end
step 'User "Mary Jane" exists' do
user_exists("Mary Jane", { username: "mary_jane" })
end
protected
def user_exists(name, options = {})
User.find_by(name: name) || create(:user, { name: name, admin: false }.merge(options))
end
end