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.
This commit is contained in:
parent
5d74c95c98
commit
1ac4b24dd3
1 changed files with 13 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue