debian-mirror-gitlab/spec/models/blob_viewer/route_map_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
942 B
Ruby
Raw Permalink Normal View History

2019-07-07 11:18:12 +05:30
# frozen_string_literal: true
2017-09-10 17:25:29 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe BlobViewer::RouteMap do
2017-09-10 17:25:29 +05:30
include FakeBlobHelpers
let(:project) { build_stubbed(:project) }
let(:data) do
<<-MAP.strip_heredoc
# Team data
- source: 'data/team.yml'
public: 'team/'
MAP
end
2020-10-24 23:57:45 +05:30
2017-09-10 17:25:29 +05:30
let(:blob) { fake_blob(path: '.gitlab/route-map.yml', data: data) }
2020-03-13 15:44:24 +05:30
2017-09-10 17:25:29 +05:30
subject { described_class.new(blob) }
describe '#validation_message' do
it 'calls prepare! on the viewer' do
expect(subject).to receive(:prepare!)
subject.validation_message
end
context 'when the configuration is valid' do
it 'returns nil' do
expect(subject.validation_message).to be_nil
end
end
context 'when the configuration is invalid' do
let(:data) { 'oof' }
it 'returns the error message' do
expect(subject.validation_message).to eq('Route map is not an array')
end
end
end
end