Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2019-03-18 16:32:26 +0300
committerRémy Coutable <remy@rymai.me>2019-04-04 12:06:11 +0300
commitf37f28b962376843e7682dad15067edb131ecdd8 (patch)
tree9ffc89724cfc6d03123c152ea2b0c7f60d7ec72c /spec/models/application_setting_spec.rb
parenta6e9175fdd7790cc433ba49a85eaadbf75a3c8e9 (diff)
Fix race cond. in ApplicationSettingImplementation.create_from_defaults
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/models/application_setting_spec.rb')
-rw-r--r--spec/models/application_setting_spec.rb9
1 files changed, 4 insertions, 5 deletions
diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb
index c5579dafb4a..c81572d739e 100644
--- a/spec/models/application_setting_spec.rb
+++ b/spec/models/application_setting_spec.rb
@@ -6,6 +6,7 @@ describe ApplicationSetting do
let(:setting) { described_class.create_from_defaults }
it { include(CacheableAttributes) }
+ it { include(ApplicationSettingImplementation) }
it { expect(described_class.current_without_cache).to eq(described_class.last) }
it { expect(setting).to be_valid }
@@ -286,12 +287,10 @@ describe ApplicationSetting do
end
context 'restrict creating duplicates' do
- before do
- described_class.create_from_defaults
- end
+ let!(:current_settings) { described_class.create_from_defaults }
- it 'raises an record creation violation if already created' do
- expect { described_class.create_from_defaults }.to raise_error(ActiveRecord::RecordNotUnique)
+ it 'returns the current settings' do
+ expect(described_class.create_from_defaults).to eq(current_settings)
end
end