diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-26 15:08:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-26 15:08:22 +0300 |
commit | 1691cbe307f7698b3ee39811278990c43b6751a5 (patch) | |
tree | 2bd7d5b7143242f540a9edde92c83c791ebf8af4 /spec/helpers/notes_helper_spec.rb | |
parent | 27c6c4bf061c3a2289ce4808b1b354535994d09d (diff) |
Add latest changes from gitlab-org/gitlab@master
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) |