diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-05-10 23:51:49 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-05-11 00:01:16 -0400 |
commit | 83904275831511f6b17b33064255b669604e0e74 (patch) | |
tree | 6464916bd3559c8fe873d5729dd8e6e0224921fc /spec | |
parent | 19142f407990b7b8a8d74c68ba30bef066e01aa4 (diff) | |
download | gitlab-ce-83904275831511f6b17b33064255b669604e0e74.tar.gz |
Spec SystemNoteService.cross_reference_disallowed?
Diffstat (limited to 'spec')
-rw-r--r-- | spec/services/system_note_service_spec.rb | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/spec/services/system_note_service_spec.rb b/spec/services/system_note_service_spec.rb index 3e9528a83d0..6ddec8e67b1 100644 --- a/spec/services/system_note_service_spec.rb +++ b/spec/services/system_note_service_spec.rb @@ -274,8 +274,32 @@ describe SystemNoteService do end end - # TODO (rspeicher) - describe '.cross_reference_disallowed?' + describe '.cross_reference_disallowed?' do + context 'when mentioner is not a MergeRequest' do + it 'is falsey' do + mentioner = noteable.dup + expect(described_class.cross_reference_disallowed?(noteable, mentioner)). + to be_falsey + end + end + + context 'when mentioner is a MergeRequest' do + let(:mentioner) { create(:merge_request, :simple, source_project: project) } + let(:noteable) { project.commit } + + it 'is truthy when noteable is in commits' do + expect(mentioner).to receive(:commits).and_return([noteable]) + expect(described_class.cross_reference_disallowed?(noteable, mentioner)). + to be_truthy + end + + it 'is falsey when noteable is not in commits' do + expect(mentioner).to receive(:commits).and_return([]) + expect(described_class.cross_reference_disallowed?(noteable, mentioner)). + to be_falsey + end + end + end describe '.cross_reference_exists?' do let(:commit0) { project.commit } |