diff options
author | Toon Claes <toon@gitlab.com> | 2018-03-16 13:19:46 +0100 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2018-03-22 20:34:45 +0100 |
commit | 9ab43aa762d2f0b69a400da0d9e992f232179002 (patch) | |
tree | 636208c45423b56f5018dbc6686fce98a42af894 /spec/features/read_only_spec.rb | |
parent | c920d165f544d6c45a7cc357fcf330f48c10244c (diff) | |
download | gitlab-ce-9ab43aa762d2f0b69a400da0d9e992f232179002.tar.gz |
Add read-only banner to all pages
When the database is in a read-only state, display a banner on each
page informing the user they cannot write to that GitLab instance.
Closes gitlab-org/gitlab-ce#43937.
Diffstat (limited to 'spec/features/read_only_spec.rb')
-rw-r--r-- | spec/features/read_only_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/features/read_only_spec.rb b/spec/features/read_only_spec.rb new file mode 100644 index 00000000000..8bfaf558466 --- /dev/null +++ b/spec/features/read_only_spec.rb @@ -0,0 +1,25 @@ +require 'rails_helper' + +describe 'read-only message' do + set(:user) { create(:user) } + + before do + sign_in(user) + end + + it 'shows read-only banner when database is read-only' do + allow(Gitlab::Database).to receive(:read_only?).and_return(true) + + visit root_dashboard_path + + expect(page).to have_content('You are on a read-only GitLab instance.') + end + + it 'does not show read-only banner when database is able to read-write' do + allow(Gitlab::Database).to receive(:read_only?).and_return(false) + + visit root_dashboard_path + + expect(page).not_to have_content('You are on a read-only GitLab instance.') + end +end |