diff options
author | Sean McGivern <sean@gitlab.com> | 2016-07-27 12:42:18 +0100 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2016-08-12 23:24:43 +0300 |
commit | a1c79612172ce07c7b0de4c01fba8fa7369c71de (patch) | |
tree | fb8ad8e663fe2d30f43a2b0453d66fda6ce05301 /spec/lib/gitlab/conflict/file_spec.rb | |
parent | df2ed097b730c8ba0b79cac8cc3dbfcb0cf587cb (diff) | |
download | gitlab-ce-a1c79612172ce07c7b0de4c01fba8fa7369c71de.tar.gz |
Handle multiple merge conflict files in collection
Diffstat (limited to 'spec/lib/gitlab/conflict/file_spec.rb')
-rw-r--r-- | spec/lib/gitlab/conflict/file_spec.rb | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/spec/lib/gitlab/conflict/file_spec.rb b/spec/lib/gitlab/conflict/file_spec.rb index 318d0d249d6..a9f2fed83aa 100644 --- a/spec/lib/gitlab/conflict/file_spec.rb +++ b/spec/lib/gitlab/conflict/file_spec.rb @@ -4,24 +4,21 @@ describe Gitlab::Conflict::File, lib: true do let(:project) { create(:project) } let(:repository) { project.repository } let(:rugged) { repository.rugged } - let(:their_ref) { their_commit.oid } let(:their_commit) { rugged.branches['conflict-a'].target } - let(:our_ref) { our_commit.oid } + let(:diff_refs) { Gitlab::Diff::DiffRefs.new(base_sha: their_commit.oid, head_sha: our_commit.oid) } let(:our_commit) { rugged.branches['conflict-b'].target } let(:index) { rugged.merge_commits(our_commit, their_commit) } let(:conflict) { index.conflicts.last } - let(:merge_file) { index.merge_file('files/ruby/regex.rb') } - let(:conflict_file) { Gitlab::Conflict::File.new(merge_file, conflict, their_ref, our_ref, repository) } + let(:merge_file_result) { index.merge_file('files/ruby/regex.rb') } + let(:conflict_file) { Gitlab::Conflict::File.new(merge_file_result, conflict, diff_refs: diff_refs, repository: repository) } describe '#highlighted_lines' do def html_to_text(html) - CGI.unescapeHTML(ActionView::Base.full_sanitizer.sanitize(html)) + CGI.unescapeHTML(ActionView::Base.full_sanitizer.sanitize(html)).delete("\n") end it 'returns lines with rich_text' do - conflict_file.highlighted_lines.each do |line| - expect(line).to have_attributes(rich_text: an_instance_of(String)) - end + expect(conflict_file.highlighted_lines).to all(have_attributes(rich_text: a_kind_of(String))) end it 'returns lines with rich_text matching the text content of the line' do |