summaryrefslogtreecommitdiff
path: root/spec/models/list_spec.rb
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2021-01-20 13:34:23 -0600
committerRobert Speicher <rspeicher@gmail.com>2021-01-20 13:34:23 -0600
commit6438df3a1e0fb944485cebf07976160184697d72 (patch)
tree00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /spec/models/list_spec.rb
parent42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff)
downloadgitlab-ce-6438df3a1e0fb944485cebf07976160184697d72.tar.gz
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'spec/models/list_spec.rb')
-rw-r--r--spec/models/list_spec.rb67
1 files changed, 1 insertions, 66 deletions
diff --git a/spec/models/list_spec.rb b/spec/models/list_spec.rb
index 37158584062..f0b1bc33e84 100644
--- a/spec/models/list_spec.rb
+++ b/spec/models/list_spec.rb
@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe List do
it_behaves_like 'having unique enum values'
+ it_behaves_like 'boards listable model', :list
describe 'relationships' do
it { is_expected.to belong_to(:board) }
@@ -14,72 +15,6 @@ RSpec.describe List do
it { is_expected.to validate_presence_of(:board) }
it { is_expected.to validate_presence_of(:label) }
it { is_expected.to validate_presence_of(:list_type) }
- it { is_expected.to validate_presence_of(:position) }
- it { is_expected.to validate_numericality_of(:position).only_integer.is_greater_than_or_equal_to(0) }
-
- context 'when list_type is set to closed' do
- subject { described_class.new(list_type: :closed) }
-
- it { is_expected.not_to validate_presence_of(:label) }
- it { is_expected.not_to validate_presence_of(:position) }
- end
- end
-
- describe '#destroy' do
- it 'can be destroyed when list_type is set to label' do
- subject = create(:list)
-
- expect(subject.destroy).to be_truthy
- end
-
- it 'can not be destroyed when list_type is set to closed' do
- subject = create(:closed_list)
-
- expect(subject.destroy).to be_falsey
- end
- end
-
- describe '#destroyable?' do
- it 'returns true when list_type is set to label' do
- subject.list_type = :label
-
- expect(subject).to be_destroyable
- end
-
- it 'returns false when list_type is set to closed' do
- subject.list_type = :closed
-
- expect(subject).not_to be_destroyable
- end
- end
-
- describe '#movable?' do
- it 'returns true when list_type is set to label' do
- subject.list_type = :label
-
- expect(subject).to be_movable
- end
-
- it 'returns false when list_type is set to closed' do
- subject.list_type = :closed
-
- expect(subject).not_to be_movable
- end
- end
-
- describe '#title' do
- it 'returns label name when list_type is set to label' do
- subject.list_type = :label
- subject.label = Label.new(name: 'Development')
-
- expect(subject.title).to eq 'Development'
- end
-
- it 'returns Closed when list_type is set to closed' do
- subject.list_type = :closed
-
- expect(subject.title).to eq 'Closed'
- end
end
describe '#update_preferences_for' do