diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-11 21:10:34 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-11 21:10:34 +0300 |
commit | 5842aa35563dacaabf9a80307966fabe366a1321 (patch) | |
tree | 76a34e30f26c3e0f44410cadc308c301d49858ce /spec/requests | |
parent | f4ad4d190044bd14fe4caec25b1a219887bc752f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests')
5 files changed, 79 insertions, 9 deletions
diff --git a/spec/requests/groups/observability_controller_spec.rb b/spec/requests/groups/observability_controller_spec.rb index b82cf2b0bad..247535bc990 100644 --- a/spec/requests/groups/observability_controller_spec.rb +++ b/spec/requests/groups/observability_controller_spec.rb @@ -17,6 +17,10 @@ RSpec.describe Groups::ObservabilityController, feature_category: :tracing do end it_behaves_like 'observability csp policy' do + before_all do + group.add_developer(user) + end + let(:tested_path) { path } end diff --git a/spec/requests/projects/issues_controller_spec.rb b/spec/requests/projects/issues_controller_spec.rb index 583fd5f586e..1ae65939c86 100644 --- a/spec/requests/projects/issues_controller_spec.rb +++ b/spec/requests/projects/issues_controller_spec.rb @@ -17,6 +17,11 @@ RSpec.describe Projects::IssuesController, feature_category: :team_planning do describe 'GET #new' do include_context 'group project issue' + before do + group.add_developer(user) + login_as(user) + end + it_behaves_like "observability csp policy", described_class do let(:tested_path) do new_project_issue_path(project) @@ -26,11 +31,13 @@ RSpec.describe Projects::IssuesController, feature_category: :team_planning do describe 'GET #show' do before do + group.add_developer(user) login_as(user) end it_behaves_like "observability csp policy", described_class do include_context 'group project issue' + let(:tested_path) do project_issue_path(project, issue) end diff --git a/spec/requests/projects/merge_requests/creations_spec.rb b/spec/requests/projects/merge_requests/creations_spec.rb index ace6ef0f7b8..e8a073fef5f 100644 --- a/spec/requests/projects/merge_requests/creations_spec.rb +++ b/spec/requests/projects/merge_requests/creations_spec.rb @@ -6,8 +6,13 @@ RSpec.describe 'merge requests creations', feature_category: :code_review_workfl describe 'GET /:namespace/:project/merge_requests/new' do include ProjectForksHelper - let(:project) { create(:project, :repository) } - let(:user) { project.first_owner } + let_it_be(:group) { create(:group) } + let_it_be(:project) { create(:project, :repository, group: group) } + let_it_be(:user) { create(:user) } + + before_all do + group.add_developer(user) + end before do login_as(user) @@ -26,16 +31,13 @@ RSpec.describe 'merge requests creations', feature_category: :code_review_workfl end it_behaves_like "observability csp policy", Projects::MergeRequests::CreationsController do - let_it_be(:group) { create(:group) } - let_it_be(:user) { create(:user) } - let_it_be(:project) { create(:project, group: group) } let(:tested_path) do project_new_merge_request_path(project, merge_request: { title: 'Some feature', - source_branch: 'fix', - target_branch: 'feature', - target_project: project, - source_project: project + source_branch: 'fix', + target_branch: 'feature', + target_project: project, + source_project: project }) end end diff --git a/spec/requests/projects/merge_requests_controller_spec.rb b/spec/requests/projects/merge_requests_controller_spec.rb index 955e6822211..955b6e53686 100644 --- a/spec/requests/projects/merge_requests_controller_spec.rb +++ b/spec/requests/projects/merge_requests_controller_spec.rb @@ -16,6 +16,7 @@ RSpec.describe Projects::MergeRequestsController, feature_category: :source_code context 'when logged in' do before do + group.add_developer(user) login_as(user) end diff --git a/spec/requests/projects/tracing_controller_spec.rb b/spec/requests/projects/tracing_controller_spec.rb new file mode 100644 index 00000000000..520e99b120a --- /dev/null +++ b/spec/requests/projects/tracing_controller_spec.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Projects::TracingController, feature_category: :tracing do + let_it_be(:project) { create(:project, :repository) } + let_it_be(:user) { create(:user) } + let(:path) { nil } + let(:observability_tracing_ff) { true } + + subject do + get path + response + end + + describe 'GET #index' do + before do + stub_feature_flags(observability_tracing: observability_tracing_ff) + sign_in(user) + end + + let(:path) { project_tracing_index_path(project) } + + it_behaves_like 'observability csp policy' do + before_all do + project.add_developer(user) + end + + let(:tested_path) { path } + end + + context 'when user does not have permissions' do + it 'returns 404' do + expect(subject).to have_gitlab_http_status(:not_found) + end + end + + context 'when user has permissions' do + before_all do + project.add_developer(user) + end + + it 'returns 200' do + expect(subject).to have_gitlab_http_status(:ok) + end + + context 'when feature is disabled' do + let(:observability_tracing_ff) { false } + + it 'returns 404' do + expect(subject).to have_gitlab_http_status(:not_found) + end + end + end + end +end |