debian-mirror-gitlab/features/steps/shared/user.rb

18 lines
383 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
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