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
This commit is contained in:
parent
2f990e3408
commit
70799b05ab
|
@ -5,16 +5,6 @@
|
||||||
# column type without parsing db/schema.rb.
|
# column type without parsing db/schema.rb.
|
||||||
module Gitlab
|
module Gitlab
|
||||||
class FakeApplicationSettings < OpenStruct
|
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
|
# Mimic ActiveRecord predicate methods for boolean values
|
||||||
def self.define_predicate_methods(options)
|
def self.define_predicate_methods(options)
|
||||||
options.each do |key, value|
|
options.each do |key, value|
|
||||||
|
@ -27,5 +17,23 @@ module Gitlab
|
||||||
end
|
end
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue