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-1.2.1 spec/helpers/time.rb
rack-oauth2-1.2.0 spec/helpers/time.rb
rack-oauth2-1.1.1 spec/helpers/time.rb
rack-oauth2-1.1.0 spec/helpers/time.rb
rack-oauth2-1.0.10 spec/helpers/time.rb
rack-oauth2-1.0.9 spec/helpers/time.rb
rack-oauth2-1.0.8 spec/helpers/time.rb
rack-oauth2-revibe-1.0.7 spec/helpers/time.rb
rack-oauth2-1.0.7 spec/helpers/time.rb
rack-oauth2-1.0.6 spec/helpers/time.rb
rack-oauth2-1.0.5 spec/helpers/time.rb
rack-oauth2-1.0.4 spec/helpers/time.rb
rack-oauth2-1.0.3 spec/helpers/time.rb
rack-oauth2-1.0.2 spec/helpers/time.rb
rack-oauth2-1.0.1 spec/helpers/time.rb
rack-oauth2-1.0.0 spec/helpers/time.rb
rack-oauth2-0.14.9 spec/helpers/time.rb
rack-oauth2-0.14.8 spec/helpers/time.rb
rack-oauth2-0.14.7 spec/helpers/time.rb
rack-oauth2-0.14.6 spec/helpers/time.rb