summaryrefslogtreecommitdiff
path: root/lib/gitlab/utils.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-08-15 21:32:36 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-08-15 21:32:36 +0800
commitce641335167230d288fbb2ec277548acbaff9dd7 (patch)
tree558c3a2c7bdded443da9229365a68c4308841c11 /lib/gitlab/utils.rb
parent0ea81ae50a702c7341b1bd6fd15002ee78ac4964 (diff)
downloadgitlab-ce-ce641335167230d288fbb2ec277548acbaff9dd7.tar.gz
Introduce Gitlab::Utils.now so that it's easier to stub
Diffstat (limited to 'lib/gitlab/utils.rb')
-rw-r--r--lib/gitlab/utils.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/gitlab/utils.rb b/lib/gitlab/utils.rb
index d13fe0ef8a9..4d1bd16eb95 100644
--- a/lib/gitlab/utils.rb
+++ b/lib/gitlab/utils.rb
@@ -7,11 +7,16 @@ module Gitlab
# @param cmd [Array<String>]
# @return [Boolean]
def system_silent(cmd)
- Popen::popen(cmd).last.zero?
+ Popen.popen(cmd).last.zero?
end
def force_utf8(str)
str.force_encoding(Encoding::UTF_8)
end
+
+ # The same as Time.now but using this would make it easier to test
+ def now
+ Time.now
+ end
end
end