diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-25 03:08:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-25 03:08:14 +0300 |
commit | 6a8fdd62ab34910131f0c2e071b88f7cb07593f7 (patch) | |
tree | cc1693c8c494711a8b3a08d2aef897667de7cd17 /spec/graphql | |
parent | 65aa9cb3b665f885b5c80b817d84af6076b35f26 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/graphql')
-rw-r--r-- | spec/graphql/mutations/issues/update_spec.rb | 13 | ||||
-rw-r--r-- | spec/graphql/mutations/merge_requests/update_spec.rb | 14 |
2 files changed, 25 insertions, 2 deletions
diff --git a/spec/graphql/mutations/issues/update_spec.rb b/spec/graphql/mutations/issues/update_spec.rb index ac82037b7e2..622ccb86b2e 100644 --- a/spec/graphql/mutations/issues/update_spec.rb +++ b/spec/graphql/mutations/issues/update_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Mutations::Issues::Update do +RSpec.describe Mutations::Issues::Update, feature_category: :team_planning do let_it_be(:project) { create(:project) } let_it_be(:user) { create(:user) } let_it_be(:project_label) { create(:label, project: project) } @@ -177,6 +177,17 @@ RSpec.describe Mutations::Issues::Update do end end + context 'when timeEstimate is negative' do + let(:time_estimate) { '-1h' } + + it 'raises an argument error and changes are not applied' do + expect { mutation.ready?(time_estimate: time_estimate) } + .to raise_error(Gitlab::Graphql::Errors::ArgumentError, + 'timeEstimate must be greater than or equal to zero. Remember that every new timeEstimate overwrites the previous value.') + expect { subject }.not_to change { issue.time_estimate } + end + end + context 'when timeEstimate is 0' do let(:time_estimate) { '0' } diff --git a/spec/graphql/mutations/merge_requests/update_spec.rb b/spec/graphql/mutations/merge_requests/update_spec.rb index 8a10f6cadd0..6ced71c5f4c 100644 --- a/spec/graphql/mutations/merge_requests/update_spec.rb +++ b/spec/graphql/mutations/merge_requests/update_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Mutations::MergeRequests::Update do +RSpec.describe Mutations::MergeRequests::Update, feature_category: :team_planning do let(:merge_request) { create(:merge_request) } let(:user) { create(:user) } @@ -59,6 +59,18 @@ RSpec.describe Mutations::MergeRequests::Update do end end + context 'when timeEstimate is negative' do + let(:time_estimate) { '-1h' } + + it 'raises an argument error and changes are not applied' do + expect { mutation.ready?(time_estimate: time_estimate) } + .to raise_error(Gitlab::Graphql::Errors::ArgumentError, + 'timeEstimate must be greater than or equal to zero. ' \ + 'Remember that every new timeEstimate overwrites the previous value.') + expect { subject }.not_to change { merge_request.time_estimate } + end + end + context 'when timeEstimate is 0' do let(:time_estimate) { '0' } |