diff options
Diffstat (limited to 'spec/helpers/notes_helper_spec.rb')
-rw-r--r-- | spec/helpers/notes_helper_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/helpers/notes_helper_spec.rb b/spec/helpers/notes_helper_spec.rb index f074a918e7f..543a9081779 100644 --- a/spec/helpers/notes_helper_spec.rb +++ b/spec/helpers/notes_helper_spec.rb @@ -24,6 +24,36 @@ describe NotesHelper do project.add_guest(guest) end + describe '#note_target_title' do + context 'note does not exist' do + it 'returns nil' do + expect(helper.note_target_title(nil)).to be_blank + end + end + + context 'target does not exist' do + it 'returns nil' do + note = Note.new + expect(helper.note_target_title(note)).to be_blank + end + end + + context 'when given a design target' do + it 'returns nil' do + note = build_stubbed(:note_on_design) + expect(helper.note_target_title(note)).to be_blank + end + end + + context 'when given a non-design target' do + it 'returns the issue title' do + issue = build_stubbed(:issue, title: 'Issue 1') + note = build_stubbed(:note, noteable: issue) + expect(helper.note_target_title(note)).to eq('Issue 1') + end + end + end + describe "#notes_max_access_for_users" do it 'returns access levels' do expect(helper.note_max_access_for_user(owner_note)).to eq(Gitlab::Access::OWNER) |