BigW Consortium Gitlab

user.rb 383 Bytes
Newer Older
1 2 3
module SharedUser
  include Spinach::DSL

4 5
  step 'User "John Doe" exists' do
    user_exists("John Doe", {username: "john_doe"})
6 7
  end

8 9 10 11 12 13 14 15
  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))
16 17
  end
end