Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests/api/graphql/mutations/issues/set_due_date_spec.rb')
-rw-r--r--spec/requests/api/graphql/mutations/issues/set_due_date_spec.rb31
1 files changed, 27 insertions, 4 deletions
diff --git a/spec/requests/api/graphql/mutations/issues/set_due_date_spec.rb b/spec/requests/api/graphql/mutations/issues/set_due_date_spec.rb
index b3c9b9d4995..ea5be9f9852 100644
--- a/spec/requests/api/graphql/mutations/issues/set_due_date_spec.rb
+++ b/spec/requests/api/graphql/mutations/issues/set_due_date_spec.rb
@@ -42,11 +42,34 @@ RSpec.describe 'Setting Due Date of an issue' do
expect(graphql_errors).to include(a_hash_including('message' => error))
end
- it 'updates the issue due date' do
- post_graphql_mutation(mutation, current_user: current_user)
+ context 'when due date value is a valid date' do
+ it 'updates the issue due date' do
+ post_graphql_mutation(mutation, current_user: current_user)
+
+ expect(response).to have_gitlab_http_status(:success)
+ expect(mutation_response['issue']['dueDate']).to eq(2.days.since.to_date.to_s)
+ end
+ end
+
+ context 'when due date value is null' do
+ let(:input) { { due_date: nil } }
+
+ it 'updates the issue to remove the due date' do
+ post_graphql_mutation(mutation, current_user: current_user)
- expect(response).to have_gitlab_http_status(:success)
- expect(mutation_response['issue']['dueDate']).to eq(2.days.since.to_date.to_s)
+ expect(response).to have_gitlab_http_status(:success)
+ expect(mutation_response['issue']['dueDate']).to be nil
+ end
+ end
+
+ context 'when due date argument is not given' do
+ let(:input) { {} }
+
+ it 'returns an error' do
+ post_graphql_mutation(mutation, current_user: current_user)
+
+ expect(graphql_errors).to include(a_hash_including('message' => /Argument dueDate must be provided/))
+ end
end
context 'when the due date value is not a valid time' do