summaryrefslogtreecommitdiff
path: root/spec/models/blob_viewer/changelog_spec.rb
blob: 5346483cfc8606b2451240b4932428096d276fd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe BlobViewer::Changelog 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