diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-02-18 01:28:36 -0200 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-02-20 12:12:05 -0200 |
commit | b13a73446a5cda8076b7d4639ff7e70bc1cdbca1 (patch) | |
tree | a3d26f1e16ab616d8913bc1cc8bb2e499cd6976b /spec | |
parent | 07eb334c2546294acea43e85308bec907b13467c (diff) | |
download | gitlab-ce-b13a73446a5cda8076b7d4639ff7e70bc1cdbca1.tar.gz |
Fix pending examples from task model spec
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/task_spec.rb | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/spec/models/task_spec.rb b/spec/models/task_spec.rb index 2f0b51ffc61..2871e02aa4d 100644 --- a/spec/models/task_spec.rb +++ b/spec/models/task_spec.rb @@ -46,8 +46,21 @@ describe Task, models: true do end describe '#body?' do - it 'returns true when target respond to title' - it 'returns false when target does not respond to title' + let(:issue) { build(:issue) } + + before do + subject.target = issue + end + + it 'returns true when target respond to title' do + expect(subject.body?).to eq true + end + + it 'returns false when target does not respond to title' do + allow(issue).to receive(:respond_to?).with(:title).and_return(false) + + expect(subject.body?).to eq false + end end describe '#note_text' do @@ -65,7 +78,20 @@ describe Task, models: true do end describe '#target_iid' do - it 'returns target.iid when target respond to iid' - it 'returns target_id when target does not respond to iid' + let(:issue) { build(:issue, id: 1, iid: 5) } + + before do + subject.target = issue + end + + it 'returns target.iid when target respond to iid' do + expect(subject.target_iid).to eq 5 + end + + it 'returns target_id when target does not respond to iid' do + allow(issue).to receive(:respond_to?).with(:iid).and_return(false) + + expect(subject.target_iid).to eq 1 + end end end |