BigW Consortium Gitlab

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

6
  step 'I should see "New Project" link' do
7
    page.should have_link "New project"
8 9
  end

10
  step 'I should see "Shop" project link' do
11 12 13
    page.should have_link "Shop"
  end

14
  step 'I should see last push widget' do
15
    page.should have_content "You pushed to fix"
16 17 18
    page.should have_link "Create Merge Request"
  end

19
  step 'I click "Create Merge Request" link' do
20 21 22
    click_link "Create Merge Request"
  end

23
  step 'I see prefilled new Merge Request page' do
24
    current_path.should == new_project_merge_request_path(@project)
25
    find("#merge_request_target_project_id").value.should == @project.id.to_s
26
    find("#merge_request_source_branch").value.should == "fix"
27 28 29
    find("#merge_request_target_branch").value.should == "master"
  end

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

40
  step 'I should see "John Doe joined project at Shop" event' do
Dmitriy Zaporozhets committed
41
    page.should have_content "John Doe joined project at #{project.name_with_namespace}"
42 43
  end

44
  step 'user with name "John Doe" left project "Shop"' do
skv committed
45
    user = User.find_by(name: "John Doe")
46 47 48
    Event.create(
      project: project,
      author_id: user.id,
49
      action: Event::LEFT
50 51 52
    )
  end

53
  step 'I should see "John Doe left project at Shop" event' do
Dmitriy Zaporozhets committed
54
    page.should have_content "John Doe left project at #{project.name_with_namespace}"
55 56
  end

57
  step 'I have group with projects' do
58
    @group   = create(:group)
59
    @project = create(:project, namespace: @group)
60
    @event   = create(:closed_issue_event, project: @project)
randx committed
61

62
    @project.team << [current_user, :master]
randx committed
63 64
  end

65
  step 'I should see projects list' do
Dmitriy Zaporozhets committed
66 67 68 69 70
    @user.authorized_projects.all.each do |project|
      page.should have_link project.name_with_namespace
    end
  end

71
  step 'I should see groups list' do
randx committed
72 73 74 75
    Group.all.each do |group|
      page.should have_link group.name
    end
  end
Alex Denisov committed
76

77
  step 'group has a projects that does not belongs to me' do
Alex Denisov committed
78 79 80 81
    @forbidden_project1 = create(:project, group: @group)
    @forbidden_project2 = create(:project, group: @group)
  end

82
  step 'I should see 1 project at group list' do
83
    find('span.last_activity/span').should have_content('1')
Alex Denisov committed
84
  end
85
end