2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
require 'spec_helper'
|
2018-05-09 12:01:36 +05:30
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
RSpec.describe 'read-only message', feature_category: :database do
|
2020-04-08 14:13:33 +05:30
|
|
|
let_it_be(:user) { create(:user) }
|
2018-05-09 12:01:36 +05:30
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
context 'when database is read-only' do
|
|
|
|
before do
|
|
|
|
allow(Gitlab::Database).to receive(:read_only?).and_return(true)
|
|
|
|
end
|
2018-05-09 12:01:36 +05:30
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
it_behaves_like 'Read-only instance', /You are on a read-only GitLab instance./
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
context 'when database is in read-write mode' do
|
|
|
|
before do
|
|
|
|
allow(Gitlab::Database).to receive(:read_only?).and_return(false)
|
|
|
|
end
|
2018-05-09 12:01:36 +05:30
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
it_behaves_like 'Read-write instance', /You are on a read-only GitLab instance./
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|
|
|
|
end
|