diff options
author | Nick Thomas <nick@gitlab.com> | 2018-02-19 11:39:54 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-02-19 11:39:54 +0000 |
commit | 4ff5b76689de5498b1aa5379b9551d6d35330354 (patch) | |
tree | 885c5a366b6c320e4d1be025fce071dde65ae11b /spec | |
parent | 53f290b6f7802b6b56e36a1339100c0e67030b1c (diff) | |
parent | 46e6a9f8a0f2dc0ae4e3152646f319a7cb5abcb2 (diff) | |
download | gitlab-ce-4ff5b76689de5498b1aa5379b9551d6d35330354.tar.gz |
Merge branch 'sh-guard-read-only-user-updates' into 'master'
Don't attempt to update user tracked fields if database is in read-only
Closes gitlab-ee#4972
See merge request gitlab-org/gitlab-ce!17200
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/user_spec.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 1815696a8a0..3531de244bd 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -496,6 +496,14 @@ describe User do user2.update_tracked_fields!(request) end.to change { user2.reload.current_sign_in_at } end + + it 'does not write if the DB is in read-only mode' do + expect(Gitlab::Database).to receive(:read_only?).and_return(true) + + expect do + user.update_tracked_fields!(request) + end.not_to change { user.reload.current_sign_in_at } + end end shared_context 'user keys' do |