delorean 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/lib/delorean.rb +5 -5
- metadata +46 -12
data/README.rdoc
CHANGED
@@ -44,7 +44,7 @@ Time-travelling can be extremely useful when you're testing your application.
|
|
44
44
|
For example, in RSpec you may find convenient to include Delorean's DSL in your <tt>spec_helper.rb</tt>:
|
45
45
|
|
46
46
|
Spec::Runner.configure do |config|
|
47
|
-
include Delorean
|
47
|
+
config.include Delorean
|
48
48
|
...
|
49
49
|
|
50
50
|
Now you can time-travel in your examples, like this:
|
data/lib/delorean.rb
CHANGED
@@ -3,8 +3,8 @@ require 'chronic'
|
|
3
3
|
module Delorean
|
4
4
|
extend self
|
5
5
|
|
6
|
-
def time_travel_to(time)
|
7
|
-
mock_current_time(time)
|
6
|
+
def time_travel_to(time, options={})
|
7
|
+
mock_current_time(time, options)
|
8
8
|
return unless block_given?
|
9
9
|
begin
|
10
10
|
yield
|
@@ -35,8 +35,8 @@ module Delorean
|
|
35
35
|
@@time_travel_offsets = []
|
36
36
|
end
|
37
37
|
|
38
|
-
def mock_current_time(time)
|
39
|
-
time = Chronic.parse(time) if time.is_a?(String)
|
38
|
+
def mock_current_time(time, options={})
|
39
|
+
time = Chronic.parse(time, options) if time.is_a?(String)
|
40
40
|
time = Time.local(time.year, time.month, time.day) if time.is_a?(Date)
|
41
41
|
|
42
42
|
time_travel_offsets.push Time.now - time
|
@@ -50,4 +50,4 @@ end
|
|
50
50
|
class << Time
|
51
51
|
alias_method :now_without_delorean, :now
|
52
52
|
def now; Delorean.now; end
|
53
|
-
end
|
53
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delorean
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- "Luismi Cavall\xC3\xA9"
|
@@ -10,29 +16,51 @@ autorequire:
|
|
10
16
|
bindir: bin
|
11
17
|
cert_chain: []
|
12
18
|
|
13
|
-
date: 2010-
|
19
|
+
date: 2010-05-25 00:00:00 +02:00
|
14
20
|
default_executable:
|
15
21
|
dependencies:
|
16
22
|
- !ruby/object:Gem::Dependency
|
17
23
|
name: chronic
|
18
|
-
|
19
|
-
|
20
|
-
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
21
27
|
requirements:
|
22
28
|
- - ">="
|
23
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
31
|
+
segments:
|
32
|
+
- 0
|
24
33
|
version: "0"
|
25
|
-
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
26
36
|
- !ruby/object:Gem::Dependency
|
27
37
|
name: rspec
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
version: "0"
|
28
48
|
type: :development
|
29
|
-
|
30
|
-
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: active_support
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
31
55
|
requirements:
|
32
56
|
- - ">="
|
33
57
|
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
59
|
+
segments:
|
60
|
+
- 0
|
34
61
|
version: "0"
|
35
|
-
|
62
|
+
type: :development
|
63
|
+
version_requirements: *id003
|
36
64
|
description:
|
37
65
|
email: ballsbreaking@bebanjo.com
|
38
66
|
executables: []
|
@@ -56,21 +84,27 @@ rdoc_options:
|
|
56
84
|
require_paths:
|
57
85
|
- lib
|
58
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
59
88
|
requirements:
|
60
89
|
- - ">="
|
61
90
|
- !ruby/object:Gem::Version
|
91
|
+
hash: 3
|
92
|
+
segments:
|
93
|
+
- 0
|
62
94
|
version: "0"
|
63
|
-
version:
|
64
95
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
65
97
|
requirements:
|
66
98
|
- - ">="
|
67
99
|
- !ruby/object:Gem::Version
|
100
|
+
hash: 3
|
101
|
+
segments:
|
102
|
+
- 0
|
68
103
|
version: "0"
|
69
|
-
version:
|
70
104
|
requirements: []
|
71
105
|
|
72
106
|
rubyforge_project:
|
73
|
-
rubygems_version: 1.3.
|
107
|
+
rubygems_version: 1.3.7
|
74
108
|
signing_key:
|
75
109
|
specification_version: 3
|
76
110
|
summary: Delorean lets you travel in time with Ruby by mocking Time.now
|