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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ffc3899071434ff0ae8eb0a9e4a6ea4c2d8794547113c272bdc24a384d2eb45
4
- data.tar.gz: e9333e4c2cf362558c432d7b954a724ff588e66c4dcce8d3af4a327dd6dcb894
3
+ metadata.gz: 79ad5f132158245aadf9f2afbfbfaa2e0ed8298e69037270f51cb801f9794b88
4
+ data.tar.gz: ec1d3177b1ca8f8f03c2bef0316f97953a4fe021d250903ea9159cdca8079550
5
5
  SHA512:
6
- metadata.gz: 692759ecf208cccb83f72d2cd2a3632d6fb6477e9ac1dbf1ca19d8c23a0b864093abdfdc1d51ee98078858dc2dd3eab50f1bd8b469cc84f0619c99bed242169f
7
- data.tar.gz: 85fc3b65a8f415601a047d4189ff497a73f49d4d48647881a6579d82dc6f12ab9e6a088da0ca2b3c2a25693f220ce3c8f31b5f2847f6a5d4784c63ace77136ff
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
@@ -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)
@@ -1,3 +1,3 @@
1
1
  class Timecop
2
- VERSION = "0.9.9"
2
+ VERSION = "0.9.10"
3
3
  end
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.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-01 00:00:00.000000000 Z
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.15
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