Commit 42abdf69d59ecf28688af5994ff2e324c50a6d33
1 parent
83dc5f93
Exists in
master
and in
4 other branches
More group tests with spinach
Showing
5 changed files
with
98 additions
and
4 deletions
Show diff stats
@@ -0,0 +1,10 @@ | @@ -0,0 +1,10 @@ | ||
1 | +Feature: Admin Groups | ||
2 | + Background: | ||
3 | + Given I sign in as an admin | ||
4 | + And I visit admin groups page | ||
5 | + | ||
6 | + Scenario: Create a group | ||
7 | + When I click new group link | ||
8 | + And submit form with new group info | ||
9 | + Then I should be redirected to group page | ||
10 | + And I should see newly created group |
features/group/group.feature
@@ -7,3 +7,13 @@ Feature: Groups | @@ -7,3 +7,13 @@ Feature: Groups | ||
7 | When I visit group page | 7 | When I visit group page |
8 | Then I should see projects list | 8 | Then I should see projects list |
9 | And I should see projects activity feed | 9 | And I should see projects activity feed |
10 | + | ||
11 | + Scenario: I should see group issues list | ||
12 | + Given project from group has issues assigned to me | ||
13 | + When I visit group issues page | ||
14 | + Then I should see issues from this group assigned to me | ||
15 | + | ||
16 | + Scenario: I should see group merge requests list | ||
17 | + Given project from group has merge requests assigned to me | ||
18 | + When I visit group merge requests page | ||
19 | + Then I should see merge requests from this group assigned to me |
@@ -0,0 +1,24 @@ | @@ -0,0 +1,24 @@ | ||
1 | +class AdminGroups < Spinach::FeatureSteps | ||
2 | + include SharedAuthentication | ||
3 | + include SharedPaths | ||
4 | + include SharedActiveTab | ||
5 | + | ||
6 | + When 'I click new group link' do | ||
7 | + click_link "New Group" | ||
8 | + end | ||
9 | + | ||
10 | + And 'submit form with new group info' do | ||
11 | + fill_in 'group_name', :with => 'gitlab' | ||
12 | + fill_in 'group_code', :with => 'gitlab' | ||
13 | + click_button "Save group" | ||
14 | + end | ||
15 | + | ||
16 | + Then 'I should see newly created group' do | ||
17 | + page.should have_content "Group: gitlab" | ||
18 | + end | ||
19 | + | ||
20 | + Then 'I should be redirected to group page' do | ||
21 | + current_path.should == admin_group_path(Group.last) | ||
22 | + end | ||
23 | +end | ||
24 | + |
features/steps/group/group.rb
@@ -2,10 +2,6 @@ class Groups < Spinach::FeatureSteps | @@ -2,10 +2,6 @@ class Groups < Spinach::FeatureSteps | ||
2 | include SharedAuthentication | 2 | include SharedAuthentication |
3 | include SharedPaths | 3 | include SharedPaths |
4 | 4 | ||
5 | - When 'I visit group page' do | ||
6 | - visit group_path(current_group) | ||
7 | - end | ||
8 | - | ||
9 | Then 'I should see projects list' do | 5 | Then 'I should see projects list' do |
10 | current_user.projects.each do |project| | 6 | current_user.projects.each do |project| |
11 | page.should have_link project.name | 7 | page.should have_link project.name |
@@ -24,9 +20,43 @@ class Groups < Spinach::FeatureSteps | @@ -24,9 +20,43 @@ class Groups < Spinach::FeatureSteps | ||
24 | page.should have_content 'closed issue' | 20 | page.should have_content 'closed issue' |
25 | end | 21 | end |
26 | 22 | ||
23 | + Then 'I should see issues from this group assigned to me' do | ||
24 | + assigned_to_me(:issues).each do |issue| | ||
25 | + page.should have_content issue.title | ||
26 | + end | ||
27 | + end | ||
28 | + | ||
29 | + Then 'I should see merge requests from this group assigned to me' do | ||
30 | + assigned_to_me(:merge_requests).each do |issue| | ||
31 | + page.should have_content issue.title | ||
32 | + end | ||
33 | + end | ||
34 | + | ||
35 | + Given 'project from group has issues assigned to me' do | ||
36 | + create :issue, | ||
37 | + project: project, | ||
38 | + assignee: current_user, | ||
39 | + author: current_user | ||
40 | + end | ||
41 | + | ||
42 | + Given 'project from group has merge requests assigned to me' do | ||
43 | + create :merge_request, | ||
44 | + project: project, | ||
45 | + assignee: current_user, | ||
46 | + author: current_user | ||
47 | + end | ||
48 | + | ||
27 | protected | 49 | protected |
28 | 50 | ||
29 | def current_group | 51 | def current_group |
30 | @group ||= Group.first | 52 | @group ||= Group.first |
31 | end | 53 | end |
54 | + | ||
55 | + def project | ||
56 | + current_group.projects.first | ||
57 | + end | ||
58 | + | ||
59 | + def assigned_to_me key | ||
60 | + project.send(key).where(assignee_id: current_user.id) | ||
61 | + end | ||
32 | end | 62 | end |
features/steps/shared/paths.rb
@@ -6,6 +6,22 @@ module SharedPaths | @@ -6,6 +6,22 @@ module SharedPaths | ||
6 | end | 6 | end |
7 | 7 | ||
8 | # ---------------------------------------- | 8 | # ---------------------------------------- |
9 | + # Group | ||
10 | + # ---------------------------------------- | ||
11 | + | ||
12 | + When 'I visit group page' do | ||
13 | + visit group_path(current_group) | ||
14 | + end | ||
15 | + | ||
16 | + When 'I visit group issues page' do | ||
17 | + visit issues_group_path(current_group) | ||
18 | + end | ||
19 | + | ||
20 | + When 'I visit group merge requests page' do | ||
21 | + visit merge_requests_group_path(current_group) | ||
22 | + end | ||
23 | + | ||
24 | + # ---------------------------------------- | ||
9 | # Dashboard | 25 | # Dashboard |
10 | # ---------------------------------------- | 26 | # ---------------------------------------- |
11 | 27 | ||
@@ -85,6 +101,10 @@ module SharedPaths | @@ -85,6 +101,10 @@ module SharedPaths | ||
85 | visit admin_resque_path | 101 | visit admin_resque_path |
86 | end | 102 | end |
87 | 103 | ||
104 | + And 'I visit admin groups page' do | ||
105 | + visit admin_groups_path | ||
106 | + end | ||
107 | + | ||
88 | # ---------------------------------------- | 108 | # ---------------------------------------- |
89 | # Generic Project | 109 | # Generic Project |
90 | # ---------------------------------------- | 110 | # ---------------------------------------- |