timecop 0.9.9 → 0.9.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +9 -0
- data/lib/timecop/time_extensions.rb +1 -1
- data/lib/timecop/timecop.rb +8 -0
- data/lib/timecop/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79ad5f132158245aadf9f2afbfbfaa2e0ed8298e69037270f51cb801f9794b88
|
4
|
+
data.tar.gz: ec1d3177b1ca8f8f03c2bef0316f97953a4fe021d250903ea9159cdca8079550
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82b29e41644233b3aa80205a40e1f72e8616fc45b0c4e10fb12cbe5abf1e13dba36423667ba8ab4ec0e592633056d30d6f760a462137333ed629cffaf4272729
|
7
|
+
data.tar.gz: 81f1c484e1254c6b72bd55bcac4dda7aa5b73d2af04125fdbb433ef69baaf796efe022b3384555ef9241261a799af495bbf49fac88d1ca90b3a497908a9f4df6
|
data/README.markdown
CHANGED
@@ -129,6 +129,15 @@ Timecop.freeze
|
|
129
129
|
# => Timecop::SafeModeException: Safe mode is enabled, only calls passing a block are allowed.
|
130
130
|
```
|
131
131
|
|
132
|
+
### Configuring Mocking Process.clock_gettime
|
133
|
+
|
134
|
+
By default Timecop does not mock Process.clock_gettime. You must enable it like this:
|
135
|
+
|
136
|
+
``` ruby
|
137
|
+
# turn on
|
138
|
+
Timecop.mock_process_clock = true
|
139
|
+
```
|
140
|
+
|
132
141
|
### Rails v Ruby Date/Time libraries
|
133
142
|
|
134
143
|
Sometimes [Rails Date/Time methods don't play nicely with Ruby Date/Time methods.](https://rails.lighthouseapp.com/projects/8994/tickets/6410-dateyesterday-datetoday)
|
@@ -181,7 +181,7 @@ if RUBY_VERSION >= '2.1.0'
|
|
181
181
|
mock_time_realtime
|
182
182
|
end
|
183
183
|
|
184
|
-
return clock_gettime_without_mock(clock_id, unit) unless mock_time
|
184
|
+
return clock_gettime_without_mock(clock_id, unit) unless Timecop.mock_process_clock? && mock_time
|
185
185
|
|
186
186
|
divisor = case unit
|
187
187
|
when :float_second
|
data/lib/timecop/timecop.rb
CHANGED
@@ -142,6 +142,14 @@ class Timecop
|
|
142
142
|
!instance.stack.empty? && instance.stack.last.mock_type == :scale
|
143
143
|
end
|
144
144
|
|
145
|
+
def mock_process_clock=(mock)
|
146
|
+
@mock_process_clock = mock
|
147
|
+
end
|
148
|
+
|
149
|
+
def mock_process_clock?
|
150
|
+
@mock_process_clock ||= false
|
151
|
+
end
|
152
|
+
|
145
153
|
private
|
146
154
|
def send_travel(mock_type, *args, &block)
|
147
155
|
val = instance.travel(mock_type, *args, &block)
|
data/lib/timecop/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timecop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis Jeffery
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-06-
|
12
|
+
date: 2024-06-14 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A gem providing "time travel" and "time freezing" capabilities, making
|
15
15
|
it dead simple to test time-dependent code. It provides a unified method to mock
|
@@ -49,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '0'
|
51
51
|
requirements: []
|
52
|
-
rubygems_version: 3.2.
|
52
|
+
rubygems_version: 3.2.22
|
53
53
|
signing_key:
|
54
54
|
specification_version: 4
|
55
55
|
summary: A gem providing "time travel" and "time freezing" capabilities, making it
|