summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-02-14 19:17:36 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-02-15 15:31:51 +0800
commit696a5da7fd78093567ae2bc7a795a38462dd7b3d (patch)
tree27a31a60b7112a41183f90b609e5f04322ec0891
parentd2d30cff552e08c4b7ec2b5e23acced8eb29cbcb (diff)
downloadgitlab-ce-696a5da7fd78093567ae2bc7a795a38462dd7b3d.tar.gz
ApplicationSetting.current doesn't work well in tests
Therefore we prefer `Gitlab::CurrentSettings.current_application_settings` and fix the tests by setting default_artifacts_expire_in to 0 to restore the original behaviour.
-rw-r--r--app/models/ci/build.rb3
-rw-r--r--spec/requests/ci/api/builds_spec.rb2
2 files changed, 4 insertions, 1 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 77f027d17b6..d14f025aeaa 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -518,7 +518,8 @@ module Ci
if expire_in
expire_in
else
- ApplicationSetting.current.default_artifacts_expire_in
+ Gitlab::CurrentSettings.current_application_settings
+ .default_artifacts_expire_in
end
self.artifacts_expire_in = value
diff --git a/spec/requests/ci/api/builds_spec.rb b/spec/requests/ci/api/builds_spec.rb
index d85afdeab42..44f69bff30d 100644
--- a/spec/requests/ci/api/builds_spec.rb
+++ b/spec/requests/ci/api/builds_spec.rb
@@ -638,6 +638,8 @@ describe Ci::API::Builds do
end
before do
+ stub_application_setting(default_artifacts_expiration: 0)
+
post(post_url, post_data, headers_with_token)
end