diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-05-17 18:00:13 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-05-17 18:00:13 +0000 |
commit | d1bce8ea75df00970f3d4a67587ceb64bf4ec905 (patch) | |
tree | bc6c9af3d218b0f32f75b19744e4314f05141be6 /spec/models/blob_viewer | |
parent | 17e799980f6aaa6b378469f3e237c713f293e079 (diff) | |
download | gitlab-ce-d1bce8ea75df00970f3d4a67587ceb64bf4ec905.tar.gz |
Add auxiliary blob viewer for CHANGELOG
Diffstat (limited to 'spec/models/blob_viewer')
-rw-r--r-- | spec/models/blob_viewer/changelog_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/models/blob_viewer/changelog_spec.rb b/spec/models/blob_viewer/changelog_spec.rb new file mode 100644 index 00000000000..9066c5a05ac --- /dev/null +++ b/spec/models/blob_viewer/changelog_spec.rb @@ -0,0 +1,27 @@ +require 'spec_helper' + +describe BlobViewer::Changelog, model: true do + include FakeBlobHelpers + + let(:project) { create(:project, :repository) } + let(:blob) { fake_blob(path: 'CHANGELOG') } + subject { described_class.new(blob) } + + describe '#render_error' do + context 'when there are no tags' do + before do + allow(project.repository).to receive(:tag_count).and_return(0) + end + + it 'returns :no_tags' do + expect(subject.render_error).to eq(:no_tags) + end + end + + context 'when there are tags' do + it 'returns nil' do + expect(subject.render_error).to be_nil + end + end + end +end |