Class: Gitlab::FakeApplicationSettings

Inherits:
OpenStruct
  • Object
show all
Includes:
ApplicationSettingImplementation
Defined in:
lib/gitlab/fake_application_settings.rb

Constant Summary

Constants included from ApplicationSettingImplementation

ApplicationSettingImplementation::DEFAULT_MINIMUM_PASSWORD_LENGTH, ApplicationSettingImplementation::DEFAULT_PROTECTED_PATHS, ApplicationSettingImplementation::FORBIDDEN_KEY_VALUE, ApplicationSettingImplementation::STRING_LIST_SEPARATOR, ApplicationSettingImplementation::SUPPORTED_KEY_TYPES

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ApplicationSettingImplementation

#add_to_outbound_local_requests_whitelist, #allow_signup?, #allowed_key_types, #archive_builds_older_than, #asset_proxy_whitelist=, #commit_email_hostname, #default_group_visibility=, #default_project_visibility=, #default_snippet_visibility=, #disabled_oauth_sign_in_sources=, #domain_blacklist_file=, #domain_blacklist_raw, #domain_blacklist_raw=, #domain_whitelist_raw, #domain_whitelist_raw=, #health_check_access_token, #help_page_support_url_column_exists?, #home_page_url_column_exists?, #key_restriction_for, #latest_terms, #normalized_repository_storage_weights, #outbound_local_requests_whitelist_arrays, #outbound_local_requests_whitelist_raw, #outbound_local_requests_whitelist_raw=, #password_authentication_enabled?, #performance_bar_allowed_group, #performance_bar_enabled, #pick_repository_storage, #protected_paths_raw, #protected_paths_raw=, #repository_storages, #repository_storages_weighted, #reset_memoized_terms, #restricted_visibility_levels=, #runners_registration_token, #static_objects_external_storage_enabled?, #usage_ping_can_be_configured?, #usage_ping_enabled, #user_default_internal_regex_enabled?, #user_default_internal_regex_instance, #web_ide_clientside_preview_bundler_url

Methods included from Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Constructor Details

#initialize(options = {}) ⇒ FakeApplicationSettings

Returns a new instance of FakeApplicationSettings.


25
26
27
28
29
# File 'lib/gitlab/fake_application_settings.rb', line 25

def initialize(options = {})
  super

  FakeApplicationSettings.define_predicate_methods(options)
end

Class Method Details

.define_predicate_methods(options) ⇒ Object

Mimic ActiveRecord predicate methods for boolean values


13
14
15
16
17
18
19
20
21
22
23
# File 'lib/gitlab/fake_application_settings.rb', line 13

def self.define_predicate_methods(options)
  options.each do |key, value|
    next if key.to_s.end_with?('?')
    next unless [true, false].include?(value)

    define_method "#{key}?" do
      actual_key = key.to_s.chomp('?')
      self[actual_key]
    end
  end
end