diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-16 21:09:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-16 21:09:25 +0300 |
commit | e18006fc6313b1d04128416cdb5f1533adcdb53e (patch) | |
tree | ad418c4afbfcc8f83bcf5b4a9c897a2139e79e13 /spec/requests/api/graphql | |
parent | cb8835f38a3e4c188e9a73adf45936e2a95f40ae (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api/graphql')
-rw-r--r-- | spec/requests/api/graphql/mutations/notes/create/discussion_spec.rb | 45 | ||||
-rw-r--r-- | spec/requests/api/graphql/mutations/work_items/create_spec.rb | 12 |
2 files changed, 45 insertions, 12 deletions
diff --git a/spec/requests/api/graphql/mutations/notes/create/discussion_spec.rb b/spec/requests/api/graphql/mutations/notes/create/discussion_spec.rb new file mode 100644 index 00000000000..c7ed63c2560 --- /dev/null +++ b/spec/requests/api/graphql/mutations/notes/create/discussion_spec.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Adding an DiscussionNote', feature_category: :code_review_workflow do + include GraphqlHelpers + + let_it_be(:current_user) { create(:user) } + + let(:noteable) { create(:merge_request, source_project: project, target_project: project) } + let(:project) { create(:project, :repository) } + let(:diff_refs) { noteable.diff_refs } + let(:mutation) do + variables = { + noteable_id: GitlabSchema.id_from_object(noteable).to_s, + body: 'Body text' + } + + graphql_mutation(:create_discussion, variables) + end + + def mutation_response + graphql_mutation_response(:create_discussion) + end + + it_behaves_like 'a Note mutation when the user does not have permission' + + context 'when the user has permission' do + before do + project.add_developer(current_user) + end + + it_behaves_like 'a Note mutation that creates a Note' + + it_behaves_like 'a Note mutation when there are active record validation errors', model: DiscussionNote + + it_behaves_like 'a Note mutation when there are rate limit validation errors' + + it 'returns the discussion' do + post_graphql_mutation(mutation, current_user: current_user) + + expect(mutation_response['note']['body']).to eq('Body text') + end + end +end diff --git a/spec/requests/api/graphql/mutations/work_items/create_spec.rb b/spec/requests/api/graphql/mutations/work_items/create_spec.rb index 2c2cd5f2acc..78b93c3210b 100644 --- a/spec/requests/api/graphql/mutations/work_items/create_spec.rb +++ b/spec/requests/api/graphql/mutations/work_items/create_spec.rb @@ -281,18 +281,6 @@ RSpec.describe 'Create a work item', feature_category: :team_planning do it_behaves_like 'creates work item' - # This is a temporary measure just to ensure the internal id migration doesn't get conflicts - # More info in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/139367 - context 'when making the request in a production environment' do - before do - stub_rails_env('production') - end - - it_behaves_like 'a mutation that returns top-level errors', errors: [ - 'Group level work items are disabled. Only project paths allowed in `namespacePath`.' - ] - end - context 'when the namespace_level_work_items feature flag is disabled' do before do stub_feature_flags(namespace_level_work_items: false) |