dashboard.rb 2.4 KB
Newer Older
1
class Dashboard < Spinach::FeatureSteps
Nihad Abbasov's avatar
Nihad Abbasov committed
2
3
  include SharedAuthentication
  include SharedPaths
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
4
  include SharedProject
Nihad Abbasov's avatar
Nihad Abbasov committed
5

6
7
8
9
10
11
12
13
14
  Then 'I should see "New Project" link' do
    page.should have_link "New Project"
  end

  Then 'I should see "Shop" project link' do
    page.should have_link "Shop"
  end

  Then 'I should see last push widget' do
15
    page.should have_content "You pushed to new_design"
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    page.should have_link "Create Merge Request"
  end

  And 'I click "Create Merge Request" link' do
    click_link "Create Merge Request"
  end

  Then 'I see prefilled new Merge Request page' do
    current_path.should == new_project_merge_request_path(@project)
    find("#merge_request_source_branch").value.should == "new_design"
    find("#merge_request_target_branch").value.should == "master"
    find("#merge_request_title").value.should == "New Design"
  end

  Given 'user with name "John Doe" joined project "Shop"' do
31
    user = create(:user, {name: "John Doe"})
32
33
34
35
    project = Project.find_by_name "Shop"
    Event.create(
      project: project,
      author_id: user.id,
36
      action: Event::JOINED
37
38
39
    )
  end

Nihad Abbasov's avatar
Nihad Abbasov committed
40
41
  Then 'I should see "John Doe joined project at Shop" event' do
    page.should have_content "John Doe joined project at Shop"
42
43
44
45
46
47
48
49
  end

  And 'user with name "John Doe" left project "Shop"' do
    user = User.find_by_name "John Doe"
    project = Project.find_by_name "Shop"
    Event.create(
      project: project,
      author_id: user.id,
50
      action: Event::LEFT
51
52
53
    )
  end

Nihad Abbasov's avatar
Nihad Abbasov committed
54
55
  Then 'I should see "John Doe left project at Shop" event' do
    page.should have_content "John Doe left project at Shop"
56
57
  end

randx's avatar
randx committed
58
  And 'I have group with projects' do
59
60
61
    @group   = create(:group)
    @project = create(:project, group: @group)
    @event   = create(:closed_issue_event, project: @project)
randx's avatar
randx committed
62

63
    @project.team << [current_user, :master]
randx's avatar
randx committed
64
65
  end

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

randx's avatar
randx committed
72
73
74
75
76
  Then 'I should see groups list' do
    Group.all.each do |group|
      page.should have_link group.name
    end
  end
Alex Denisov's avatar
Alex Denisov committed
77
78
79
80
81
82
83
84
85

  And 'group has a projects that does not belongs to me' do
    @forbidden_project1 = create(:project, group: @group)
    @forbidden_project2 = create(:project, group: @group)
  end

  Then 'I should see 1 project at group list' do
    page.find('span.last_activity/span').should have_content('1')
  end
86
end