debian-mirror-gitlab/spec/features/groups/issues_spec.rb

103 lines
3.3 KiB
Ruby
Raw Normal View History

2016-11-24 13:41:30 +05:30
require 'spec_helper'
2018-11-08 19:23:39 +05:30
describe 'Group issues page' do
2017-09-10 17:25:29 +05:30
include FilteredSearchHelpers
2018-05-09 12:01:36 +05:30
let(:group) { create(:group) }
let(:project) { create(:project, :public, group: group)}
2018-11-08 19:23:39 +05:30
let(:project_with_issues_disabled) { create(:project, :issues_disabled, group: group) }
2018-05-09 12:01:36 +05:30
let(:path) { issues_group_path(group) }
2018-03-17 18:26:18 +05:30
context 'with shared examples' do
let(:issuable) { create(:issue, project: project, title: "this is my created issuable")}
2016-11-24 13:41:30 +05:30
2018-03-17 18:26:18 +05:30
include_examples 'project features apply to issuables', Issue
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
context 'rss feed' do
let(:access_level) { ProjectFeature::ENABLED }
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
context 'when signed in' do
2018-11-08 19:23:39 +05:30
let(:user) do
user_in_group.ensure_feed_token
user_in_group.save!
user_in_group
end
it_behaves_like "it has an RSS button with current_user's feed token"
it_behaves_like "an autodiscoverable RSS feed with current_user's feed token"
2018-03-17 18:26:18 +05:30
end
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
context 'when signed out' do
let(:user) { nil }
2017-08-17 22:00:37 +05:30
2018-11-08 19:23:39 +05:30
it_behaves_like "it has an RSS button without a feed token"
it_behaves_like "an autodiscoverable RSS feed without a feed token"
2018-03-17 18:26:18 +05:30
end
2017-08-17 22:00:37 +05:30
end
2018-03-17 18:26:18 +05:30
context 'assignee', :js do
let(:access_level) { ProjectFeature::ENABLED }
let(:user) { user_in_group }
let(:user2) { user_outside_group }
it 'filters by only group users' do
filtered_search.set('assignee:')
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
expect(find('#js-dropdown-assignee .filter-dropdown')).to have_content(user.name)
expect(find('#js-dropdown-assignee .filter-dropdown')).not_to have_content(user2.name)
end
end
end
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
context 'issues list', :nested_groups do
let(:subgroup) { create(:group, parent: group) }
let(:subgroup_project) { create(:project, :public, group: subgroup)}
2018-11-18 11:00:15 +05:30
let(:user_in_group) { create(:group_member, :maintainer, user: create(:user), group: group ).user }
2018-03-17 18:26:18 +05:30
let!(:issue) { create(:issue, project: project, title: 'root group issue') }
let!(:subgroup_issue) { create(:issue, project: subgroup_project, title: 'subgroup issue') }
it 'returns all group and subgroup issues' do
visit issues_group_path(group)
page.within('.issuable-list') do
expect(page).to have_selector('li.issue', count: 2)
expect(page).to have_content('root group issue')
expect(page).to have_content('subgroup issue')
end
2017-08-17 22:00:37 +05:30
end
2018-05-09 12:01:36 +05:30
context 'when project is archived' do
before do
2018-11-18 11:00:15 +05:30
::Projects::UpdateService.new(project, user_in_group, archived: true).execute
2018-05-09 12:01:36 +05:30
end
it 'does not render issue' do
visit path
expect(page).not_to have_content issue.title[0..80]
end
end
2017-08-17 22:00:37 +05:30
end
2018-11-08 19:23:39 +05:30
context 'projects with issues disabled' do
describe 'issue dropdown' do
2018-11-18 11:00:15 +05:30
let(:user_in_group) { create(:group_member, :maintainer, user: create(:user), group: group ).user }
2018-11-08 19:23:39 +05:30
before do
2018-11-18 11:00:15 +05:30
[project, project_with_issues_disabled].each { |project| project.add_maintainer(user_in_group) }
2018-11-08 19:23:39 +05:30
sign_in(user_in_group)
visit issues_group_path(group)
end
it 'shows projects only with issues feature enabled', :js do
find('.new-project-item-link').click
page.within('.select2-results') do
expect(page).to have_content(project.full_name)
expect(page).not_to have_content(project_with_issues_disabled.full_name)
end
end
end
end
2016-11-24 13:41:30 +05:30
end