quantum_leap 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -20,25 +20,21 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- Quantum.leap(Time.new(1956, 9, 13))
24
- sam.must_be_kind_of(Pilot)
25
- sam.must_win_baseball_game
26
- Quantum.leap_back
23
+ ```ruby
24
+ Quantum.leap(Time.new(1956, 9, 13))
25
+ sam.must_be_kind_of(Pilot)
26
+ sam.must_win_baseball_game
27
+ Quantum.leap_back
28
+ ```
27
29
 
28
30
  Or with a block:
29
31
 
30
- Quantum.leap(Time.new(1974, 10, 24)) do
31
- sam.must_be_kind_of(Boxer)
32
- sam.must_win_the_championship
33
- end
34
-
35
- Defaults to Time.now without arguments:
36
-
37
- Time.now
38
- => 2012-05-31 21:25:34 -0400
39
- Quantum.leap
40
- Time.now
41
- => 2012-05-31 21:25:36 -0400
32
+ ```ruby
33
+ Quantum.leap(Time.new(1974, 10, 24)) do
34
+ sam.must_be_kind_of(Boxer)
35
+ sam.must_win_the_championship
36
+ end
37
+ ```
42
38
 
43
39
  ## Contributing
44
40
 
@@ -1,3 +1,3 @@
1
1
  module QuantumLeap
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
data/lib/quantum_leap.rb CHANGED
@@ -36,7 +36,9 @@ class << Date
36
36
  end
37
37
 
38
38
  class Quantum
39
- def self.leap(time = Time.now)
39
+ INITIAL_LEAP = Time.new(1956, 9, 13, 15, 00)
40
+
41
+ def self.leap(time = INITIAL_LEAP)
40
42
  QuantumLeap.mock_current_time(time)
41
43
  if block_given?
42
44
  begin
data/spec/quantum_spec.rb CHANGED
@@ -52,16 +52,16 @@ describe Quantum do
52
52
 
53
53
  describe 'with no argument' do
54
54
  describe 'without a block' do
55
- the_present = Time.new
55
+ the_past = Time.new(1956, 9, 13, 15, 00)
56
56
 
57
57
  it 'defaults to the current time' do
58
58
  Quantum.leap
59
- Time.now.must_be_within_delta(the_present, 1)
59
+ Time.now.must_be_within_delta(the_past, 1)
60
60
  end
61
61
 
62
62
  it 'defaults to the current date' do
63
63
  Quantum.leap
64
- Date.today.must_equal(the_present.to_date)
64
+ Date.today.must_equal(the_past.to_date)
65
65
  end
66
66
 
67
67
  it 'returns the time' do
@@ -70,18 +70,19 @@ describe Quantum do
70
70
  end
71
71
 
72
72
  describe 'with a block' do
73
- the_present = Time.new
73
+ the_present = Time.now
74
+ the_past = Time.new(1956, 9, 13, 15, 00)
74
75
 
75
- it 'does not change time in or outside block' do
76
+ it 'only changes time within the block' do
76
77
  Quantum.leap do
77
- Time.now.must_be_within_delta(the_present, 1)
78
+ Time.now.must_be_within_delta(the_past, 1)
78
79
  end
79
80
  Time.now.must_be_within_delta(the_present, 1)
80
81
  end
81
82
 
82
- it 'does not change date in or outside block' do
83
+ it 'only changes date within the block' do
83
84
  Quantum.leap do
84
- Date.today.must_equal(the_present.to_date)
85
+ Date.today.must_equal(the_past.to_date)
85
86
  end
86
87
  Date.today.must_equal(the_present.to_date)
87
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.5.0
4
+ version: 0.6.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-19 00:00:00.000000000 Z
12
+ date: 2012-07-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &70356085914680 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,15 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
24
+ version_requirements: *70356085914680
30
25
  - !ruby/object:Gem::Dependency
31
26
  name: minitest-colorize
32
- requirement: !ruby/object:Gem::Requirement
27
+ requirement: &70356085913680 !ruby/object:Gem::Requirement
33
28
  none: false
34
29
  requirements:
35
30
  - - ! '>='
@@ -37,12 +32,7 @@ dependencies:
37
32
  version: '0'
38
33
  type: :development
39
34
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
35
+ version_requirements: *70356085913680
46
36
  description: Righting wrongs in your test suite with time travel!
47
37
  email:
48
38
  - mattonrails@shortmail.com
@@ -82,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
72
  version: '0'
83
73
  requirements: []
84
74
  rubyforge_project:
85
- rubygems_version: 1.8.23
75
+ rubygems_version: 1.8.16
86
76
  signing_key:
87
77
  specification_version: 3
88
78
  summary: Lets you change the current time in your tests