quantum_leap 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +10 -1
- data/lib/quantum_leap/version.rb +1 -1
- data/lib/quantum_leap.rb +6 -0
- data/spec/quantum_spec.rb +25 -6
- metadata +2 -2
data/README.md
CHANGED
@@ -24,9 +24,18 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
require 'quantum_leap'
|
26
26
|
|
27
|
-
Quantum.leap(Time.
|
27
|
+
Quantum.leap(Time.new(1956, 9, 13, 15, 00))
|
28
|
+
sam.must_be_kind_of(Pilot)
|
29
|
+
sam.must_win_baseball_game
|
28
30
|
Quantum.leap_back
|
29
31
|
|
32
|
+
Or with a block:
|
33
|
+
|
34
|
+
Quantum.leap(Time.new(1974, 10, 24, 15, 00)) do
|
35
|
+
sam.must_be_kind_of(Boxer)
|
36
|
+
sam.must_win_the_championship
|
37
|
+
end
|
38
|
+
|
30
39
|
## Contributing
|
31
40
|
|
32
41
|
1. Fork it
|
data/lib/quantum_leap/version.rb
CHANGED
data/lib/quantum_leap.rb
CHANGED
data/spec/quantum_spec.rb
CHANGED
@@ -3,18 +3,37 @@ require 'quantum_leap'
|
|
3
3
|
|
4
4
|
describe Quantum do
|
5
5
|
|
6
|
+
after do
|
7
|
+
Quantum.leap_back
|
8
|
+
end
|
9
|
+
|
6
10
|
describe '.leap' do
|
7
|
-
|
11
|
+
describe 'without a block' do
|
12
|
+
let(:the_present) { Time.new }
|
13
|
+
let(:the_past) { Time.new(1956, 9, 13, 15, 00) }
|
8
14
|
|
9
|
-
|
10
|
-
|
11
|
-
|
15
|
+
it 'changes the current time' do
|
16
|
+
Quantum.leap(the_past)
|
17
|
+
Time.now.must_be_close_to(the_past)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe 'with a block' do
|
22
|
+
let(:the_present) { Time.new }
|
23
|
+
let(:the_past) { Time.new(1974, 10, 24, 15, 00) }
|
24
|
+
|
25
|
+
it 'changes time only within the block' do
|
26
|
+
Quantum.leap(the_past) do
|
27
|
+
Time.now.must_be_close_to(the_past)
|
28
|
+
end
|
29
|
+
Time.now.must_be_within_delta(the_present, 1)
|
30
|
+
end
|
12
31
|
end
|
13
32
|
end
|
14
33
|
|
15
34
|
describe '.leap_back' do
|
16
|
-
the_present
|
17
|
-
the_past
|
35
|
+
let(:the_present) { Time.new }
|
36
|
+
let(:the_past) { Time.new(1972, 6, 15, 15, 00) }
|
18
37
|
|
19
38
|
it 'returns to the present time' do
|
20
39
|
Quantum.leap(the_past)
|
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.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-31 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Righting wrongs in your test suite with time travel!
|
15
15
|
email:
|