quantum_leap 0.0.3 → 0.1.0

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/README.md CHANGED
@@ -2,8 +2,9 @@
2
2
 
3
3
  Righting wrongs in your test suite with time travel!
4
4
 
5
- QuantumLeap lets you change the current time in your tests. I can't promise
6
- you'll meet any historical figures, however.
5
+ QuantumLeap lets you change the current time in your tests.
6
+
7
+ I can't promise you'll meet any historical figures, however.
7
8
 
8
9
  ## Installation
9
10
 
@@ -24,6 +25,7 @@ Or install it yourself as:
24
25
  require 'quantum_leap'
25
26
 
26
27
  Quantum.leap(Time.now + 60)
28
+ Quantum.leap_back
27
29
 
28
30
  ## Contributing
29
31
 
@@ -1,3 +1,3 @@
1
1
  module QuantumLeap
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/quantum_leap.rb CHANGED
@@ -7,6 +7,10 @@ module QuantumLeap
7
7
  @time_travel_offsets ||= []
8
8
  end
9
9
 
10
+ def reset
11
+ @time_travel_offsets = []
12
+ end
13
+
10
14
  def mock_current_time(new_time)
11
15
  time_travel_offsets.push(Time.now - new_time)
12
16
  end
@@ -25,4 +29,8 @@ class Quantum
25
29
  def self.leap(time)
26
30
  QuantumLeap.mock_current_time(time)
27
31
  end
32
+
33
+ def self.leap_back
34
+ QuantumLeap.reset
35
+ end
28
36
  end
data/spec/quantum_spec.rb CHANGED
@@ -4,7 +4,7 @@ require 'quantum_leap'
4
4
  describe Quantum do
5
5
 
6
6
  describe '.leap' do
7
- the_past = Time.new(1968, 03, 25, 15, 00)
7
+ the_past = Time.new(1956, 9, 13, 15, 00)
8
8
 
9
9
  it 'changes the current time' do
10
10
  Quantum.leap(the_past)
@@ -12,4 +12,16 @@ describe Quantum do
12
12
  end
13
13
  end
14
14
 
15
+ describe '.leap_back' do
16
+ the_present = Time.new
17
+ the_past = Time.new(1972, 6, 15, 15, 00)
18
+
19
+ it 'returns to the present time' do
20
+ Quantum.leap(the_past)
21
+ Time.now.must_be_within_delta(the_past, 1)
22
+ Quantum.leap_back
23
+ Time.now.must_be_within_delta(the_present, 1)
24
+ end
25
+ end
26
+
15
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quantum_leap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: