debian-mirror-gitlab/spec/lib/gitlab/pages/settings_spec.rb

51 lines
1.3 KiB
Ruby
Raw Normal View History

2020-10-24 23:57:45 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Pages::Settings do
2021-04-29 21:17:54 +05:30
let(:settings) { double(path: 'the path', local_store: 'local store') }
2020-10-24 23:57:45 +05:30
describe '#path' do
subject { described_class.new(settings).path }
it { is_expected.to eq('the path') }
2020-11-24 15:15:51 +05:30
context 'when running under a web server outside of test mode' do
2020-10-24 23:57:45 +05:30
before do
2020-11-24 15:15:51 +05:30
allow(::Gitlab::Runtime).to receive(:test_suite?).and_return(false)
2020-10-24 23:57:45 +05:30
allow(::Gitlab::Runtime).to receive(:web_server?).and_return(true)
end
2021-04-29 21:17:54 +05:30
it 'logs a DiskAccessDenied error' do
expect(Gitlab::ErrorTracking).to receive(:track_exception).with(
instance_of(described_class::DiskAccessDenied)
)
subject
end
end
context 'when local_store settings does not exist yet' do
before do
allow(Settings.pages).to receive(:local_store).and_return(nil)
2020-10-24 23:57:45 +05:30
end
2021-04-29 21:17:54 +05:30
it { is_expected.to eq('the path') }
end
context 'when local store exists but legacy storage is disabled' do
before do
allow(Settings.pages.local_store).to receive(:enabled).and_return(false)
end
it 'logs a DiskAccessDenied error' do
expect(Gitlab::ErrorTracking).to receive(:track_exception).with(
instance_of(described_class::DiskAccessDenied)
)
subject
end
end
end
2020-10-24 23:57:45 +05:30
end