summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/conflict
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-11-17 17:57:48 +0000
committerSean McGivern <sean@gitlab.com>2017-11-17 17:57:48 +0000
commit64a9e53bd16092e869f88e42a3e69f3f4ba0a23e (patch)
tree0276365754d768dc70860901a8a396b861c36ac2 /spec/lib/gitlab/conflict
parent371180a47d292957b73c6c9e1e662b6c99a62ee9 (diff)
downloadgitlab-ce-64a9e53bd16092e869f88e42a3e69f3f4ba0a23e.tar.gz
Fix conflict highlightingfix-conflict-highlighting
Conflicts used to take a `Repository` and pass that to `Gitlab::Highlight.highlight`, which would call `#gitattribute` on the repository. Now they use a `Gitlab::Git::Repository`, which didn't have that method defined - but defining it on `Gitlab::Git::Repository` does make it available on `Repository` through `method_missing`, so we can do that and both cases will work.
Diffstat (limited to 'spec/lib/gitlab/conflict')
-rw-r--r--spec/lib/gitlab/conflict/file_spec.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/lib/gitlab/conflict/file_spec.rb b/spec/lib/gitlab/conflict/file_spec.rb
index bf981d2f6f6..92792144429 100644
--- a/spec/lib/gitlab/conflict/file_spec.rb
+++ b/spec/lib/gitlab/conflict/file_spec.rb
@@ -84,6 +84,13 @@ describe Gitlab::Conflict::File do
expect(line.text).to eq(html_to_text(line.rich_text))
end
end
+
+ # This spec will break if Rouge's highlighting changes, but we need to
+ # ensure that the lines are actually highlighted.
+ it 'highlights the lines correctly' do
+ expect(conflict_file.lines.first.rich_text)
+ .to eq("<span id=\"LC1\" class=\"line\" lang=\"ruby\"><span class=\"k\">module</span> <span class=\"nn\">Gitlab</span></span>\n")
+ end
end
describe '#sections' do