2019-03-30 03:23:56 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-05-17 14:00:13 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-06-29 00:13:10 -04:00
|
|
|
describe BlobViewer::Changelog do
|
2017-05-17 14:00:13 -04:00
|
|
|
include FakeBlobHelpers
|
|
|
|
|
|
|
|
let(:project) { create(:project, :repository) }
|
|
|
|
let(:blob) { fake_blob(path: 'CHANGELOG') }
|
2019-12-18 19:08:01 -05:00
|
|
|
|
2017-05-17 14:00:13 -04:00
|
|
|
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
|