diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-22 06:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-22 06:08:42 +0300 |
commit | 1b4aacbd0792c036ae2be67c20d014db25e31f09 (patch) | |
tree | aa647438fde2dc94f69b7852d76cfde116400e86 /spec/requests | |
parent | 0e6d9b66698db1e2e14e784fa9c601922e3f1a2c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/groups/work_items_controller_spec.rb | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/spec/requests/groups/work_items_controller_spec.rb b/spec/requests/groups/work_items_controller_spec.rb new file mode 100644 index 00000000000..c47b3f03ec1 --- /dev/null +++ b/spec/requests/groups/work_items_controller_spec.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Group Level Work Items', feature_category: :team_planning do + let_it_be(:group) { create(:group, :private) } + let_it_be(:project) { create(:project, group: group) } + let_it_be(:developer) { create(:user).tap { |u| group.add_developer(u) } } + + describe 'GET /groups/:group/-/work_items' do + let(:work_items_path) { url_for(controller: 'groups/work_items', action: :index, group_id: group.full_path) } + + before do + sign_in(current_user) + end + + context 'when the user can read the group' do + let(:current_user) { developer } + + it 'renders index' do + get work_items_path + + expect(response).to have_gitlab_http_status(:ok) + end + + context 'when the namespace_level_work_items feature flag is disabled' do + before do + stub_feature_flags(namespace_level_work_items: false) + end + + it 'returns not found' do + get work_items_path + + expect(response).to have_gitlab_http_status(:not_found) + end + end + end + + context 'when the user cannot read the group' do + let(:current_user) { create(:user) } + + it 'returns not found' do + get work_items_path + + expect(response).to have_gitlab_http_status(:not_found) + end + end + end +end |