diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-07-31 20:45:56 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-08-17 12:58:57 -0300 |
commit | 252e93c9e664e595ea9b4987f14ca8fb21a0e307 (patch) | |
tree | 2d62339b792ac429520e1fe037b09650b2fc6925 /spec/models/list_spec.rb | |
parent | b07c5f23b8761ae87d29ded1a69b14ae6393443a (diff) | |
download | gitlab-ce-252e93c9e664e595ea9b4987f14ca8fb21a0e307.tar.gz |
Title of a list is either the label name, or Backlog, or Done
Diffstat (limited to 'spec/models/list_spec.rb')
-rw-r--r-- | spec/models/list_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/models/list_spec.rb b/spec/models/list_spec.rb index 60b46f06195..689011454d3 100644 --- a/spec/models/list_spec.rb +++ b/spec/models/list_spec.rb @@ -6,6 +6,10 @@ describe List do it { is_expected.to belong_to(:label) } end + describe 'delegate methods' do + it { is_expected.to delegate_method(:name).to(:label).with_prefix } + end + describe 'validations' do it { is_expected.to validate_presence_of(:board) } it { is_expected.to validate_presence_of(:label) } @@ -27,4 +31,24 @@ describe List do it { is_expected.not_to validate_presence_of(:position) } 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 Backlog when list_type is set to backlog' do + subject.list_type = :backlog + + expect(subject.title).to eq 'Backlog' + end + + it 'returns Done when list_type is set to done' do + subject.list_type = :done + + expect(subject.title).to eq 'Done' + end + end end |