quantum_leap 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +0 -4
- data/lib/quantum_leap/version.rb +1 -1
- data/lib/quantum_leap.rb +8 -5
- data/spec/quantum_spec.rb +20 -0
- metadata +4 -4
data/README.md
CHANGED
data/lib/quantum_leap/version.rb
CHANGED
data/lib/quantum_leap.rb
CHANGED
@@ -28,15 +28,18 @@ end
|
|
28
28
|
class Quantum
|
29
29
|
def self.leap(time = Time.now)
|
30
30
|
QuantumLeap.mock_current_time(time)
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
if block_given?
|
32
|
+
begin
|
33
|
+
yield
|
34
|
+
ensure
|
35
|
+
QuantumLeap.reset
|
36
|
+
end
|
36
37
|
end
|
38
|
+
return Time.now
|
37
39
|
end
|
38
40
|
|
39
41
|
def self.leap_back
|
40
42
|
QuantumLeap.reset
|
43
|
+
Time.now
|
41
44
|
end
|
42
45
|
end
|
data/spec/quantum_spec.rb
CHANGED
@@ -16,6 +16,10 @@ describe Quantum do
|
|
16
16
|
Quantum.leap(the_past)
|
17
17
|
Time.now.must_be_within_delta(the_past, 1)
|
18
18
|
end
|
19
|
+
|
20
|
+
it 'returns the time' do
|
21
|
+
Quantum.leap(the_past).must_be_kind_of(Time)
|
22
|
+
end
|
19
23
|
end
|
20
24
|
|
21
25
|
describe 'with a block' do
|
@@ -28,6 +32,10 @@ describe Quantum do
|
|
28
32
|
end
|
29
33
|
Time.now.must_be_within_delta(the_present, 1)
|
30
34
|
end
|
35
|
+
|
36
|
+
it 'returns the time' do
|
37
|
+
Quantum.leap(the_past) {}.must_be_kind_of(Time)
|
38
|
+
end
|
31
39
|
end
|
32
40
|
|
33
41
|
describe 'with no argument' do
|
@@ -38,6 +46,10 @@ describe Quantum do
|
|
38
46
|
Quantum.leap
|
39
47
|
Time.now.must_be_within_delta(the_present, 1)
|
40
48
|
end
|
49
|
+
|
50
|
+
it 'returns the time' do
|
51
|
+
Quantum.leap.must_be_kind_of(Time)
|
52
|
+
end
|
41
53
|
end
|
42
54
|
|
43
55
|
describe 'with a block' do
|
@@ -49,6 +61,10 @@ describe Quantum do
|
|
49
61
|
end
|
50
62
|
Time.now.must_be_within_delta(the_present, 1)
|
51
63
|
end
|
64
|
+
|
65
|
+
it 'returns the time' do
|
66
|
+
Quantum.leap {}.must_be_kind_of(Time)
|
67
|
+
end
|
52
68
|
end
|
53
69
|
end
|
54
70
|
end
|
@@ -63,6 +79,10 @@ describe Quantum do
|
|
63
79
|
Quantum.leap_back
|
64
80
|
Time.now.must_be_within_delta(the_present, 1)
|
65
81
|
end
|
82
|
+
|
83
|
+
it 'returns the time' do
|
84
|
+
Quantum.leap_back.must_be_kind_of(Time)
|
85
|
+
end
|
66
86
|
end
|
67
87
|
|
68
88
|
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.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &70255414149960 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70255414149960
|
25
25
|
description: Righting wrongs in your test suite with time travel!
|
26
26
|
email:
|
27
27
|
- mattonrails@shortmail.com
|