summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/diff/parallel_diff_spec.rb
blob: 1c5bbc47120477528e573b0d3530bafed7866bb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'spec_helper'

describe Gitlab::Diff::ParallelDiff, lib: true do
  include RepoHelpers

  let(:project) { create(:project) }
  let(:repository) { project.repository }
  let(:commit) { project.commit(sample_commit.id) }
  let(:diffs) { commit.diffs }
  let(:diff) { diffs.first }
  let(:diff_refs) { [commit.parent, commit] }
  let(:diff_file) { Gitlab::Diff::File.new(diff, diff_refs) }
  subject { described_class.new(diff_file) }

  let(:parallel_diff_result_array) { YAML.load_file("#{Rails.root}/spec/fixtures/parallel_diff_result.yml") }

  describe '#parallelize' do
    it 'should return an array of arrays containing the parsed diff' do
      expect(subject.parallelize).to match_array(parallel_diff_result_array)
    end
  end
end