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>2020-01-21 06:08:37 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-21 06:08:37 +0300
commit2399724614f3c4dcf3059038d997193830de93ee (patch)
tree3315c4453ef3efb5c1162911753436cad4f3e57d /spec/support/shared_examples/services/boards/lists_destroy_service_shared_examples.rb
parent6755df108b123ecc8ae330d7c7bf2f04fbf36a81 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_examples/services/boards/lists_destroy_service_shared_examples.rb')
-rw-r--r--spec/support/shared_examples/services/boards/lists_destroy_service_shared_examples.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/support/shared_examples/services/boards/lists_destroy_service_shared_examples.rb b/spec/support/shared_examples/services/boards/lists_destroy_service_shared_examples.rb
new file mode 100644
index 00000000000..6a4f284ec54
--- /dev/null
+++ b/spec/support/shared_examples/services/boards/lists_destroy_service_shared_examples.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+RSpec.shared_examples 'lists destroy service' do
+ context 'when list type is label' do
+ it 'removes list from board' do
+ list = create(:list, board: board)
+ service = described_class.new(parent, user)
+
+ expect { service.execute(list) }.to change(board.lists, :count).by(-1)
+ end
+
+ it 'decrements position of higher lists' do
+ development = create(:list, board: board, position: 0)
+ review = create(:list, board: board, position: 1)
+ staging = create(:list, board: board, position: 2)
+ closed = board.closed_list
+
+ described_class.new(parent, user).execute(development)
+
+ expect(review.reload.position).to eq 0
+ expect(staging.reload.position).to eq 1
+ expect(closed.reload.position).to be_nil
+ end
+ end
+
+ it 'does not remove list from board when list type is closed' do
+ list = board.closed_list
+ service = described_class.new(parent, user)
+
+ expect { service.execute(list) }.not_to change(board.lists, :count)
+ end
+end