diff options
author | Stan Hu <stanhu@gmail.com> | 2019-04-14 15:56:02 -0700 |
---|---|---|
committer | Oswaldo Ferreira <> | 2019-04-18 22:01:51 -0300 |
commit | 1ac4b24dd3153acd1fa7a66f6261911ee74ce734 (patch) | |
tree | c4cb80941ba25fd0b136f8e3c1193f861e4af89d | |
parent | 5d74c95c988cdd9c1c761de3a78c3dc191e4fe52 (diff) | |
download | gitlab-ce-1ac4b24dd3153acd1fa7a66f6261911ee74ce734.tar.gz |
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.
-rw-r--r-- | spec/services/compare_service_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/services/compare_service_spec.rb b/spec/services/compare_service_spec.rb index 0e4ef69ec19..fadd43635a6 100644 --- a/spec/services/compare_service_spec.rb +++ b/spec/services/compare_service_spec.rb @@ -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 |