From 183c94dd638ab4306948733b68eccf35a6372dd1 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Mon, 10 Sep 2018 14:01:20 -0700 Subject: Work around migration specs failing due to repository storages not being selected Migration specs may be missing a column necessary to create an ApplicationSetting object, which causes the FakeApplicationSetting to be initialized. However, the project selects a random repository storage via ApplicationSetting#pick_repository_storage, which isn't present in the OpenStruct. To workaround this issues, we add a pick_repository_storage method in FakeApplicationSetting. --- lib/gitlab/fake_application_settings.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/gitlab/fake_application_settings.rb b/lib/gitlab/fake_application_settings.rb index bb14a8cd9e7..753160cc562 100644 --- a/lib/gitlab/fake_application_settings.rb +++ b/lib/gitlab/fake_application_settings.rb @@ -11,6 +11,10 @@ module Gitlab FakeApplicationSettings.define_predicate_methods(options) end + def pick_repository_storage + repository_storages.sample + end + # Mimic ActiveRecord predicate methods for boolean values def self.define_predicate_methods(options) options.each do |key, value| -- cgit v1.2.1