2019-03-30 03:23:56 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-05-08 19:50:23 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 14:09:03 -04:00
|
|
|
RSpec.describe BlobViewer::RouteMap do
|
2017-05-08 19:50:23 -04:00
|
|
|
include FakeBlobHelpers
|
|
|
|
|
2017-08-02 15:55:11 -04:00
|
|
|
let(:project) { build_stubbed(:project) }
|
2017-05-08 19:50:23 -04:00
|
|
|
let(:data) do
|
|
|
|
<<-MAP.strip_heredoc
|
|
|
|
# Team data
|
|
|
|
- source: 'data/team.yml'
|
|
|
|
public: 'team/'
|
|
|
|
MAP
|
|
|
|
end
|
2020-08-10 23:11:00 -04:00
|
|
|
|
2017-05-08 19:50:23 -04:00
|
|
|
let(:blob) { fake_blob(path: '.gitlab/route-map.yml', data: data) }
|
2019-12-18 19:08:01 -05:00
|
|
|
|
2017-05-08 19:50:23 -04:00
|
|
|
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
|