summaryrefslogtreecommitdiff
path: root/features/steps/shared/user.rb
blob: 9cadc91769d19877499c7a6690962b065c99ef35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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

  step 'gitlab user "Mike"' do
    create(:user, name: "Mike")
  end

  protected

  def user_exists(name, options = {})
    User.find_by(name: name) || create(:user, { name: name, admin: false }.merge(options))
  end

  step 'I have no ssh keys' do
    @user.keys.delete_all
  end

  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