diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2019-03-06 20:12:04 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2019-03-19 13:01:37 +0800 |
commit | 6b0d493350ed9288c4a68a35dbbb4a4b91bd9637 (patch) | |
tree | aabb183a119412a23607ee4490652e1d7de2fc4f /lib/gitlab/fake_application_settings.rb | |
parent | 3c5a81cb83e6022530e53b1b6cdedf94c92d980e (diff) | |
download | gitlab-ce-6b0d493350ed9288c4a68a35dbbb4a4b91bd9637.tar.gz |
Introduce ApplicationSettingImplementation yay
So the fake can enjoy it, too. We don't use `prepend`
because that'll require we change `allow_any_instance_of` to
`expect_next_instance_of`, but that's not very easy to do.
We can do that later.
Diffstat (limited to 'lib/gitlab/fake_application_settings.rb')
-rw-r--r-- | lib/gitlab/fake_application_settings.rb | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/lib/gitlab/fake_application_settings.rb b/lib/gitlab/fake_application_settings.rb index bd806269bf0..77f7d9490f3 100644 --- a/lib/gitlab/fake_application_settings.rb +++ b/lib/gitlab/fake_application_settings.rb @@ -7,6 +7,8 @@ # column type without parsing db/schema.rb. module Gitlab class FakeApplicationSettings < OpenStruct + include ApplicationSettingImplementation + # Mimic ActiveRecord predicate methods for boolean values def self.define_predicate_methods(options) options.each do |key, value| @@ -26,20 +28,7 @@ module Gitlab 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 - - def commit_email_hostname - super.presence || ApplicationSetting.default_commit_email_hostname - end + alias_method :read_attribute, :[] + alias_method :has_attribute?, :[] end end |