Sha256: 19a5253b1dacb9578d39b4b4728d5c88d5b0504bfd9c8cea66674511557e5bc8

Contents?: true

Size: 330 Bytes

Versions: 3

Compression:

Stored size: 330 Bytes

Contents

###
# In our specs, I want to make sure time gets mocked so I can accurately test
# times displayed to the user.
#
class PBTimeTester
  def self.now
    ::Time.now
  end
end

class ProgressBar
class Time
  class << self
    alias_method :old_now, :now

    def now(time = ::PBTimeTester)
      old_now(time)
    end
  end
end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-progressbar-1.7.5 spec/support/time.rb
ruby-progressbar-1.7.1 spec/support/time.rb
ruby-progressbar-1.7.0 spec/support/time.rb