2014-09-22 10:30:25 -04:00
|
|
|
class Spinach::Features::Groups < Spinach::FeatureSteps
|
2012-10-03 06:42:17 -04:00
|
|
|
include SharedAuthentication
|
|
|
|
include SharedPaths
|
2014-02-07 11:59:55 -05:00
|
|
|
include SharedGroup
|
2014-01-27 09:53:59 -05:00
|
|
|
include SharedUser
|
2012-10-03 06:42:17 -04:00
|
|
|
|
2015-09-04 14:40:26 -04:00
|
|
|
step 'I should see group "Owned"' do
|
|
|
|
expect(page).to have_content '@owned'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I am a signed out user' do
|
|
|
|
logout
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'Group "Owned" has a public project "Public-project"' do
|
2015-11-24 10:13:21 -05:00
|
|
|
group = owned_group
|
2015-09-04 14:40:26 -04:00
|
|
|
|
|
|
|
@project = create :empty_project, :public,
|
|
|
|
group: group,
|
|
|
|
name: "Public-project"
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see project "Public-project"' do
|
|
|
|
expect(page).to have_content 'Public-project'
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see group "Owned" projects list' do
|
2015-11-24 10:13:21 -05:00
|
|
|
owned_group.projects.each do |project|
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_link project.name
|
2012-10-03 06:42:17 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see projects activity feed' do
|
2016-03-17 17:03:10 -04:00
|
|
|
expect(page).to have_content 'joined project'
|
2012-10-03 06:42:17 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see issues from group "Owned" assigned to me' do
|
2012-10-22 14:42:06 -04:00
|
|
|
assigned_to_me(:issues).each do |issue|
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content issue.title
|
2012-10-22 14:42:06 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-02-25 21:57:28 -05:00
|
|
|
step 'I should not see issues from the archived project' do
|
|
|
|
@archived_project.issues.each do |issue|
|
|
|
|
expect(page).not_to have_content issue.title
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-02-25 22:08:45 -05:00
|
|
|
step 'I should not see merge requests from the archived project' do
|
|
|
|
@archived_project.merge_requests.each do |mr|
|
|
|
|
expect(page).not_to have_content mr.title
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see merge requests from group "Owned" assigned to me' do
|
2012-10-22 14:42:06 -04:00
|
|
|
assigned_to_me(:merge_requests).each do |issue|
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content issue.title[0..80]
|
2012-10-22 14:42:06 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'project from group "Owned" has issues assigned to me' do
|
2012-10-22 14:42:06 -04:00
|
|
|
create :issue,
|
|
|
|
project: project,
|
2017-05-04 08:11:15 -04:00
|
|
|
assignees: [current_user],
|
2012-10-22 14:42:06 -04:00
|
|
|
author: current_user
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'project from group "Owned" has merge requests assigned to me' do
|
2012-10-22 14:42:06 -04:00
|
|
|
create :merge_request,
|
2013-04-25 10:15:33 -04:00
|
|
|
source_project: project,
|
|
|
|
target_project: project,
|
2012-10-22 14:42:06 -04:00
|
|
|
assignee: current_user,
|
|
|
|
author: current_user
|
|
|
|
end
|
|
|
|
|
2014-02-07 11:59:55 -05:00
|
|
|
step 'I change group "Owned" avatar' do
|
2015-06-22 14:00:17 -04:00
|
|
|
attach_file(:group_avatar, File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif'))
|
2014-01-27 16:34:05 -05:00
|
|
|
click_button "Save group"
|
2015-11-24 10:13:21 -05:00
|
|
|
owned_group.reload
|
2014-01-27 16:34:05 -05:00
|
|
|
end
|
|
|
|
|
2014-02-07 11:59:55 -05:00
|
|
|
step 'I should see new group "Owned" avatar' do
|
2015-11-24 10:13:21 -05:00
|
|
|
expect(owned_group.avatar).to be_instance_of AvatarUploader
|
2017-06-07 23:32:38 -04:00
|
|
|
expect(owned_group.avatar.url).to eq "/uploads/system/group/avatar/#{Group.find_by(name: "Owned").id}/banana_sample.gif"
|
2014-01-27 16:34:05 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see the "Remove avatar" button' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_link("Remove avatar")
|
2014-01-27 16:34:05 -05:00
|
|
|
end
|
|
|
|
|
2014-02-07 11:59:55 -05:00
|
|
|
step 'I have group "Owned" avatar' do
|
2015-06-22 14:00:17 -04:00
|
|
|
attach_file(:group_avatar, File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif'))
|
2014-01-27 16:34:05 -05:00
|
|
|
click_button "Save group"
|
2015-11-24 10:13:21 -05:00
|
|
|
owned_group.reload
|
2014-01-27 16:34:05 -05:00
|
|
|
end
|
|
|
|
|
2014-02-07 11:59:55 -05:00
|
|
|
step 'I remove group "Owned" avatar' do
|
2014-01-27 16:34:05 -05:00
|
|
|
click_link "Remove avatar"
|
2015-11-24 10:13:21 -05:00
|
|
|
owned_group.reload
|
2014-01-27 16:34:05 -05:00
|
|
|
end
|
|
|
|
|
2014-02-07 11:59:55 -05:00
|
|
|
step 'I should not see group "Owned" avatar' do
|
2015-11-24 10:13:21 -05:00
|
|
|
expect(owned_group.avatar?).to eq false
|
2014-01-27 16:34:05 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should not see the "Remove avatar" button' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).not_to have_link("Remove avatar")
|
2014-01-27 16:34:05 -05:00
|
|
|
end
|
|
|
|
|
2015-08-18 11:46:57 -04:00
|
|
|
step 'Group "Owned" has archived project' do
|
|
|
|
group = Group.find_by(name: 'Owned')
|
2017-01-17 11:52:26 -05:00
|
|
|
@archived_project = create(:empty_project, :archived, namespace: group, path: "archived-project")
|
2015-08-18 11:46:57 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see "archived" label' do
|
|
|
|
expect(page).to have_xpath("//span[@class='label label-warning']", text: 'archived')
|
|
|
|
end
|
|
|
|
|
2016-01-27 05:23:28 -05:00
|
|
|
step 'I visit group "NonExistentGroup" page' do
|
2016-11-08 03:13:13 -05:00
|
|
|
visit group_path("NonExistentGroup")
|
2016-01-27 05:23:28 -05:00
|
|
|
end
|
|
|
|
|
2016-02-25 21:57:28 -05:00
|
|
|
step 'the archived project have some issues' do
|
|
|
|
create :issue,
|
|
|
|
project: @archived_project,
|
2017-05-04 08:11:15 -04:00
|
|
|
assignees: [current_user],
|
2016-02-25 21:57:28 -05:00
|
|
|
author: current_user
|
|
|
|
end
|
|
|
|
|
2016-02-25 22:08:45 -05:00
|
|
|
step 'the archived project have some merge requests' do
|
|
|
|
create :merge_request,
|
|
|
|
source_project: @archived_project,
|
|
|
|
target_project: @archived_project,
|
|
|
|
assignee: current_user,
|
|
|
|
author: current_user
|
|
|
|
end
|
|
|
|
|
2015-11-25 05:44:39 -05:00
|
|
|
private
|
2015-11-24 10:13:21 -05:00
|
|
|
|
2014-09-25 18:07:40 -04:00
|
|
|
def assigned_to_me(key)
|
2012-10-22 14:42:06 -04:00
|
|
|
project.send(key).where(assignee_id: current_user.id)
|
|
|
|
end
|
2014-02-07 11:59:55 -05:00
|
|
|
|
|
|
|
def project
|
2015-11-24 10:13:21 -05:00
|
|
|
owned_group.projects.first
|
2014-02-07 11:59:55 -05:00
|
|
|
end
|
2012-10-03 06:42:17 -04:00
|
|
|
end
|