1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
class Groups < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include Select2Helper
Then 'I should see projects list' do
current_user.authorized_projects.each do |project|
page.should have_link project.name
end
end
And 'I have group with projects' do
@group = create(:group)
@group.add_owner(current_user)
@project = create(:project, namespace: @group)
@event = create(:closed_issue_event, project: @project)
@project.team << [current_user, :master]
end
And 'I should see projects activity feed' do
page.should have_content 'closed issue'
end
Then 'I should see issues from this group assigned to me' do
assigned_to_me(:issues).each do |issue|
page.should have_content issue.title
end
end
Then 'I should see merge requests from this group assigned to me' do
assigned_to_me(:merge_requests).each do |issue|
page.should have_content issue.title[0..80]
end
end
Given 'I have new user "John"' do
create(:user, name: "John")
end
And 'I select user "John" from list with role "Reporter"' do
user = User.find_by(name: "John")
within ".users-group-form" do
select2(user.id, from: "#user_ids", multiple: true)
select "Reporter", from: "group_access"
end
click_button "Add users into group"
end
Then 'I should see user "John" in team list' do
projects_with_access = find(".ui-box .well-list")
projects_with_access.should have_content("John")
end
Given 'project from group has issues assigned to me' do
create :issue,
project: project,
assignee: current_user,
author: current_user
end
Given 'project from group has merge requests assigned to me' do
create :merge_request,
source_project: project,
target_project: project,
assignee: current_user,
author: current_user
end
When 'I click new group link' do
click_link "New group"
end
And 'submit form with new group info' do
fill_in 'group_name', with: 'Samurai'
fill_in 'group_description', with: 'Tokugawa Shogunate'
click_button "Create group"
end
Then 'I should see newly created group' do
page.should have_content "Samurai"
page.should have_content "Tokugawa Shogunate"
page.should have_content "You will only see events from projects in this group"
end
Then 'I should be redirected to group page' do
current_path.should == group_path(Group.last)
end
And 'I change group name' do
fill_in 'group_name', with: 'new-name'
click_button "Save group"
end
Then 'I should see new group name' do
within ".navbar-gitlab" do
page.should have_content "group: new-name"
end
end
step 'I change my group avatar' do
attach_file(:group_avatar, File.join(Rails.root, 'public', 'gitlab_logo.png'))
click_button "Save group"
@group.reload
end
step 'I should see new group avatar' do
@group.avatar.should be_instance_of AttachmentUploader
@group.avatar.url.should == "/uploads/group/avatar/#{ @group.id }/gitlab_logo.png"
end
step 'I should see the "Remove avatar" button' do
page.should have_link("Remove avatar")
end
step 'I have an group avatar' do
attach_file(:group_avatar, File.join(Rails.root, 'public', 'gitlab_logo.png'))
click_button "Save group"
@group.reload
end
step 'I remove my group avatar' do
click_link "Remove avatar"
@group.reload
end
step 'I should not see my group avatar' do
@group.avatar?.should be_false
end
step 'I should not see the "Remove avatar" button' do
page.should_not have_link("Remove avatar")
end
protected
def current_group
@group ||= Group.first
end
def project
current_group.projects.first
end
def assigned_to_me key
project.send(key).where(assignee_id: current_user.id)
end
end
|