time-warp 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/core_ext/date.rb +13 -0
 - data/lib/core_ext/date_time.rb +12 -0
 - data/lib/core_ext/time.rb +20 -0
 - data/lib/core_ext.rb +3 -20
 - data/test/time_warp_test.rb +1 -1
 - metadata +8 -7
 
| 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ## 
         
     | 
| 
      
 2 
     | 
    
         
            +
            # Extend Time class to offset the time that 'now' returns.  This
         
     | 
| 
      
 3 
     | 
    
         
            +
            # provides the opening to "warp time" for any tests checking for
         
     | 
| 
      
 4 
     | 
    
         
            +
            # time-based limitations.  Perhaps one needs to check hourly
         
     | 
| 
      
 5 
     | 
    
         
            +
            # limits, common time borders like midnight, etc.
         
     | 
| 
      
 6 
     | 
    
         
            +
            if !Time.respond_to?(:real_now)  # assures there is no infinite looping when aliasing #now
         
     | 
| 
      
 7 
     | 
    
         
            +
              Time.class_eval do
         
     | 
| 
      
 8 
     | 
    
         
            +
                class << self
         
     | 
| 
      
 9 
     | 
    
         
            +
                  attr_accessor :testing_offset
         
     | 
| 
      
 10 
     | 
    
         
            +
                  
         
     | 
| 
      
 11 
     | 
    
         
            +
                  alias_method :real_now, :now
         
     | 
| 
      
 12 
     | 
    
         
            +
                  def now
         
     | 
| 
      
 13 
     | 
    
         
            +
                    real_now - testing_offset
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end
         
     | 
| 
      
 15 
     | 
    
         
            +
                  alias_method :new, :now
         
     | 
| 
      
 16 
     | 
    
         
            +
                  
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
| 
      
 20 
     | 
    
         
            +
            Time.testing_offset = 0
         
     | 
    
        data/lib/core_ext.rb
    CHANGED
    
    | 
         @@ -1,20 +1,3 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            # time-based limitations.  Perhaps one needs to check hourly
         
     | 
| 
       5 
     | 
    
         
            -
            # limits, common time borders like midnight, etc.
         
     | 
| 
       6 
     | 
    
         
            -
            if !Time.respond_to?(:real_now)  # assures there is no infinite looping when aliasing #now
         
     | 
| 
       7 
     | 
    
         
            -
              Time.class_eval do
         
     | 
| 
       8 
     | 
    
         
            -
                class << self
         
     | 
| 
       9 
     | 
    
         
            -
                  attr_accessor :testing_offset
         
     | 
| 
       10 
     | 
    
         
            -
                  
         
     | 
| 
       11 
     | 
    
         
            -
                  alias_method :real_now, :now
         
     | 
| 
       12 
     | 
    
         
            -
                  def now
         
     | 
| 
       13 
     | 
    
         
            -
                    real_now - testing_offset
         
     | 
| 
       14 
     | 
    
         
            -
                  end
         
     | 
| 
       15 
     | 
    
         
            -
                  alias_method :new, :now
         
     | 
| 
       16 
     | 
    
         
            -
                  
         
     | 
| 
       17 
     | 
    
         
            -
                end
         
     | 
| 
       18 
     | 
    
         
            -
              end
         
     | 
| 
       19 
     | 
    
         
            -
            end
         
     | 
| 
       20 
     | 
    
         
            -
            Time.testing_offset = 0
         
     | 
| 
      
 1 
     | 
    
         
            +
            require File.join File.dirname(__FILE__), 'core_ext/time'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require File.join File.dirname(__FILE__), 'core_ext/date'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require File.join File.dirname(__FILE__), 'core_ext/date_time'
         
     | 
    
        data/test/time_warp_test.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,13 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: time-warp
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              hash:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 5
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 1
         
     | 
| 
       8 
8 
     | 
    
         
             
              - 0
         
     | 
| 
       9 
     | 
    
         
            -
              -  
     | 
| 
       10 
     | 
    
         
            -
              version: 1.0. 
     | 
| 
      
 9 
     | 
    
         
            +
              - 9
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 1.0.9
         
     | 
| 
       11 
11 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
12 
     | 
    
         
             
            authors: 
         
     | 
| 
       13 
13 
     | 
    
         
             
            - Barry Hess
         
     | 
| 
         @@ -15,8 +15,7 @@ autorequire: 
     | 
|
| 
       15 
15 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
16 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            date: 2011- 
     | 
| 
       19 
     | 
    
         
            -
            default_executable: 
         
     | 
| 
      
 18 
     | 
    
         
            +
            date: 2011-11-09 00:00:00 Z
         
     | 
| 
       20 
19 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       21 
20 
     | 
    
         | 
| 
       22 
21 
     | 
    
         
             
            description: TimeWarp is a ruby library for manipulating times in automated tests.
         
     | 
| 
         @@ -31,13 +30,15 @@ files: 
     | 
|
| 
       31 
30 
     | 
    
         
             
            - MIT-LICENSE
         
     | 
| 
       32 
31 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       33 
32 
     | 
    
         
             
            - README.md
         
     | 
| 
      
 33 
     | 
    
         
            +
            - lib/core_ext/time.rb
         
     | 
| 
      
 34 
     | 
    
         
            +
            - lib/core_ext/date.rb
         
     | 
| 
      
 35 
     | 
    
         
            +
            - lib/core_ext/date_time.rb
         
     | 
| 
       34 
36 
     | 
    
         
             
            - lib/core_ext.rb
         
     | 
| 
       35 
37 
     | 
    
         
             
            - lib/time_warp.rb
         
     | 
| 
       36 
38 
     | 
    
         
             
            - lib/time-warp.rb
         
     | 
| 
       37 
39 
     | 
    
         
             
            - tasks/time_warp_tasks.rake
         
     | 
| 
       38 
40 
     | 
    
         
             
            - test/test_helper.rb
         
     | 
| 
       39 
41 
     | 
    
         
             
            - test/time_warp_test.rb
         
     | 
| 
       40 
     | 
    
         
            -
            has_rdoc: true
         
     | 
| 
       41 
42 
     | 
    
         
             
            homepage: http://github.com/harvesthq/time-warp
         
     | 
| 
       42 
43 
     | 
    
         
             
            licenses: []
         
     | 
| 
       43 
44 
     | 
    
         | 
| 
         @@ -67,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       67 
68 
     | 
    
         
             
            requirements: []
         
     | 
| 
       68 
69 
     | 
    
         | 
| 
       69 
70 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       70 
     | 
    
         
            -
            rubygems_version: 1. 
     | 
| 
      
 71 
     | 
    
         
            +
            rubygems_version: 1.8.9
         
     | 
| 
       71 
72 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       72 
73 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       73 
74 
     | 
    
         
             
            summary: Warp time in your tests
         
     |