diff options
author | Matija Čupić <matteeyah@gmail.com> | 2018-09-07 22:37:37 +0200 |
---|---|---|
committer | Matija Čupić <matteeyah@gmail.com> | 2018-09-07 22:37:37 +0200 |
commit | 6a8133b943a8e06571f5497bea0f36c236b2bf90 (patch) | |
tree | 6541b565978f9571cbc41c42a8cfac34ac86c54f /lib | |
parent | 3af363ecb2cdc764bb9034e81c7159f65c19cb44 (diff) | |
download | gitlab-ce-6a8133b943a8e06571f5497bea0f36c236b2bf90.tar.gz |
Stub http request on specs intead of mocking HTTParty
CE mirror of bb2a9fde8e6a4d1df13638fe336f641b9c72ef59
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/ci/external/file/remote.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/gitlab/ci/external/file/remote.rb b/lib/gitlab/ci/external/file/remote.rb index aa089860525..e728e3de77d 100644 --- a/lib/gitlab/ci/external/file/remote.rb +++ b/lib/gitlab/ci/external/file/remote.rb @@ -3,6 +3,7 @@ module Gitlab module External module File class Remote + include Gitlab::Utils::StrongMemoize attr_reader :location def initialize(location, opts = {}) @@ -16,11 +17,13 @@ module Gitlab def content return @content if defined?(@content) - @content ||= begin - HTTParty.get(location) - rescue HTTParty::Error, Timeout::Error - false - end + @content = strong_memoize(:content) do + begin + HTTParty.get(location) + rescue HTTParty::Error, Timeout::Error + false + end + end end end end |