diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-30 15:22:03 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-30 15:22:03 +0000 |
commit | 0cb369aa5f70b59e5922d8f5431a3302fd93574e (patch) | |
tree | d8ac59d000141ebe9f1f7eda188dd1d32ff7cc39 /spec/services | |
parent | b5e7de21d8f1d479f24826198e6e54920cc29598 (diff) | |
download | gitlab-ce-0cb369aa5f70b59e5922d8f5431a3302fd93574e.tar.gz |
Add latest changes from gitlab-org/security/gitlab@13-5-stable-ee
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/terraform/remote_state_handler_spec.rb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/spec/services/terraform/remote_state_handler_spec.rb b/spec/services/terraform/remote_state_handler_spec.rb index c47367feb14..ca392849d49 100644 --- a/spec/services/terraform/remote_state_handler_spec.rb +++ b/spec/services/terraform/remote_state_handler_spec.rb @@ -42,17 +42,17 @@ RSpec.describe Terraform::RemoteStateHandler do describe '#handle_with_lock' do it 'allows to modify a state using database locking' do - state = subject.handle_with_lock do |state| + record = nil + subject.handle_with_lock do |state| + record = state state.name = 'updated-name' end - expect(state.name).to eq 'updated-name' + expect(record.reload.name).to eq 'updated-name' end - it 'returns the state object itself' do - state = subject.handle_with_lock - - expect(state.name).to eq 'my-state' + it 'returns nil' do + expect(subject.handle_with_lock).to be_nil end end @@ -70,11 +70,13 @@ RSpec.describe Terraform::RemoteStateHandler do it 'handles a locked state using exclusive read lock' do handler.lock! - state = handler.handle_with_lock do |state| + record = nil + handler.handle_with_lock do |state| + record = state state.name = 'new-name' end - expect(state.name).to eq 'new-name' + expect(record.reload.name).to eq 'new-name' end it 'raises exception if lock has not been acquired before' do |