summaryrefslogtreecommitdiff
path: root/spec/services/compare_service_spec.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-09-29 17:21:19 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-10-12 16:32:57 +0300
commit1bb64ec99476451d67463e3508b449aeea7e694f (patch)
tree2043afc55bdcaa0e5fe1e482c350873f902d7ebb /spec/services/compare_service_spec.rb
parentac4db38094f4a68a81b0a7570c5835f663c01cfd (diff)
downloadgitlab-ce-1bb64ec99476451d67463e3508b449aeea7e694f.tar.gz
Add spec for compare service
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/services/compare_service_spec.rb')
-rw-r--r--spec/services/compare_service_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/services/compare_service_spec.rb b/spec/services/compare_service_spec.rb
new file mode 100644
index 00000000000..d809f291b44
--- /dev/null
+++ b/spec/services/compare_service_spec.rb
@@ -0,0 +1,21 @@
+require 'spec_helper'
+
+describe CompareService, services: true do
+ let(:project) { create(:project) }
+ let(:user) { create(:user) }
+ let(:service) { described_class.new }
+
+ describe '#execute' do
+ context 'compare with base, like feature...fix' do
+ subject { service.execute(project, 'feature', project, 'fix', false) }
+
+ it { expect(subject.diffs.size).to eq(1) }
+ end
+
+ context 'straight compare, like feature..fix' do
+ subject { service.execute(project, 'feature', project, 'fix', true) }
+
+ it { expect(subject.diffs.size).to eq(3) }
+ end
+ end
+end