compare_service_spec.rb 585 Bytes
Newer Older
1 2
require 'spec_helper'

3
describe CompareService do
4
  let(:project) { create(:project, :repository) }
5
  let(:user) { create(:user) }
6
  let(:service) { described_class.new(project, 'feature') }
7 8 9

  describe '#execute' do
    context 'compare with base, like feature...fix' do
10
      subject { service.execute(project, 'fix', straight: false) }
11 12 13 14 15

      it { expect(subject.diffs.size).to eq(1) }
    end

    context 'straight compare, like feature..fix' do
16
      subject { service.execute(project, 'fix', straight: true) }
17 18 19 20 21

      it { expect(subject.diffs.size).to eq(3) }
    end
  end
end