diff options
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/blob_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/models/blob_spec.rb b/spec/models/blob_spec.rb index 81e35e6c931..da3b29dffb6 100644 --- a/spec/models/blob_spec.rb +++ b/spec/models/blob_spec.rb @@ -224,6 +224,22 @@ describe Blob do end end + describe '#language_from_gitattributes' do + subject(:blob) { fake_blob(path: 'file.md') } + + it 'returns return value from gitattribute' do + expect(blob.project.repository).to receive(:gitattribute).with(blob.path, 'gitlab-language').and_return('erb?parent=json') + + expect(blob.language_from_gitattributes).to eq('erb?parent=json') + end + + it 'returns nil if project is absent' do + allow(blob).to receive(:project).and_return(nil) + + expect(blob.language_from_gitattributes).to eq(nil) + end + end + describe '#simple_viewer' do context 'when the blob is empty' do it 'returns an empty viewer' do |