diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 11:18:50 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 11:18:50 +0000 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/helpers/notes_helper_spec.rb | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) | |
download | gitlab-ce-8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781.tar.gz |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
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) |