quantum_leap 0.2.0 → 0.3.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/.travis.yml +6 -0
- data/README.md +12 -4
- data/lib/quantum_leap/version.rb +1 -1
- data/lib/quantum_leap.rb +1 -1
- data/quantum_leap.gemspec +2 -0
- data/spec/quantum_spec.rb +30 -8
- metadata +15 -3
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# QuantumLeap
|
2
2
|
|
3
|
+
[](http://travis-ci.org/mattonrails/quantum_leap)
|
4
|
+
|
3
5
|
Righting wrongs in your test suite with time travel!
|
4
6
|
|
5
7
|
QuantumLeap lets you change the current time in your tests.
|
@@ -22,20 +24,26 @@ Or install it yourself as:
|
|
22
24
|
|
23
25
|
## Usage
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
-
Quantum.leap(Time.new(1956, 9, 13, 15, 00))
|
27
|
+
Quantum.leap(Time.new(1956, 9, 13))
|
28
28
|
sam.must_be_kind_of(Pilot)
|
29
29
|
sam.must_win_baseball_game
|
30
30
|
Quantum.leap_back
|
31
31
|
|
32
32
|
Or with a block:
|
33
33
|
|
34
|
-
Quantum.leap(Time.new(1974, 10, 24
|
34
|
+
Quantum.leap(Time.new(1974, 10, 24)) do
|
35
35
|
sam.must_be_kind_of(Boxer)
|
36
36
|
sam.must_win_the_championship
|
37
37
|
end
|
38
38
|
|
39
|
+
Defaults to Time.now without arguments:
|
40
|
+
|
41
|
+
Time.now
|
42
|
+
=> 2012-05-31 21:25:34 -0400
|
43
|
+
Quantum.leap
|
44
|
+
Time.now
|
45
|
+
=> 2012-05-31 21:25:36 -0400
|
46
|
+
|
39
47
|
## Contributing
|
40
48
|
|
41
49
|
1. Fork it
|
data/lib/quantum_leap/version.rb
CHANGED
data/lib/quantum_leap.rb
CHANGED
data/quantum_leap.gemspec
CHANGED
data/spec/quantum_spec.rb
CHANGED
@@ -9,31 +9,53 @@ describe Quantum do
|
|
9
9
|
|
10
10
|
describe '.leap' do
|
11
11
|
describe 'without a block' do
|
12
|
-
|
13
|
-
|
12
|
+
the_present = Time.new
|
13
|
+
the_past = Time.new(1956, 9, 13, 15, 00)
|
14
14
|
|
15
15
|
it 'changes the current time' do
|
16
16
|
Quantum.leap(the_past)
|
17
|
-
Time.now.
|
17
|
+
Time.now.must_be_within_delta(the_past, 1)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
describe 'with a block' do
|
22
|
-
|
23
|
-
|
22
|
+
the_present = Time.new
|
23
|
+
the_past = Time.new(1974, 10, 24, 15, 00)
|
24
24
|
|
25
25
|
it 'changes time only within the block' do
|
26
26
|
Quantum.leap(the_past) do
|
27
|
-
Time.now.
|
27
|
+
Time.now.must_be_within_delta(the_past, 1)
|
28
28
|
end
|
29
29
|
Time.now.must_be_within_delta(the_present, 1)
|
30
30
|
end
|
31
31
|
end
|
32
|
+
|
33
|
+
describe 'with no argument' do
|
34
|
+
describe 'without a block' do
|
35
|
+
the_present = Time.new
|
36
|
+
|
37
|
+
it 'defaults to the current time' do
|
38
|
+
Quantum.leap
|
39
|
+
Time.now.must_be_within_delta(the_present, 1)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe 'with a block' do
|
44
|
+
the_present = Time.new
|
45
|
+
|
46
|
+
it 'changes time only within the block' do
|
47
|
+
Quantum.leap do
|
48
|
+
Time.now.must_be_within_delta(the_present, 1)
|
49
|
+
end
|
50
|
+
Time.now.must_be_within_delta(the_present, 1)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
32
54
|
end
|
33
55
|
|
34
56
|
describe '.leap_back' do
|
35
|
-
|
36
|
-
|
57
|
+
the_present = Time.new
|
58
|
+
the_past = Time.new(1972, 6, 15, 15, 00)
|
37
59
|
|
38
60
|
it 'returns to the present time' do
|
39
61
|
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.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,8 +9,19 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
13
|
-
dependencies:
|
12
|
+
date: 2012-06-01 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: &70187114188660 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70187114188660
|
14
25
|
description: Righting wrongs in your test suite with time travel!
|
15
26
|
email:
|
16
27
|
- mattonrails@shortmail.com
|
@@ -20,6 +31,7 @@ extra_rdoc_files: []
|
|
20
31
|
files:
|
21
32
|
- .gitignore
|
22
33
|
- .rbenv-version
|
34
|
+
- .travis.yml
|
23
35
|
- Gemfile
|
24
36
|
- LICENSE
|
25
37
|
- README.md
|