summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorMarkus Koller <markus-koller@gmx.ch>2017-07-20 10:50:07 +0200
committerMarkus Koller <markus-koller@gmx.ch>2017-07-27 13:24:19 +0200
commitd27dec80ceb372a5aace7c69e3bdba841d1ed863 (patch)
treea85699a100afe8e46e26e025b9d17c4d97356f01 /spec/support
parent4d05e85375b81d94ef828c8c5544bf62a5abc024 (diff)
downloadgitlab-ce-d27dec80ceb372a5aace7c69e3bdba841d1ed863.tar.gz
Support custom directory in gitlab:backup:create task
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/stub_configuration.rb29
1 files changed, 22 insertions, 7 deletions
diff --git a/spec/support/stub_configuration.rb b/spec/support/stub_configuration.rb
index 80ecce92dc1..516f8878679 100644
--- a/spec/support/stub_configuration.rb
+++ b/spec/support/stub_configuration.rb
@@ -4,9 +4,9 @@ module StubConfiguration
# Stubbing both of these because we're not yet consistent with how we access
# current application settings
- allow_any_instance_of(ApplicationSetting).to receive_messages(messages)
+ allow_any_instance_of(ApplicationSetting).to receive_messages(to_settings(messages))
allow(Gitlab::CurrentSettings.current_application_settings)
- .to receive_messages(messages)
+ .to receive_messages(to_settings(messages))
end
def stub_not_protect_default_branch
@@ -15,23 +15,27 @@ module StubConfiguration
end
def stub_config_setting(messages)
- allow(Gitlab.config.gitlab).to receive_messages(messages)
+ allow(Gitlab.config.gitlab).to receive_messages(to_settings(messages))
end
def stub_gravatar_setting(messages)
- allow(Gitlab.config.gravatar).to receive_messages(messages)
+ allow(Gitlab.config.gravatar).to receive_messages(to_settings(messages))
end
def stub_incoming_email_setting(messages)
- allow(Gitlab.config.incoming_email).to receive_messages(messages)
+ allow(Gitlab.config.incoming_email).to receive_messages(to_settings(messages))
end
def stub_mattermost_setting(messages)
- allow(Gitlab.config.mattermost).to receive_messages(messages)
+ allow(Gitlab.config.mattermost).to receive_messages(to_settings(messages))
end
def stub_omniauth_setting(messages)
- allow(Gitlab.config.omniauth).to receive_messages(messages)
+ allow(Gitlab.config.omniauth).to receive_messages(to_settings(messages))
+ end
+
+ def stub_backup_setting(messages)
+ allow(Gitlab.config.backup).to receive_messages(to_settings(messages))
end
private
@@ -54,4 +58,15 @@ module StubConfiguration
messages[predicate.to_sym] = messages[key.to_sym]
end
end
+
+ # Support nested hashes by converting all values into Settingslogic objects
+ def to_settings(hash)
+ hash.transform_values do |value|
+ if value.is_a? Hash
+ Settingslogic.new(value.deep_stringify_keys)
+ else
+ value
+ end
+ end
+ end
end