BigW Consortium Gitlab

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

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

8
  step 'User "Mary Jane" exists' do
9
    user_exists("Mary Jane", { username: "mary_jane" })
10 11
  end

12 13 14 15
  step 'gitlab user "Mike"' do
    create(:user, name: "Mike")
  end

16 17 18
  protected

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

  step 'I have an ssh key' do
23
    create(:personal_key, user: @user)
24 25 26
  end

  step 'I have no ssh keys' do
27
    @user.keys.delete_all
28
  end
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44

  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
45
end