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:
Stan Hu 2019-04-14 15:56:02 -07:00 committed by Oswaldo Ferreira
parent 5d74c95c98
commit 1ac4b24dd3

View file

@ -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