2019-07-25 01:24:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-08-29 03:56:52 -04:00
|
|
|
require 'spec_helper'
|
2018-03-16 08:19:46 -04:00
|
|
|
|
2020-06-03 14:08:28 -04:00
|
|
|
RSpec.describe 'read-only message' do
|
2020-02-26 13:09:24 -05:00
|
|
|
let_it_be(:user) { create(:user) }
|
2018-03-16 08:19:46 -04:00
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
2020-11-02 04:08:35 -05:00
|
|
|
context 'when database is read-only' do
|
|
|
|
before do
|
|
|
|
allow(Gitlab::Database).to receive(:read_only?).and_return(true)
|
|
|
|
end
|
2018-03-16 08:19:46 -04:00
|
|
|
|
2020-11-02 04:08:35 -05:00
|
|
|
it_behaves_like 'Read-only instance', /You are on a read\-only GitLab instance./
|
2018-03-16 08:19:46 -04:00
|
|
|
end
|
|
|
|
|
2020-11-02 04:08:35 -05:00
|
|
|
context 'when database is in read-write mode' do
|
|
|
|
before do
|
|
|
|
allow(Gitlab::Database).to receive(:read_only?).and_return(false)
|
|
|
|
end
|
2018-03-16 08:19:46 -04:00
|
|
|
|
2020-11-02 04:08:35 -05:00
|
|
|
it_behaves_like 'Read-write instance', /You are on a read\-only GitLab instance./
|
2018-03-16 08:19:46 -04:00
|
|
|
end
|
|
|
|
end
|