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.
This commit is contained in:
Stan Hu 2018-09-10 14:01:20 -07:00
parent 3bf1cd5780
commit 183c94dd63
1 changed files with 4 additions and 0 deletions

View File

@ -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|