diff options
Diffstat (limited to 'spec/requests/api/graphql/mutations/merge_requests')
-rw-r--r-- | spec/requests/api/graphql/mutations/merge_requests/set_time_estimate_spec.rb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/requests/api/graphql/mutations/merge_requests/set_time_estimate_spec.rb b/spec/requests/api/graphql/mutations/merge_requests/set_time_estimate_spec.rb new file mode 100644 index 00000000000..6bc130a97cf --- /dev/null +++ b/spec/requests/api/graphql/mutations/merge_requests/set_time_estimate_spec.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Setting time estimate of a merge request', feature_category: :code_review_workflow do + include GraphqlHelpers + + let_it_be(:current_user) { create(:user) } + let_it_be(:project) { create(:project, :public) } + let_it_be(:merge_request) { create(:merge_request, source_project: project) } + + let(:input) do + { + iid: merge_request.iid.to_s + } + end + + let(:extra_params) { { project_path: project.full_path } } + let(:input_params) { input.merge(extra_params) } + let(:mutation) { graphql_mutation(:merge_request_update, input_params, nil, ['productAnalyticsState']) } + let(:mutation_response) { graphql_mutation_response(:merge_request_update) } + + context 'when the user is not allowed to update a merge request' do + before_all do + project.add_reporter(current_user) + end + + it_behaves_like 'a mutation that returns a top-level access error' + end + + context 'when updating a time estimate' do + before_all do + project.add_developer(current_user) + end + + it_behaves_like 'updating time estimate' do + let(:resource) { merge_request } + let(:mutation_name) { 'mergeRequestUpdate' } + end + end +end |