diff options
author | http://jneen.net/ <jneen@jneen.net> | 2016-06-16 11:07:22 -0700 |
---|---|---|
committer | http://jneen.net/ <jneen@jneen.net> | 2016-06-27 14:17:49 -0700 |
commit | cd9bea770bd8a1e4b6590ba93a15f4ff75529f11 (patch) | |
tree | 69a0fcb6734236cd618c8022fc51793cfa4bbe8b | |
parent | 8d24ca157dc88b773b05ac084ab9edbf2b90dd39 (diff) | |
download | gitlab-ce-cd9bea770bd8a1e4b6590ba93a15f4ff75529f11.tar.gz |
fix the spec, using project.change_head
-rw-r--r-- | spec/lib/gitlab/highlight_spec.rb | 12 | ||||
-rw-r--r-- | spec/support/test_env.rb | 1 |
2 files changed, 10 insertions, 3 deletions
diff --git a/spec/lib/gitlab/highlight_spec.rb b/spec/lib/gitlab/highlight_spec.rb index 303943606ff..9c54e53f402 100644 --- a/spec/lib/gitlab/highlight_spec.rb +++ b/spec/lib/gitlab/highlight_spec.rb @@ -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 diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb index 498bd4bf800..8246be357a5 100644 --- a/spec/support/test_env.rb +++ b/spec/support/test_env.rb @@ -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 |