2021-03-11 19:13:27 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe DiffFileMetadataEntity do
|
|
|
|
let(:merge_request) { create(:merge_request_with_diffs) }
|
2021-10-27 15:23:28 +05:30
|
|
|
let(:diff_file) { merge_request.merge_request_diff.diffs.raw_diff_files.first }
|
|
|
|
let(:options) { {} }
|
|
|
|
let(:entity) { described_class.new(diff_file, options) }
|
2021-03-11 19:13:27 +05:30
|
|
|
|
|
|
|
context 'as json' do
|
|
|
|
subject { entity.as_json }
|
|
|
|
|
|
|
|
it 'exposes the expected fields' do
|
|
|
|
expect(subject.keys).to contain_exactly(
|
|
|
|
:added_lines,
|
|
|
|
:removed_lines,
|
|
|
|
:new_path,
|
|
|
|
:old_path,
|
|
|
|
:new_file,
|
|
|
|
:deleted_file,
|
|
|
|
:submodule,
|
|
|
|
:file_identifier_hash,
|
2021-10-27 15:23:28 +05:30
|
|
|
:file_hash,
|
|
|
|
:conflict_type
|
2021-03-11 19:13:27 +05:30
|
|
|
)
|
|
|
|
end
|
2021-10-27 15:23:28 +05:30
|
|
|
|
|
|
|
it_behaves_like 'diff file with conflict_type'
|
2021-03-11 19:13:27 +05:30
|
|
|
end
|
|
|
|
end
|