BigW Consortium Gitlab

dashboard.rb 2.63 KB
Newer Older
1
class Spinach::Features::Dashboard < Spinach::FeatureSteps
Nihad Abbasov committed
2 3
  include SharedAuthentication
  include SharedPaths
4
  include SharedProject
5
  include SharedIssuable
Nihad Abbasov committed
6

7
  step 'I should see "New Project" link' do
8
    expect(page).to have_link "New project"
9 10
  end

11
  step 'I should see "Shop" project link' do
12
    expect(page).to have_link "Shop"
13 14
  end

15
  step 'I should see "Shop" project CI status' do
16
    expect(page).to have_link "Build skipped"
17 18
  end

19
  step 'I should see last push widget' do
20 21
    expect(page).to have_content "You pushed to fix"
    expect(page).to have_link "Create Merge Request"
22 23
  end

24
  step 'I click "Create Merge Request" link' do
25 26 27
    click_link "Create Merge Request"
  end

28
  step 'I see prefilled new Merge Request page' do
29 30 31 32
    expect(current_path).to eq new_namespace_project_merge_request_path(@project.namespace, @project)
    expect(find("#merge_request_target_project_id").value).to eq @project.id.to_s
    expect(find("input#merge_request_source_branch").value).to eq "fix"
    expect(find("input#merge_request_target_branch").value).to eq "master"
33 34
  end

35
  step 'user with name "John Doe" joined project "Shop"' do
36
    user = create(:user, { name: "John Doe" })
Dmitriy Zaporozhets committed
37
    project.team << [user, :master]
38 39 40
    Event.create(
      project: project,
      author_id: user.id,
41
      action: Event::JOINED
42 43 44
    )
  end

Douwe Maan committed
45
  step 'I should see "John Doe joined project Shop" event' do
46
    expect(page).to have_content "John Doe joined project #{project.name_with_namespace}"
47 48
  end

49
  step 'user with name "John Doe" left project "Shop"' do
skv committed
50
    user = User.find_by(name: "John Doe")
51 52 53
    Event.create(
      project: project,
      author_id: user.id,
54
      action: Event::LEFT
55 56 57
    )
  end

Douwe Maan committed
58
  step 'I should see "John Doe left project Shop" event' do
59
    expect(page).to have_content "John Doe left project #{project.name_with_namespace}"
60 61
  end

62
  step 'I have group with projects' do
63
    @group   = create(:group)
64
    @project = create(:project, namespace: @group)
65
    @event   = create(:closed_issue_event, project: @project)
randx committed
66

67
    @project.team << [current_user, :master]
randx committed
68 69
  end

70
  step 'I should see projects list' do
Dmitriy Zaporozhets committed
71
    @user.authorized_projects.all.each do |project|
72
      expect(page).to have_link project.name_with_namespace
Dmitriy Zaporozhets committed
73 74 75
    end
  end

76
  step 'I should see groups list' do
randx committed
77
    Group.all.each do |group|
78
      expect(page).to have_link group.name
randx committed
79 80
    end
  end
Alex Denisov committed
81

82
  step 'group has a projects that does not belongs to me' do
Alex Denisov committed
83 84 85 86
    @forbidden_project1 = create(:project, group: @group)
    @forbidden_project2 = create(:project, group: @group)
  end

87
  step 'I should see 1 project at group list' do
88
    expect(find('span.last_activity/span')).to have_content('1')
Alex Denisov committed
89
  end
90
end