Fix pending examples from task model spec

parent 07eb334c
...@@ -46,8 +46,21 @@ describe Task, models: true do ...@@ -46,8 +46,21 @@ describe Task, models: true do
end end
describe '#body?' do describe '#body?' do
it 'returns true when target respond to title' let(:issue) { build(:issue) }
it 'returns false when target does not respond to title'
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 end
describe '#note_text' do describe '#note_text' do
...@@ -65,7 +78,20 @@ describe Task, models: true do ...@@ -65,7 +78,20 @@ describe Task, models: true do
end end
describe '#target_iid' do describe '#target_iid' do
it 'returns target.iid when target respond to iid' let(:issue) { build(:issue, id: 1, iid: 5) }
it 'returns target_id when target does not respond to iid'
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
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment