diff options
author | Sean McGivern <sean@gitlab.com> | 2016-08-03 14:02:20 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2016-08-12 23:24:47 +0300 |
commit | e50e88b85c54097db22d571cfc76fcef143e1d01 (patch) | |
tree | 5f7a0aa06e80eebf965f7474d66415a247660da6 /spec/lib/gitlab/conflict | |
parent | 3cc07e7e391a995361bb2523fef5e092570643f3 (diff) |
Add blob_path to conflict file JSON
Diffstat (limited to 'spec/lib/gitlab/conflict')
-rw-r--r-- | spec/lib/gitlab/conflict/file_spec.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/spec/lib/gitlab/conflict/file_spec.rb b/spec/lib/gitlab/conflict/file_spec.rb index 290640ced49..a57ca70672b 100644 --- a/spec/lib/gitlab/conflict/file_spec.rb +++ b/spec/lib/gitlab/conflict/file_spec.rb @@ -6,10 +6,11 @@ describe Gitlab::Conflict::File, lib: true do let(:rugged) { repository.rugged } let(:their_commit) { rugged.branches['conflict-a'].target } let(:our_commit) { rugged.branches['conflict-b'].target } + let(:merge_request) { create(:merge_request, source_branch: 'conflict-b', target_branch: 'conflict-a', source_project: project) } let(:index) { rugged.merge_commits(our_commit, their_commit) } let(:conflict) { index.conflicts.last } let(:merge_file_result) { index.merge_file('files/ruby/regex.rb') } - let(:conflict_file) { Gitlab::Conflict::File.new(merge_file_result, conflict, repository: repository) } + let(:conflict_file) { Gitlab::Conflict::File.new(merge_file_result, conflict, merge_request: merge_request) } describe '#resolve_lines' do let(:section_keys) { conflict_file.sections.map { |section| section[:id] }.compact } @@ -141,4 +142,11 @@ describe Gitlab::Conflict::File, lib: true do expect(section_ids.uniq).to eq(section_ids) end end + + describe '#as_json' do + it 'includes the blob path for the file' do + expect(conflict_file.as_json[:blob_path]). + to eq("/#{project.namespace.to_param}/#{merge_request.project.to_param}/blob/#{our_commit.oid}/files/ruby/regex.rb") + end + end end |