Sha256: 59c1abd260afa3d110dd73f0b5861798b18da8cbf84118e46b377c938351e074

Contents?: true

Size: 321 Bytes

Versions: 62

Compression:

Stored size: 321 Bytes

Contents

class Time
  class << self
    def now_with_fixed_time
      if @fixed_time
        @fixed_time.dup
      else
        now_without_fixed_time
      end
    end
    alias_method_chain :now, :fixed_time

    def fix(time = Time.now)
      @fixed_time = time
      yield
    ensure
      @fixed_time = nil
    end
  end
end

Version data entries

62 entries across 62 versions & 2 rubygems

Version Path
rack-oauth2-0.9.0.alpha spec/helpers/time.rb
rack-oauth2-0.8.7 spec/helpers/time.rb
rack-oauth2-0.8.6 spec/helpers/time.rb
rack-oauth2-0.8.5 spec/helpers/time.rb
rack-oauth2-0.8.4 spec/helpers/time.rb
rack-oauth2-0.8.3 spec/helpers/time.rb
rack-oauth2-0.8.2 spec/helpers/time.rb
rack-oauth2-0.8.1 spec/helpers/time.rb
rack-oauth2-0.8.0 spec/helpers/time.rb
rack-oauth2-0.8.0.alpha spec/helpers/time.rb
rack-oauth2-0.7.0 spec/helpers/time.rb
rack-oauth2-0.6.9 spec/helpers/time.rb
rack-oauth2-0.6.8 spec/helpers/time.rb
rack-oauth2-0.6.7 spec/helpers/time.rb
rack-oauth2-0.6.6 spec/helpers/time.rb
rack-oauth2-0.6.5 spec/helpers/time.rb
rack-oauth2-0.6.4 spec/helpers/time.rb
rack-oauth2-0.6.3 spec/helpers/time.rb
rack-oauth2-0.6.2 spec/helpers/time.rb
rack-oauth2-0.6.1 spec/helpers/time.rb