timecop-rspec 1.0.0 → 1.0.2

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.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/.github/workflows/deps_locked.yml +11 -1
  4. data/.idea/timecop-rspec.iml +11 -9
  5. data/.rubocop_gradual.lock +64 -64
  6. data/CHANGELOG.md +27 -4
  7. data/CONTRIBUTING.md +1 -3
  8. data/Gemfile.lock +3 -25
  9. data/README.md +33 -10
  10. data/Rakefile +39 -2
  11. data/bin/console +1 -28
  12. data/bin/setup +0 -26
  13. data/checksums/timecop-rspec-1.0.1.gem.sha256 +1 -0
  14. data/checksums/timecop-rspec-1.0.1.gem.sha512 +1 -0
  15. data/checksums/timecop-rspec-1.0.2.gem.sha256 +1 -0
  16. data/checksums/timecop-rspec-1.0.2.gem.sha512 +1 -0
  17. data/docs/Timecop/Rspec/ExampleDecorator.html +26 -26
  18. data/docs/Timecop/Rspec/SequentialTimeMachine.html +11 -11
  19. data/docs/Timecop/Rspec/TimeMachine.html +18 -18
  20. data/docs/Timecop/Rspec/TravelLog.html +18 -18
  21. data/docs/Timecop/Rspec/Traveler.html +25 -25
  22. data/docs/Timecop/Rspec/Version.html +2 -2
  23. data/docs/Timecop/Rspec.html +20 -18
  24. data/docs/Timecop.html +2 -8
  25. data/docs/_index.html +13 -1
  26. data/docs/file.CHANGELOG.html +37 -6
  27. data/docs/file.CITATION.html +1 -1
  28. data/docs/file.CODE_OF_CONDUCT.html +1 -1
  29. data/docs/file.CONTRIBUTING.html +2 -4
  30. data/docs/file.LICENSE.html +1 -1
  31. data/docs/file.README.html +35 -13
  32. data/docs/file.REEK.html +1 -1
  33. data/docs/file.RUBOCOP.html +1 -1
  34. data/docs/file.SECURITY.html +1 -1
  35. data/docs/file.rspec.html +1 -1
  36. data/docs/file.timecop-rspec-1.0.0.gem.html +71 -0
  37. data/docs/file.timecop-rspec-1.0.1.gem.html +71 -0
  38. data/docs/file.timecop.html +1 -1
  39. data/docs/file_list.html +20 -0
  40. data/docs/index.html +35 -13
  41. data/docs/top-level-namespace.html +1 -1
  42. data/lib/timecop/rspec/example_decorator.rb +3 -24
  43. data/lib/timecop/rspec/sequential_time_machine.rb +0 -24
  44. data/lib/timecop/rspec/time_machine.rb +0 -24
  45. data/lib/timecop/rspec/travel_log.rb +6 -28
  46. data/lib/timecop/rspec/traveler.rb +0 -24
  47. data/lib/timecop/rspec/version.rb +1 -25
  48. data/lib/timecop/rspec.rb +2 -26
  49. data/timecop-rspec.gemspec +6 -3
  50. data.tar.gz.sig +0 -0
  51. metadata +26 -14
  52. metadata.gz.sig +0 -0
data/docs/index.html CHANGED
@@ -61,7 +61,7 @@
61
61
 
62
62
  <h1 id="️-timecoprspec">⌚️ Timecop::Rspec</h1>
63
63
 
64
- <p><a href="https://rubygems.org/gems/timecop-rspec"><img src="https://img.shields.io/gem/v/timecop-rspec.svg" alt="Version"></a> <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-259D6C.svg" alt="License: MIT"></a> <a href="https://rubygems.org/gems/timecop-rspec"><img src="https://img.shields.io/gem/rd/timecop-rspec.svg" alt="Downloads Rank"></a> <a href="https://www.codetriage.com/galtzo-floss/timecop-rspec"><img src="https://www.codetriage.com/galtzo-floss/timecop-rspec/badges/users.svg" alt="Open Source Helpers"></a> <a href="https://coveralls.io/github/galtzo-floss/timecop-rspec?branch=main"><img src="https://coveralls.io/repos/github/galtzo-floss/timecop-rspec/badge.svg?branch=main" alt="Coveralls Test Coverage"></a> <a href="https://codecov.io/gh/galtzo-floss/timecop-rspec"><img src="https://codecov.io/gh/galtzo-floss/timecop-rspec/graph/badge.svg?token=hRnUCPqxMu" alt="CodeCov Test Coverage"></a> <a href="https://qlty.sh/gh/galtzo-floss/projects/timecop-rspec/metrics/code?sort=coverageRating"><img src="https://qlty.sh/gh/galtzo-floss/projects/timecop-rspec/coverage.svg" alt="QLTY Test Coverage"></a> <a href="https://qlty.sh/gh/galtzo-floss/projects/timecop-rspec"><img src="https://qlty.sh/gh/galtzo-floss/projects/timecop-rspec/maintainability.svg" alt="QLTY Maintainability"></a> <a href="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/heads.yml"><img src="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/heads.yml/badge.svg" alt="CI Heads"></a> <a href="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/current.yml"><img src="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/current.yml/badge.svg" alt="CI Current"></a> <a href="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/truffle.yml"><img src="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/truffle.yml/badge.svg" alt="CI Truffle Ruby"></a> <a href="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/jruby.yml"><img src="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/jruby.yml/badge.svg" alt="CI JRuby"></a> <a href="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/deps_locked.yml"><img src="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/deps_locked.yml/badge.svg" alt="Deps Locked"></a> <a href="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/deps_unlocked.yml"><img src="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/deps_unlocked.yml/badge.svg" alt="Deps Unlocked"></a> <a href="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/supported.yml"><img src="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/supported.yml/badge.svg" alt="CI Supported"></a> <a href="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/legacy.yml"><img src="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/legacy.yml/badge.svg" alt="CI Legacy"></a> <a href="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/unsupported.yml"><img src="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/unsupported.yml/badge.svg" alt="CI Unsupported"></a> <a href="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/ancient.yml"><img src="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/ancient.yml/badge.svg" alt="CI Ancient"></a> <a href="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/coverage.yml"><img src="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/coverage.yml/badge.svg" alt="CI Test Coverage"></a> <a href="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/style.yml"><img src="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/style.yml/badge.svg" alt="CI Style"></a></p>
64
+ <p><a href="https://rubygems.org/gems/timecop-rspec"><img src="https://img.shields.io/gem/v/timecop-rspec.svg" alt="Version"></a> <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-259D6C.svg" alt="License: MIT"></a> <a href="https://rubygems.org/gems/timecop-rspec"><img src="https://img.shields.io/gem/rd/timecop-rspec.svg" alt="Downloads Rank"></a> <a href="https://www.codetriage.com/galtzo-floss/timecop-rspec"><img src="https://www.codetriage.com/galtzo-floss/timecop-rspec/badges/users.svg" alt="Open Source Helpers"></a> <a href="https://coveralls.io/github/galtzo-floss/timecop-rspec?branch=main"><img src="https://coveralls.io/repos/github/galtzo-floss/timecop-rspec/badge.svg?branch=main" alt="Coveralls Test Coverage"></a> <a href="https://codecov.io/gh/galtzo-floss/timecop-rspec"><img src="https://codecov.io/gh/galtzo-floss/timecop-rspec/graph/badge.svg?token=6XnuK8rocd" alt="CodeCov Test Coverage"></a> <a href="https://qlty.sh/gh/galtzo-floss/projects/timecop-rspec/metrics/code?sort=coverageRating"><img src="https://qlty.sh/gh/galtzo-floss/projects/timecop-rspec/coverage.svg" alt="QLTY Test Coverage"></a> <a href="https://qlty.sh/gh/galtzo-floss/projects/timecop-rspec"><img src="https://qlty.sh/gh/galtzo-floss/projects/timecop-rspec/maintainability.svg" alt="QLTY Maintainability"></a> <a href="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/heads.yml"><img src="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/heads.yml/badge.svg" alt="CI Heads"></a> <a href="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/current.yml"><img src="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/current.yml/badge.svg" alt="CI Current"></a> <a href="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/truffle.yml"><img src="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/truffle.yml/badge.svg" alt="CI Truffle Ruby"></a> <a href="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/jruby.yml"><img src="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/jruby.yml/badge.svg" alt="CI JRuby"></a> <a href="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/deps_locked.yml"><img src="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/deps_locked.yml/badge.svg" alt="Deps Locked"></a> <a href="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/deps_unlocked.yml"><img src="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/deps_unlocked.yml/badge.svg" alt="Deps Unlocked"></a> <a href="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/supported.yml"><img src="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/supported.yml/badge.svg" alt="CI Supported"></a> <a href="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/legacy.yml"><img src="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/legacy.yml/badge.svg" alt="CI Legacy"></a> <a href="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/unsupported.yml"><img src="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/unsupported.yml/badge.svg" alt="CI Unsupported"></a> <a href="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/ancient.yml"><img src="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/ancient.yml/badge.svg" alt="CI Ancient"></a> <a href="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/coverage.yml"><img src="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/coverage.yml/badge.svg" alt="CI Test Coverage"></a> <a href="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/style.yml"><img src="https://github.com/galtzo-floss/timecop-rspec/actions/workflows/style.yml/badge.svg" alt="CI Style"></a></p>
65
65
 
66
66
  <hr>
67
67
 
@@ -78,6 +78,14 @@ It has a great API, and I was about to build this exact thing myself, so I am gl
78
78
  I’ve modernized everything, added more tests and documentation, and released it.<br>
79
79
  Thanks to the long-term stability of both RSpec and Timecop, the original code still works perfectly.</p>
80
80
 
81
+ <p>Improvements over original:</p>
82
+ <ul>
83
+ <li>The original only supported Ruby 2.2+, but I’ve backfilled support to 1.9.2 (to align with the max-min version between RSpec &amp; Timecop).</li>
84
+ <li>Added tests for 100% line coverage.</li>
85
+ <li>Added documentation for all public methods.</li>
86
+ <li>removed runtime (and dev) dependency on <code>activesupport</code>.</li>
87
+ </ul>
88
+
81
89
  <p>I expect the current release of this gem to be compatible with Ruby 1.9.2+,<br>
82
90
  but it is only tested on CI against Ruby 2.3+,<br>
83
91
  due to the inherent limitations of GitHub Actions.</p>
@@ -147,7 +155,7 @@ Alternatively:
147
155
  <tr>
148
156
  <th>Tokens to Remember</th>
149
157
  <th>
150
- <a href="https://rubygems.org/gems/timecop-rspec"><img src="https://img.shields.io/badge/name-floss__funding-brightgreen.svg?style=flat&amp;logo=rubygems&amp;logoColor=red" alt="Gem name"></a> <a href="https://github.com/galtzo-floss/timecop-rspec"><img src="https://img.shields.io/badge/namespace-FlossFunding-brightgreen.svg?style=flat&amp;logo=ruby&amp;logoColor=white" alt="Gem namespace"></a>
158
+ <a href="https://rubygems.org/gems/timecop-rspec"><img src="https://img.shields.io/badge/name-timecop--rspec-3C2D2D.svg?style=square&amp;logo=rubygems&amp;logoColor=red" alt="Gem name"></a> <a href="https://github.com/galtzo-floss/timecop-rspec"><img src="https://img.shields.io/badge/namespace-Timecop%3A%3ARspec-3C2D2D.svg?style=square&amp;logo=ruby&amp;logoColor=white" alt="Gem namespace"></a>
151
159
  </th>
152
160
  </tr>
153
161
  </thead>
@@ -275,7 +283,7 @@ NOTE: Be prepared to track down certs for signed gems and add them the same way
275
283
 
276
284
  <h2 id="️-configuration">⚙️ Configuration</h2>
277
285
 
278
- <h4 id="regular-time-machine">Regular Time Machine</h4>
286
+ <h3 id="regular-time-machine">Regular Time Machine</h3>
279
287
 
280
288
  <pre class="code language-ruby"><code class="language-ruby"># spec_helper.rb or some configuration file loaded by spec_helper.rb
281
289
 
@@ -291,7 +299,7 @@ end
291
299
  <p>The regular time machine will run each example at the time specified by the<br>
292
300
  RSpec metadata, or the global travel time.</p>
293
301
 
294
- <h4 id="sequential-time-machine">Sequential Time Machine</h4>
302
+ <h3 id="sequential-time-machine">Sequential Time Machine</h3>
295
303
 
296
304
  <pre class="code language-ruby"><code class="language-ruby"># spec_helper.rb or some configuration file loaded by spec_helper.rb
297
305
 
@@ -342,7 +350,7 @@ end
342
350
 
343
351
  <h2 id="-basic-usage">🔧 Basic Usage</h2>
344
352
 
345
- <h4 id="local-time-travel">Local Time Travel</h4>
353
+ <h3 id="local-time-travel">Local Time Travel</h3>
346
354
 
347
355
  <p>Timecop.travel/freeze any RSpec (describe|context|example) with<br>
348
356
  <code>:travel</code> or <code>:freeze</code> metadata.</p>
@@ -362,7 +370,7 @@ it &quot;some description&quot;, :freeze =&gt; Time.new(2014, 11, 15) do
362
370
  end
363
371
  </code></pre>
364
372
 
365
- <h4 id="global-time-travel">Global Time Travel</h4>
373
+ <h3 id="global-time-travel">Global Time Travel</h3>
366
374
 
367
375
  <p>Using global time travel will Timecop.travel any example that isn’t<br>
368
376
  already time traveling. I.e. example level timecop metadata will take<br>
@@ -391,7 +399,7 @@ end
391
399
 
392
400
  <p>If you work at a company that uses my work, please encourage them to support me as a corporate sponsor. My work on gems you use might show up in <code>bundle fund</code>.</p>
393
401
 
394
- <p>I’m developing a new library, <a href="https://github.com/galtzo-floss/timecop-rspec">floss_funding</a>, designed to empower open-source developers like myself to get paid for the work we do, in a sustainable way. Please give it a look.</p>
402
+ <p>I’m developing a new library, <a href="https://github.com/galtzo-floss/floss_funding">floss_funding</a>, designed to empower open-source developers like myself to get paid for the work we do, in a sustainable way. Please give it a look.</p>
395
403
 
396
404
  <p><strong><a href="https://floss-funding.dev">Floss-Funding.dev</a>: 👉️ No network calls. 👉️ No tracking. 👉️ No oversight. 👉️ Minimal crypto hashing. 💡 Easily disabled nags</strong></p>
397
405
 
@@ -417,7 +425,7 @@ or use the gem and think about how it could be better.</p>
417
425
 
418
426
  <h3 id="code-coverage">Code Coverage</h3>
419
427
 
420
- <p><a href="https://codecov.io/gh/galtzo-floss/timecop-rspec"><img src="https://codecov.io/gh/galtzo-floss/timecop-rspec/graphs/tree.svg?token=hRnUCPqxMu" alt="Coverage Graph"></a></p>
428
+ <p><a href="https://codecov.io/gh/galtzo-floss/timecop-rspec"><img src="https://codecov.io/gh/galtzo-floss/timecop-rspec/graphs/tree.svg?token=6XnuK8rocd" alt="Coverage Graph"></a></p>
421
429
 
422
430
  <p><a href="https://coveralls.io/github/galtzo-floss/timecop-rspec?branch=main"><img src="https://coveralls.io/repos/github/galtzo-floss/timecop-rspec/badge.svg?branch=main" alt="Coveralls Test Coverage"></a></p>
423
431
 
@@ -436,15 +444,18 @@ chat rooms and mailing lists agrees to follow the <a href="file.CODE_OF_CONDUCT.
436
444
 
437
445
  <p>Also see GitLab Contributors: <a href="https://gitlab.com/galtzo-floss/timecop-rspec/-/graphs/main">https://gitlab.com/galtzo-floss/timecop-rspec/-/graphs/main</a></p>
438
446
 
439
- <h2 id="️-star-history">⭐️ Star History</h2>
447
+ <details>
448
+ <summary>⭐️ Star History</summary>
440
449
 
441
- <p><a href="https://star-history.com/#galtzo-floss/timecop-rspec&amp;Date"></a></p>
442
- <picture>
450
+ <a href="https://star-history.com/#galtzo-floss/timecop-rspec&amp;Date">
451
+ <picture>
443
452
  <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=galtzo-floss/timecop-rspec&amp;type=Date&amp;theme=dark"></source>
444
453
  <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=galtzo-floss/timecop-rspec&amp;type=Date"></source>
445
454
  <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=galtzo-floss/timecop-rspec&amp;type=Date">
446
455
  </picture>
447
- <p>&lt;/a&gt;</p>
456
+ </a>
457
+
458
+ </details>
448
459
 
449
460
  <h2 id="-versioning">📌 Versioning</h2>
450
461
 
@@ -510,10 +521,21 @@ See <a href="file.LICENSE.html" title="LICENSE.txt">LICENSE.txt</a> for the offi
510
521
 
511
522
  <p><a href="https://discord.gg/3qme4XHNKN"><img src="https://img.shields.io/discord/1373797679469170758?style=for-the-badge" alt="Live Chat on Discord"></a></p>
512
523
 
524
+ <p>P.P.S. Maintainers have teeth, and need to pay their dentists.<br>
525
+ After getting laid off in an RIF in March, and filled with many dozens of rejections,<br>
526
+ I’m now spending ~80 hours a week building open source tools.<br>
527
+ I’m hoping to be able to pay for my kids’ health insurance this month,<br>
528
+ so if you value the work I am doing, please help.<br>
529
+ I need your support. Consider sponsoring me.</p>
530
+
531
+ <p><a href="https://github.com/sponsors/pboling"><img src="https://img.shields.io/badge/Sponsor_Me!-pboling-blue?style=for-the-badge&amp;logo=github" alt="Sponsor me on GitHub Sponsors"></a> 💌 <a href="https://img.shields.io/liberapay/goal/pboling.svg?logo=liberapay&amp;color=a51611"><img src="https://img.shields.io/liberapay/goal/pboling.svg?style=for-the-badge&amp;logo=liberapay&amp;color=a51611" alt="Sponsor me on Liberapay"></a> 💌 <a href="https://img.shields.io/badge/donate-paypal-a51611.svg?style=flat&amp;logo=paypal"><img src="https://img.shields.io/badge/donate-paypal-a51611.svg?style=for-the-badge&amp;logo=paypal&amp;color=0A0A0A" alt="Donate on PayPal"></a></p>
532
+
533
+ <p>Thank you ☺️</p>
534
+
513
535
  </div></div>
514
536
 
515
537
  <div id="footer">
516
- Generated on Sun Aug 17 14:43:13 2025 by
538
+ Generated on Mon Aug 18 05:40:23 2025 by
517
539
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
518
540
  0.9.37 (ruby-3.4.5).
519
541
  </div>
@@ -100,7 +100,7 @@
100
100
  </div>
101
101
 
102
102
  <div id="footer">
103
- Generated on Sun Aug 17 14:43:14 2025 by
103
+ Generated on Mon Aug 18 05:40:23 2025 by
104
104
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
105
105
  0.9.37 (ruby-3.4.5).
106
106
  </div>
@@ -1,26 +1,5 @@
1
- # The MIT License (MIT)
2
-
3
- # Copyright (c) 2014-2017 Avant
4
-
5
- # Author Zach Taylor
6
-
7
- # Permission is hereby granted, free of charge, to any person obtaining a copy
8
- # of this software and associated documentation files (the "Software"), to deal
9
- # in the Software without restriction, including without limitation the rights
10
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- # copies of the Software, and to permit persons to whom the Software is
12
- # furnished to do so, subject to the following conditions:
13
-
14
- # The above copyright notice and this permission notice shall be included in
15
- # all copies or substantial portions of the Software.
16
-
17
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- # THE SOFTWARE.
1
+ # std lib
2
+ require "delegate"
24
3
 
25
4
  class Timecop
26
5
  module Rspec
@@ -51,7 +30,7 @@ class Timecop
51
30
  # Whether the example has local timecop metadata.
52
31
  # @return [Boolean]
53
32
  def local_timecop?
54
- local_timecop_method.present?
33
+ !local_timecop_method.nil?
55
34
  end
56
35
 
57
36
  # Whether a global time is configured and not skipped by the example.
@@ -1,27 +1,3 @@
1
- # The MIT License (MIT)
2
-
3
- # Copyright (c) 2014-2017 Avant
4
-
5
- # Author Zach Taylor
6
-
7
- # Permission is hereby granted, free of charge, to any person obtaining a copy
8
- # of this software and associated documentation files (the "Software"), to deal
9
- # in the Software without restriction, including without limitation the rights
10
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- # copies of the Software, and to permit persons to whom the Software is
12
- # furnished to do so, subject to the following conditions:
13
-
14
- # The above copyright notice and this permission notice shall be included in
15
- # all copies or substantial portions of the Software.
16
-
17
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- # THE SOFTWARE.
24
-
25
1
  require_relative "example_decorator"
26
2
  require_relative "traveler"
27
3
  require_relative "travel_log"
@@ -1,27 +1,3 @@
1
- # The MIT License (MIT)
2
-
3
- # Copyright (c) 2014-2017 Avant
4
-
5
- # Author Zach Taylor
6
-
7
- # Permission is hereby granted, free of charge, to any person obtaining a copy
8
- # of this software and associated documentation files (the "Software"), to deal
9
- # in the Software without restriction, including without limitation the rights
10
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- # copies of the Software, and to permit persons to whom the Software is
12
- # furnished to do so, subject to the following conditions:
13
-
14
- # The above copyright notice and this permission notice shall be included in
15
- # all copies or substantial portions of the Software.
16
-
17
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- # THE SOFTWARE.
24
-
25
1
  require "timecop"
26
2
 
27
3
  require_relative "example_decorator"
@@ -1,27 +1,3 @@
1
- # The MIT License (MIT)
2
-
3
- # Copyright (c) 2014-2017 Avant
4
-
5
- # Author Zach Taylor
6
-
7
- # Permission is hereby granted, free of charge, to any person obtaining a copy
8
- # of this software and associated documentation files (the "Software"), to deal
9
- # in the Software without restriction, including without limitation the rights
10
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- # copies of the Software, and to permit persons to whom the Software is
12
- # furnished to do so, subject to the following conditions:
13
-
14
- # The above copyright notice and this permission notice shall be included in
15
- # all copies or substantial portions of the Software.
16
-
17
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- # THE SOFTWARE.
24
-
25
1
  class Timecop
26
2
  module Rspec
27
3
  # Tracks details about a time travel operation that can be resumed later.
@@ -47,7 +23,7 @@ class Timecop
47
23
  # Pauses the current trip, recording its duration.
48
24
  # @return [void]
49
25
  def pause_trip
50
- self.trip_duration = Time.current - coalesced_start_time
26
+ self.trip_duration = Time.now - coalesced_start_time
51
27
  end
52
28
 
53
29
  private
@@ -75,7 +51,7 @@ class Timecop
75
51
  # The start time for resuming a trip including the elapsed duration.
76
52
  # @return [Object]
77
53
  def resume_trip
78
- coalesced_start_time + trip_duration.seconds
54
+ coalesced_start_time + trip_duration
79
55
  end
80
56
 
81
57
  # Coerces various time-like inputs into a Time-like baseline.
@@ -83,9 +59,11 @@ class Timecop
83
59
  def coalesced_start_time
84
60
  case start_time
85
61
  when DateTime
86
- start_time
62
+ # Convert to a Time in local zone to perform arithmetic in seconds
63
+ start_time.to_time
87
64
  when Date
88
- start_time.at_beginning_of_day
65
+ # Midnight in local time for the given date
66
+ Time.local(start_time.year, start_time.month, start_time.day, 0, 0, 0)
89
67
  when String
90
68
  Time.parse(start_time)
91
69
  else
@@ -1,27 +1,3 @@
1
- # The MIT License (MIT)
2
-
3
- # Copyright (c) 2014-2017 Avant
4
-
5
- # Author Zach Taylor
6
-
7
- # Permission is hereby granted, free of charge, to any person obtaining a copy
8
- # of this software and associated documentation files (the "Software"), to deal
9
- # in the Software without restriction, including without limitation the rights
10
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- # copies of the Software, and to permit persons to whom the Software is
12
- # furnished to do so, subject to the following conditions:
13
-
14
- # The above copyright notice and this permission notice shall be included in
15
- # all copies or substantial portions of the Software.
16
-
17
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- # THE SOFTWARE.
24
-
25
1
  class Timecop
26
2
  module Rspec
27
3
  # Runs an example, optionally continuing a travel across invocations.
@@ -1,34 +1,10 @@
1
- # The MIT License (MIT)
2
-
3
- # Copyright (c) 2014-2017 Avant
4
-
5
- # Author Zach Taylor
6
-
7
- # Permission is hereby granted, free of charge, to any person obtaining a copy
8
- # of this software and associated documentation files (the "Software"), to deal
9
- # in the Software without restriction, including without limitation the rights
10
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- # copies of the Software, and to permit persons to whom the Software is
12
- # furnished to do so, subject to the following conditions:
13
-
14
- # The above copyright notice and this permission notice shall be included in
15
- # all copies or substantial portions of the Software.
16
-
17
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- # THE SOFTWARE.
24
-
25
1
  class Timecop
26
2
  module Rspec
27
3
  # Version namespace for Timecop::Rspec.
28
4
  module Version
29
5
  # The gem version.
30
6
  # @return [String]
31
- VERSION = "1.0.0"
7
+ VERSION = "1.0.2"
32
8
  end
33
9
  # Convenience constant aliasing Version::VERSION
34
10
  # @return [String]
data/lib/timecop/rspec.rb CHANGED
@@ -1,29 +1,4 @@
1
- # The MIT License (MIT)
2
-
3
- # Copyright (c) 2014-2017 Avant
4
-
5
- # Author Zach Taylor
6
-
7
- # Permission is hereby granted, free of charge, to any person obtaining a copy
8
- # of this software and associated documentation files (the "Software"), to deal
9
- # in the Software without restriction, including without limitation the rights
10
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- # copies of the Software, and to permit persons to whom the Software is
12
- # furnished to do so, subject to the following conditions:
13
-
14
- # The above copyright notice and this permission notice shall be included in
15
- # all copies or substantial portions of the Software.
16
-
17
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- # THE SOFTWARE.
24
-
25
1
  require "timecop/rspec/version"
26
- require "active_support/all"
27
2
 
28
3
  Dir.glob(File.join(__dir__, "rspec", "**", "*.rb")).each { |file| require file }
29
4
 
@@ -56,7 +31,8 @@ class Timecop
56
31
  # Whether a global time has been configured via ENV.
57
32
  # @return [Boolean]
58
33
  def global_time_configured?
59
- global_time_travel_string.present?
34
+ str = global_time_travel_string
35
+ !(str.nil? || str == "")
60
36
  end
61
37
 
62
38
  # The globally configured time parsed from ENV.
@@ -23,8 +23,11 @@ Gem::Specification.new do |spec|
23
23
  spec.authors = ["Peter H. Boling", "Zach Taylor", "Tim Mertens"]
24
24
  spec.email = ["floss@galtzo.com"]
25
25
 
26
- spec.summary = "Timecop time-machines for RSpec"
27
- spec.description = "Help overlooked open source projects - the ones at the bottom of the stack, and the dev dependencies - by funding them."
26
+ spec.summary = "⌚️ Timecop time-machines for RSpec"
27
+ spec.description = "⌚️ Timecop::Rspec provides Timecop time-machines for RSpec that allow you" \
28
+ "to time-travel test examples, context/describes, and/or your entire test suite. " \
29
+ "Find out how your code will behave... in the future! " \
30
+ "Fund overlooked open source projects - bottom of stack, dev/test dependencies: floss-funding.dev"
28
31
  spec.homepage = "https://github.com/galtzo-floss/timecop-rspec"
29
32
  spec.license = "MIT"
30
33
  spec.required_ruby_version = ">= 1.9.2"
@@ -112,7 +115,7 @@ Gem::Specification.new do |spec|
112
115
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
113
116
  spec.require_paths = ["lib"]
114
117
 
115
- spec.add_dependency("activesupport", ">= 4.0") # ruby > 1.8.7
118
+ spec.add_dependency("delegate", "~> 0.1") # ruby > 0, for SimpleDelegator, newer versions drop support for older rubies
116
119
  spec.add_dependency("rspec", "~> 3.0") # ruby > 0
117
120
  spec.add_dependency("timecop", ">= 0.7", "< 1") # ruby >= 1.9.2, for time-based testing
118
121
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timecop-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter H. Boling
@@ -37,22 +37,22 @@ cert_chain:
37
37
  DVjBtqT23eugOqQ73umLcYDZkc36vnqGxUBSsXrzY9pzV5gGr2I8YUxMqf6ATrZt
38
38
  L9nRqA==
39
39
  -----END CERTIFICATE-----
40
- date: 2025-08-17 00:00:00.000000000 Z
40
+ date: 2025-08-18 00:00:00.000000000 Z
41
41
  dependencies:
42
42
  - !ruby/object:Gem::Dependency
43
- name: activesupport
43
+ name: delegate
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ">="
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '4.0'
48
+ version: '0.1'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ">="
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '4.0'
55
+ version: '0.1'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rspec
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -211,8 +211,10 @@ dependencies:
211
211
  - - "~>"
212
212
  - !ruby/object:Gem::Version
213
213
  version: '13.0'
214
- description: Help overlooked open source projects - the ones at the bottom of the
215
- stack, and the dev dependencies - by funding them.
214
+ description: "⌚️ Timecop::Rspec provides Timecop time-machines for RSpec that allow
215
+ youto time-travel test examples, context/describes, and/or your entire test suite.
216
+ Find out how your code will behave... in the future! Fund overlooked open source
217
+ projects - bottom of stack, dev/test dependencies: floss-funding.dev"
216
218
  email:
217
219
  - floss@galtzo.com
218
220
  executables: []
@@ -229,6 +231,10 @@ extra_rdoc_files:
229
231
  - SECURITY.md
230
232
  - checksums/timecop-rspec-1.0.0.gem.sha256
231
233
  - checksums/timecop-rspec-1.0.0.gem.sha512
234
+ - checksums/timecop-rspec-1.0.1.gem.sha256
235
+ - checksums/timecop-rspec-1.0.1.gem.sha512
236
+ - checksums/timecop-rspec-1.0.2.gem.sha256
237
+ - checksums/timecop-rspec-1.0.2.gem.sha512
232
238
  - sig/timecop.rbs
233
239
  - sig/timecop/rspec.rbs
234
240
  files:
@@ -321,6 +327,10 @@ files:
321
327
  - certs/pboling.pem
322
328
  - checksums/timecop-rspec-1.0.0.gem.sha256
323
329
  - checksums/timecop-rspec-1.0.0.gem.sha512
330
+ - checksums/timecop-rspec-1.0.1.gem.sha256
331
+ - checksums/timecop-rspec-1.0.1.gem.sha512
332
+ - checksums/timecop-rspec-1.0.2.gem.sha256
333
+ - checksums/timecop-rspec-1.0.2.gem.sha512
324
334
  - docs/Timecop.html
325
335
  - docs/Timecop/Rspec.html
326
336
  - docs/Timecop/Rspec/ExampleDecorator.html
@@ -344,6 +354,8 @@ files:
344
354
  - docs/file.RUBOCOP.html
345
355
  - docs/file.SECURITY.html
346
356
  - docs/file.rspec.html
357
+ - docs/file.timecop-rspec-1.0.0.gem.html
358
+ - docs/file.timecop-rspec-1.0.1.gem.html
347
359
  - docs/file.timecop.html
348
360
  - docs/file_list.html
349
361
  - docs/frames.html
@@ -387,10 +399,10 @@ licenses:
387
399
  - MIT
388
400
  metadata:
389
401
  homepage_uri: https://timecop-rspec.galtzo.com/
390
- source_code_uri: https://github.com/galtzo-floss/timecop-rspec/tree/v1.0.0
391
- changelog_uri: https://github.com/galtzo-floss/timecop-rspec/blob/v1.0.0/CHANGELOG.md
402
+ source_code_uri: https://github.com/galtzo-floss/timecop-rspec/tree/v1.0.2
403
+ changelog_uri: https://github.com/galtzo-floss/timecop-rspec/blob/v1.0.2/CHANGELOG.md
392
404
  bug_tracker_uri: https://github.com/galtzo-floss/timecop-rspec/issues
393
- documentation_uri: https://www.rubydoc.info/gems/timecop-rspec/1.0.0
405
+ documentation_uri: https://www.rubydoc.info/gems/timecop-rspec/1.0.2
394
406
  funding_uri: https://github.com/sponsors/pboling
395
407
  wiki_uri: https://github.com/galtzo-floss/timecop-rspec/wiki
396
408
  news_uri: https://www.railsbling.com/tags/timecop-rspec
@@ -398,7 +410,7 @@ metadata:
398
410
  rubygems_mfa_required: 'true'
399
411
  rdoc_options:
400
412
  - "--title"
401
- - timecop-rspec - Timecop time-machines for RSpec
413
+ - timecop-rspec - ⌚️ Timecop time-machines for RSpec
402
414
  - "--main"
403
415
  - checksums/**/*.sha256
404
416
  - checksums/**/*.sha512
@@ -430,5 +442,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
430
442
  requirements: []
431
443
  rubygems_version: 3.7.1
432
444
  specification_version: 4
433
- summary: Timecop time-machines for RSpec
445
+ summary: "⌚️ Timecop time-machines for RSpec"
434
446
  test_files: []
metadata.gz.sig CHANGED
Binary file