Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-04-15 01:56:02 +0300
committerOswaldo Ferreira <>2019-04-19 04:01:51 +0300
commit1ac4b24dd3153acd1fa7a66f6261911ee74ce734 (patch)
treec4cb80941ba25fd0b136f8e3c1193f861e4af89d /spec/services/compare_service_spec.rb
parent5d74c95c988cdd9c1c761de3a78c3dc191e4fe52 (diff)
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.
Diffstat (limited to 'spec/services/compare_service_spec.rb')
-rw-r--r--spec/services/compare_service_spec.rb13
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