Commit 83904275 authored by Robert Speicher's avatar Robert Speicher

Spec SystemNoteService.cross_reference_disallowed?

parent 19142f40
...@@ -274,8 +274,32 @@ describe SystemNoteService do ...@@ -274,8 +274,32 @@ describe SystemNoteService do
end end
end end
# TODO (rspeicher) describe '.cross_reference_disallowed?' do
describe '.cross_reference_disallowed?' 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 describe '.cross_reference_exists?' do
let(:commit0) { project.commit } let(:commit0) { project.commit }
......
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