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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-09-02 15:10:32 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-09-02 15:10:32 +0300
commit2d337eacd93f459f702e032077b5ba123ed90c00 (patch)
tree50f9008ff752729cebf85e0cb3631577a013a02e /spec/graphql/mutations/boards/issues/issue_move_list_spec.rb
parent423309c4aeebaf0415ba6de79599f9b5fd6c57a7 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/graphql/mutations/boards/issues/issue_move_list_spec.rb')
-rw-r--r--spec/graphql/mutations/boards/issues/issue_move_list_spec.rb46
1 files changed, 45 insertions, 1 deletions
diff --git a/spec/graphql/mutations/boards/issues/issue_move_list_spec.rb b/spec/graphql/mutations/boards/issues/issue_move_list_spec.rb
index 10aed8a1f00..8e9a567f614 100644
--- a/spec/graphql/mutations/boards/issues/issue_move_list_spec.rb
+++ b/spec/graphql/mutations/boards/issues/issue_move_list_spec.rb
@@ -55,7 +55,7 @@ RSpec.describe Mutations::Boards::Issues::IssueMoveList do
let(:move_params) { {} }
it 'generates an error' do
- expect_graphql_error_to_be_created(Gitlab::Graphql::Errors::ArgumentError, 'At least one of the arguments fromListId, toListId, afterId or beforeId is required') do
+ expect_graphql_error_to_be_created(Gitlab::Graphql::Errors::ArgumentError, 'At least one of the arguments fromListId, toListId, positionInList, moveAfterId, or moveBeforeId is required') do
subject
end
end
@@ -71,6 +71,50 @@ RSpec.describe Mutations::Boards::Issues::IssueMoveList do
end
end
+ context 'when positionInList is given' do
+ let(:move_params) { { from_list_id: list1.id, to_list_id: list2.id, position_in_list: 0 } }
+
+ context 'when fromListId and toListId are missing' do
+ let(:move_params) { { position_in_list: 0 } }
+
+ it 'generates an error' do
+ expect_graphql_error_to_be_created(Gitlab::Graphql::Errors::ArgumentError, 'Both fromListId and toListId are required when positionInList is given') do
+ subject
+ end
+ end
+ end
+
+ context 'when move_before_id is also given' do
+ let(:move_params) { { from_list_id: list1.id, to_list_id: list2.id, position_in_list: 0, move_before_id: 1 } }
+
+ it 'generates an error' do
+ expect_graphql_error_to_be_created(Gitlab::Graphql::Errors::ArgumentError, 'positionInList is mutually exclusive with any of moveBeforeId or moveAfterId') do
+ subject
+ end
+ end
+ end
+
+ context 'when move_after_id is also given' do
+ let(:move_params) { { from_list_id: list1.id, to_list_id: list2.id, position_in_list: 0, move_after_id: 1 } }
+
+ it 'generates an error' do
+ expect_graphql_error_to_be_created(Gitlab::Graphql::Errors::ArgumentError, 'positionInList is mutually exclusive with any of moveBeforeId or moveAfterId') do
+ subject
+ end
+ end
+ end
+
+ context 'when position_in_list is invalid' do
+ let(:move_params) { { from_list_id: list1.id, to_list_id: list2.id, position_in_list: -5 } }
+
+ it 'generates an error' do
+ expect_graphql_error_to_be_created(Gitlab::Graphql::Errors::ArgumentError, "positionInList must be >= 0 or #{Boards::Issues::MoveService::LIST_END_POSITION}") do
+ subject
+ end
+ end
+ end
+ end
+
context 'when user have access to resources' do
it 'moves and repositions issue' do
subject