debian-mirror-gitlab/features/steps/groups.rb

160 lines
4.2 KiB
Ruby
Raw Normal View History

2015-04-26 12:48:37 +05:30
class Spinach::Features::Groups < Spinach::FeatureSteps
2014-09-02 18:07:02 +05:30
include SharedAuthentication
include SharedPaths
include SharedGroup
include SharedUser
2015-09-25 12:07:36 +05:30
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-12-23 02:04:40 +05:30
group = owned_group
2015-09-25 12:07:36 +05:30
@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
2015-04-26 12:48:37 +05:30
step 'I should see group "Owned" projects list' do
2015-12-23 02:04:40 +05:30
owned_group.projects.each do |project|
2015-09-11 14:41:01 +05:30
expect(page).to have_link project.name
2014-09-02 18:07:02 +05:30
end
end
2015-04-26 12:48:37 +05:30
step 'I should see projects activity feed' do
2016-06-02 11:05:42 +05:30
expect(page).to have_content 'joined project'
2014-09-02 18:07:02 +05:30
end
2015-04-26 12:48:37 +05:30
step 'I should see issues from group "Owned" assigned to me' do
2014-09-02 18:07:02 +05:30
assigned_to_me(:issues).each do |issue|
2015-09-11 14:41:01 +05:30
expect(page).to have_content issue.title
2014-09-02 18:07:02 +05:30
end
end
2016-06-02 11:05:42 +05:30
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
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
2015-04-26 12:48:37 +05:30
step 'I should see merge requests from group "Owned" assigned to me' do
2014-09-02 18:07:02 +05:30
assigned_to_me(:merge_requests).each do |issue|
2015-09-11 14:41:01 +05:30
expect(page).to have_content issue.title[0..80]
2014-09-02 18:07:02 +05:30
end
end
2015-04-26 12:48:37 +05:30
step 'project from group "Owned" has issues assigned to me' do
2014-09-02 18:07:02 +05:30
create :issue,
project: project,
assignee: current_user,
author: current_user
end
2015-04-26 12:48:37 +05:30
step 'project from group "Owned" has merge requests assigned to me' do
2014-09-02 18:07:02 +05:30
create :merge_request,
source_project: project,
target_project: project,
assignee: current_user,
author: current_user
end
2015-04-26 12:48:37 +05:30
step 'I change group "Owned" name to "new-name"' do
2014-09-02 18:07:02 +05:30
fill_in 'group_name', with: 'new-name'
2015-04-26 12:48:37 +05:30
fill_in 'group_path', with: 'new-name'
2014-09-02 18:07:02 +05:30
click_button "Save group"
end
2015-04-26 12:48:37 +05:30
step 'I should see new group "Owned" name' do
2015-09-11 14:41:01 +05:30
page.within ".navbar-gitlab" do
expect(page).to have_content "new-name"
2014-09-02 18:07:02 +05:30
end
end
step 'I change group "Owned" avatar' do
2015-09-11 14:41:01 +05:30
attach_file(:group_avatar, File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif'))
2014-09-02 18:07:02 +05:30
click_button "Save group"
2015-12-23 02:04:40 +05:30
owned_group.reload
2014-09-02 18:07:02 +05:30
end
step 'I should see new group "Owned" avatar' do
2015-12-23 02:04:40 +05:30
expect(owned_group.avatar).to be_instance_of AvatarUploader
2016-08-24 12:49:21 +05:30
expect(owned_group.avatar.url).to eq "/uploads/group/avatar/#{Group.find_by(name: "Owned").id}/banana_sample.gif"
2014-09-02 18:07:02 +05:30
end
step 'I should see the "Remove avatar" button' do
2015-09-11 14:41:01 +05:30
expect(page).to have_link("Remove avatar")
2014-09-02 18:07:02 +05:30
end
step 'I have group "Owned" avatar' do
2015-09-11 14:41:01 +05:30
attach_file(:group_avatar, File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif'))
2014-09-02 18:07:02 +05:30
click_button "Save group"
2015-12-23 02:04:40 +05:30
owned_group.reload
2014-09-02 18:07:02 +05:30
end
step 'I remove group "Owned" avatar' do
click_link "Remove avatar"
2015-12-23 02:04:40 +05:30
owned_group.reload
2014-09-02 18:07:02 +05:30
end
step 'I should not see group "Owned" avatar' do
2015-12-23 02:04:40 +05:30
expect(owned_group.avatar?).to eq false
2014-09-02 18:07:02 +05:30
end
step 'I should not see the "Remove avatar" button' do
2015-09-11 14:41:01 +05:30
expect(page).not_to have_link("Remove avatar")
2014-09-02 18:07:02 +05:30
end
2015-09-25 12:07:36 +05:30
step 'Group "Owned" has archived project' do
group = Group.find_by(name: 'Owned')
2016-06-02 11:05:42 +05:30
@archived_project = create(:project, namespace: group, archived: true, path: "archived-project")
2015-09-25 12:07:36 +05:30
end
step 'I should see "archived" label' do
expect(page).to have_xpath("//span[@class='label label-warning']", text: 'archived')
end
2016-04-02 18:10:28 +05:30
step 'I visit group "NonExistentGroup" page' do
visit group_path(-1)
end
2016-06-02 11:05:42 +05:30
step 'the archived project have some issues' do
create :issue,
project: @archived_project,
assignee: current_user,
author: current_user
end
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-12-23 02:04:40 +05:30
private
2014-09-02 18:07:02 +05:30
2015-04-26 12:48:37 +05:30
def assigned_to_me(key)
2014-09-02 18:07:02 +05:30
project.send(key).where(assignee_id: current_user.id)
end
def project
2015-12-23 02:04:40 +05:30
owned_group.projects.first
2014-09-02 18:07:02 +05:30
end
end