Commit cd9bea77 authored by http://jneen.net/'s avatar http://jneen.net/

fix the spec, using project.change_head

parent 8d24ca15
......@@ -4,6 +4,7 @@ describe Gitlab::Highlight, lib: true do
include RepoHelpers
let(:project) { create(:project) }
let(:repository) { project.repository }
let(:commit) { project.commit(sample_commit.id) }
describe '.highlight_lines' do
......@@ -19,13 +20,18 @@ describe Gitlab::Highlight, lib: true do
end
describe 'custom highlighting from .gitattributes' do
let(:blob) { project.blob_at_branch('master', 'custom-highlighting/test.gitlab-custom') }
let(:branch) { 'gitattributes' }
let(:path) { 'custom-highlighting/test.gitlab-custom' }
let(:blob) { repository.blob_at_branch(branch, path) }
let(:highlighter) {
Gitlab::Highlight.new(blob.path, blob.contents, repository: project.repository)
Gitlab::Highlight.new(blob.path, blob.data, repository: repository)
}
before { project.change_head('gitattributes') }
it 'highlights as ruby' do
expect(highlighter.lexer).to be_an_instance_of Rouge::Lexers::Ruby
expect(highlighter.lexer).to be Rouge::Lexers::Ruby
end
end
end
......@@ -17,6 +17,7 @@ module TestEnv
"'test'" => 'e56497b',
'orphaned-branch' => '45127a9',
'binary-encoding' => '7b1cf43',
'gitattributes' => '281d3a76'
}
# gitlab-test-fork is a fork of gitlab-fork, but we don't necessarily
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment