Commit 70799b05 authored by Stan Hu's avatar Stan Hu

Add additional stub methods for FakeApplicationSetting

In a migration spec, a default ApplicationSetting object may fail to
create due to an unknown attribute and fall back to
FakeApplicationSetting.  FakeApplicationSetting appears to be missing a
number of methods that are needed
(https://gitlab.com/gitlab-org/gitlab-ce/issues/47491). This commit adds
the ones needed to make an EE spec pass.

Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/7543
parent 2f990e34
......@@ -5,16 +5,6 @@
# column type without parsing db/schema.rb.
module Gitlab
class FakeApplicationSettings < OpenStruct
def initialize(options = {})
super
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|
......@@ -27,5 +17,23 @@ module Gitlab
end
end
end
def initialize(options = {})
super
FakeApplicationSettings.define_predicate_methods(options)
end
def key_restriction_for(type)
0
end
def allowed_key_types
ApplicationSetting::SUPPORTED_KEY_TYPES
end
def pick_repository_storage
repository_storages.sample
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment