Commit 1ac4b24d authored by Stan Hu's avatar Stan Hu Committed by Oswaldo Ferreira

Add spec for CompareService

The return result for the source or target branch being missing was
ambiguous before. It should be an empty compare to indicate no
comparison could be done.
parent 5d74c95c
......@@ -19,5 +19,18 @@ describe CompareService do
it { expect(subject.diffs.size).to eq(3) }
end
context 'compare with target branch that does not exist' do
subject { service.execute(project, 'non-existent-ref') }
it { expect(subject).to be_nil }
end
context 'compare with source branch that does not exist' do
let(:service) { described_class.new(project, 'non-existent-branch') }
subject { service.execute(project, 'non-existent-ref') }
it { expect(subject).to be_nil }
end
end
end
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