diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-08-15 16:32:36 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-08-15 16:32:36 +0300 |
commit | ce641335167230d288fbb2ec277548acbaff9dd7 (patch) | |
tree | 558c3a2c7bdded443da9229365a68c4308841c11 /lib/gitlab | |
parent | 0ea81ae50a702c7341b1bd6fd15002ee78ac4964 (diff) |
Introduce Gitlab::Utils.now so that it's easier to stub
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/utils.rb | 7 |
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 |