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
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/models/board_spec.rb2
-rw-r--r--spec/models/list_spec.rb21
2 files changed, 22 insertions, 1 deletions
diff --git a/spec/models/board_spec.rb b/spec/models/board_spec.rb
index 23a91619a27..12d29540137 100644
--- a/spec/models/board_spec.rb
+++ b/spec/models/board_spec.rb
@@ -3,7 +3,7 @@ require 'rails_helper'
describe Board do
describe 'relationships' do
it { is_expected.to belong_to(:project) }
- it { is_expected.to have_many(:lists).order(list_type: :asc, position: :asc).dependent(:destroy) }
+ it { is_expected.to have_many(:lists).order(list_type: :asc, position: :asc).dependent(:delete_all) }
end
describe 'validations' do
diff --git a/spec/models/list_spec.rb b/spec/models/list_spec.rb
index 689011454d3..45c07a679cb 100644
--- a/spec/models/list_spec.rb
+++ b/spec/models/list_spec.rb
@@ -31,6 +31,27 @@ describe List do
it { is_expected.not_to validate_presence_of(:position) }
end
end
+
+ describe '#destroy' do
+ it 'can be destroyed when when list_type is set to label' do
+ subject = create(:label_list)
+
+ expect(subject.destroy).to be_truthy
+ end
+
+ it 'can not be destroyed when list_type is set to backlog' do
+ subject = create(:backlog_list)
+
+ expect(subject.destroy).to be_falsey
+ end
+
+ it 'can not be destroyed when when list_type is set to done' do
+ subject = create(:done_list)
+
+ expect(subject.destroy).to be_falsey
+ end
+ end
+
describe '#title' do
it 'returns label name when list_type is set to label' do
subject.list_type = :label