timecop-rspec 1.0.0

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 (155) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +0 -0
  3. data/.devcontainer/devcontainer.json +26 -0
  4. data/.env.local.example +3 -0
  5. data/.envrc +41 -0
  6. data/.github/FUNDING.yml +13 -0
  7. data/.github/dependabot.yml +12 -0
  8. data/.github/workflows/ancient.yml +77 -0
  9. data/.github/workflows/auto-assign.yml +21 -0
  10. data/.github/workflows/codeql-analysis.yml +70 -0
  11. data/.github/workflows/coverage.yml +126 -0
  12. data/.github/workflows/current.yml +85 -0
  13. data/.github/workflows/dependency-review.yml +20 -0
  14. data/.github/workflows/deps_locked.yml +75 -0
  15. data/.github/workflows/deps_unlocked.yml +84 -0
  16. data/.github/workflows/discord-notifier.yml +38 -0
  17. data/.github/workflows/heads.yml +84 -0
  18. data/.github/workflows/jruby.yml +75 -0
  19. data/.github/workflows/legacy.yml +67 -0
  20. data/.github/workflows/style.yml +64 -0
  21. data/.github/workflows/supported.yml +82 -0
  22. data/.github/workflows/truffle.yml +75 -0
  23. data/.github/workflows/unsupported.yml +75 -0
  24. data/.gitignore +45 -0
  25. data/.gitlab-ci.yml +44 -0
  26. data/.idea/.gitignore +8 -0
  27. data/.idea/GitLink.xml +6 -0
  28. data/.idea/misc.xml +4 -0
  29. data/.idea/modules.xml +8 -0
  30. data/.idea/timecop-rspec.iml +120 -0
  31. data/.idea/vcs.xml +6 -0
  32. data/.junie/TASK_NOTE.md +1 -0
  33. data/.junie/guidelines.md +139 -0
  34. data/.qlty/qlty.toml +79 -0
  35. data/.rspec +8 -0
  36. data/.rubocop.yml +15 -0
  37. data/.rubocop_gradual.lock +76 -0
  38. data/.simplecov +11 -0
  39. data/.tool-versions +1 -0
  40. data/.yard_gfm_support.rb +22 -0
  41. data/.yardopts +11 -0
  42. data/Appraisal.root.gemfile +12 -0
  43. data/Appraisals +104 -0
  44. data/CHANGELOG.md +27 -0
  45. data/CITATION.cff +20 -0
  46. data/CNAME +1 -0
  47. data/CODE_OF_CONDUCT.md +134 -0
  48. data/CONTRIBUTING.md +145 -0
  49. data/Gemfile +38 -0
  50. data/Gemfile.lock +315 -0
  51. data/LICENSE.txt +22 -0
  52. data/README.md +563 -0
  53. data/REEK +0 -0
  54. data/RUBOCOP.md +71 -0
  55. data/Rakefile +287 -0
  56. data/SECURITY.md +21 -0
  57. data/bin/appraisal +16 -0
  58. data/bin/bundle-audit +16 -0
  59. data/bin/bundler-audit +16 -0
  60. data/bin/code_climate_reek +16 -0
  61. data/bin/coderay +16 -0
  62. data/bin/console +38 -0
  63. data/bin/erb +16 -0
  64. data/bin/gem_checksums +16 -0
  65. data/bin/htmldiff +16 -0
  66. data/bin/irb +16 -0
  67. data/bin/kramdown +16 -0
  68. data/bin/ldiff +16 -0
  69. data/bin/nokogiri +16 -0
  70. data/bin/pry +16 -0
  71. data/bin/racc +16 -0
  72. data/bin/rake +16 -0
  73. data/bin/rdbg +16 -0
  74. data/bin/rdoc +16 -0
  75. data/bin/reek +16 -0
  76. data/bin/ri +16 -0
  77. data/bin/rspec +16 -0
  78. data/bin/rubocop +16 -0
  79. data/bin/rubocop-gradual +16 -0
  80. data/bin/ruby-parse +16 -0
  81. data/bin/ruby-rewrite +16 -0
  82. data/bin/setup +33 -0
  83. data/bin/standardrb +16 -0
  84. data/bin/thor +16 -0
  85. data/bin/yard +16 -0
  86. data/bin/yard-junk +16 -0
  87. data/bin/yardoc +16 -0
  88. data/bin/yri +16 -0
  89. data/certs/pboling.pem +27 -0
  90. data/checksums/timecop-rspec-1.0.0.gem.sha256 +1 -0
  91. data/checksums/timecop-rspec-1.0.0.gem.sha512 +1 -0
  92. data/docs/Timecop/Rspec/ExampleDecorator.html +626 -0
  93. data/docs/Timecop/Rspec/SequentialTimeMachine.html +338 -0
  94. data/docs/Timecop/Rspec/TimeMachine.html +357 -0
  95. data/docs/Timecop/Rspec/TravelLog.html +440 -0
  96. data/docs/Timecop/Rspec/Traveler.html +353 -0
  97. data/docs/Timecop/Rspec/Version.html +154 -0
  98. data/docs/Timecop/Rspec.html +474 -0
  99. data/docs/Timecop.html +149 -0
  100. data/docs/_index.html +218 -0
  101. data/docs/class_list.html +54 -0
  102. data/docs/css/common.css +1 -0
  103. data/docs/css/full_list.css +58 -0
  104. data/docs/css/style.css +503 -0
  105. data/docs/file.CHANGELOG.html +99 -0
  106. data/docs/file.CITATION.html +92 -0
  107. data/docs/file.CODE_OF_CONDUCT.html +201 -0
  108. data/docs/file.CONTRIBUTING.html +220 -0
  109. data/docs/file.LICENSE.html +70 -0
  110. data/docs/file.README.html +523 -0
  111. data/docs/file.REEK.html +71 -0
  112. data/docs/file.RUBOCOP.html +171 -0
  113. data/docs/file.SECURITY.html +101 -0
  114. data/docs/file.rspec.html +109 -0
  115. data/docs/file.timecop.html +72 -0
  116. data/docs/file_list.html +109 -0
  117. data/docs/frames.html +22 -0
  118. data/docs/index.html +523 -0
  119. data/docs/js/app.js +344 -0
  120. data/docs/js/full_list.js +242 -0
  121. data/docs/js/jquery.js +4 -0
  122. data/docs/method_list.html +198 -0
  123. data/docs/top-level-namespace.html +110 -0
  124. data/gemfiles/audit.gemfile +10 -0
  125. data/gemfiles/coverage.gemfile +10 -0
  126. data/gemfiles/current.gemfile +8 -0
  127. data/gemfiles/deps_unlocked.gemfile +13 -0
  128. data/gemfiles/head.gemfile +9 -0
  129. data/gemfiles/modular/audit.gemfile +5 -0
  130. data/gemfiles/modular/coverage.gemfile +6 -0
  131. data/gemfiles/modular/documentation.gemfile +11 -0
  132. data/gemfiles/modular/style.gemfile +14 -0
  133. data/gemfiles/ruby_2_3.gemfile +5 -0
  134. data/gemfiles/ruby_2_4.gemfile +5 -0
  135. data/gemfiles/ruby_2_5.gemfile +5 -0
  136. data/gemfiles/ruby_2_6.gemfile +8 -0
  137. data/gemfiles/ruby_2_7.gemfile +8 -0
  138. data/gemfiles/ruby_3_0.gemfile +8 -0
  139. data/gemfiles/ruby_3_1.gemfile +8 -0
  140. data/gemfiles/ruby_3_2.gemfile +8 -0
  141. data/gemfiles/ruby_3_3.gemfile +8 -0
  142. data/gemfiles/style.gemfile +10 -0
  143. data/lib/timecop/rspec/example_decorator.rb +100 -0
  144. data/lib/timecop/rspec/sequential_time_machine.rb +80 -0
  145. data/lib/timecop/rspec/time_machine.rb +58 -0
  146. data/lib/timecop/rspec/travel_log.rb +103 -0
  147. data/lib/timecop/rspec/traveler.rb +68 -0
  148. data/lib/timecop/rspec/version.rb +37 -0
  149. data/lib/timecop/rspec.rb +78 -0
  150. data/sig/timecop/rspec.rbs +40 -0
  151. data/sig/timecop.rbs +2 -0
  152. data/timecop-rspec.gemspec +146 -0
  153. data.tar.gz.sig +2 -0
  154. metadata +434 -0
  155. metadata.gz.sig +0 -0
data/README.md ADDED
@@ -0,0 +1,563 @@
1
+ [![Galtzo FLOSS Logo by Aboling0, CC BY-SA 4.0][🖼️galtzo-i]][🖼️galtzo-discord] [![ruby-lang Logo, Yukihiro Matsumoto, Ruby Visual Identity Team, CC BY-SA 2.5][🖼️ruby-lang-i]][🖼️ruby-lang] [![timecop-rspec Logo by Aboling0, CC BY-SA 4.0][🖼️timecop-rspec-i]][🖼️timecop-rspec]
2
+
3
+ [🖼️galtzo-i]: https://logos.galtzo.com/assets/images/galtzo-floss/avatar-192px.svg
4
+ [🖼️galtzo-discord]: https://discord.gg/3qme4XHNKN
5
+ [🖼️ruby-lang-i]: https://logos.galtzo.com/assets/images/ruby-lang/avatar-192px.svg
6
+ [🖼️ruby-lang]: https://www.ruby-lang.org/
7
+ [🖼️timecop-rspec-i]: https://logos.galtzo.com/assets/images/galtzo-floss/timecop-rspec/avatar-192px.svg
8
+ [🖼️timecop-rspec]: https://github.com/galtzo-floss/timecop-rspec
9
+
10
+ # ⌚️ Timecop::Rspec
11
+
12
+ [![Version][👽versioni]][👽version] [![License: MIT][📄license-img]][📄license-ref] [![Downloads Rank][👽dl-ranki]][👽dl-rank] [![Open Source Helpers][👽oss-helpi]][👽oss-help] [![Coveralls Test Coverage][🔑coveralls-img]][🔑coveralls] [![CodeCov Test Coverage][🔑codecovi♻️]][🔑codecov] [![QLTY Test Coverage][🔑qlty-covi]][🔑qlty-cov] [![QLTY Maintainability][🔑qlty-mnti]][🔑qlty-mnt] [![CI Heads][🚎3-hd-wfi]][🚎3-hd-wf] [![CI Current][🚎11-c-wfi]][🚎11-c-wf] [![CI Truffle Ruby][🚎9-t-wfi]][🚎9-t-wf] [![CI JRuby][🚎10-j-wfi]][🚎10-j-wf] [![Deps Locked][🚎13-🔒️-wfi]][🚎13-🔒️-wf] [![Deps Unlocked][🚎14-🔓️-wfi]][🚎14-🔓️-wf] [![CI Supported][🚎6-s-wfi]][🚎6-s-wf] [![CI Legacy][🚎4-lg-wfi]][🚎4-lg-wf] [![CI Unsupported][🚎7-us-wfi]][🚎7-us-wf] [![CI Ancient][🚎1-an-wfi]][🚎1-an-wf] [![CI Test Coverage][🚎2-cov-wfi]][🚎2-cov-wf] [![CI Style][🚎5-st-wfi]][🚎5-st-wf]
13
+
14
+ ---
15
+
16
+ [![Liberapay Goal Progress][⛳liberapay-img]][⛳liberapay] [![Sponsor Me on Github][🖇sponsor-img]][🖇sponsor] [![Buy me a coffee][🖇buyme-small-img]][🖇buyme] [![Donate on Polar][🖇polar-img]][🖇polar] [![Donate to my FLOSS or refugee efforts at ko-fi.com][🖇kofi-img]][🖇kofi] [![Donate to my FLOSS or refugee efforts using Patreon][🖇patreon-img]][🖇patreon]
17
+
18
+ ## 🌻 Synopsis
19
+
20
+ [Timecop::Rspec](https://github.com/avantoss/timecop-rspec) provides [Timecop](https://github.com/travisjeffery/timecop) time-machines for [RSpec](https://github.com/rspec/rspec) that allow you to time-travel test examples, context/describes, and/or your entire test suite.
21
+
22
+ The gem was never released by its original author, who later moved on to work in other languages.
23
+ [Zach Taylor](https://github.com/taylorzr) did a great job with it,
24
+ and people have been [hoping it would be published](https://github.com/avantoss/timecop-rspec/issues/2).
25
+ It has a great API, and I was about to build this exact thing myself, so I am glad I found this.
26
+ I've modernized everything, added more tests and documentation, and released it.
27
+ Thanks to the long-term stability of both RSpec and Timecop, the original code still works perfectly.
28
+
29
+ I expect the current release of this gem to be compatible with Ruby 1.9.2+,
30
+ but it is only tested on CI against Ruby 2.3+,
31
+ due to the inherent limitations of GitHub Actions.
32
+
33
+ <details>
34
+ <summary>Alternative Libraries</summary>
35
+
36
+ I have only found one, but it didn't have the API I wanted.
37
+
38
+ - [rspec-timecop](https://github.com/sugarcrm/rspec-timecop) - A very different approach
39
+
40
+ </details>
41
+
42
+ | 🚚 _Amazing_ test matrix was brought to you by | 🔎 appraisal2 🔎 |
43
+ |------------------------------------------------|-------------------------------------------------------------------------------------|
44
+ | 👟 Check it out! | ✨ [github.com/appraisal-rb/appraisal2][💎appraisal2] ✨ |
45
+
46
+ ## 💡 Info you can shake a stick at
47
+
48
+ ### Federated DVCS
49
+
50
+ <details>
51
+ <summary>Find this repo on other forges (Coming soon!)</summary>
52
+
53
+ | Federated [DVCS][💎d-in-dvcs] Repository | Status | Issues | PRs | Wiki | CI | Discussions |
54
+ |-------------------------------------------------------|-------------------------------------------------------------------|---------------------------|--------------------------|---------------------------|--------------------------|------------------------------|
55
+ | 🧪 [galtzo-floss/timecop-rspec on GitLab][📜src-gl] | The Truth | [💚][🤝gl-issues] | [💚][🤝gl-pulls] | [💚][📜wiki] | 🏀 Tiny Matrix | ➖ |
56
+ | 🧊 [galtzo-floss/timecop-rspec on CodeBerg][📜src-cb] | An Ethical Mirror ([Donate][🤝cb-donate]) | [💚][🤝cb-issues] | [💚][🤝cb-pulls] | ➖ | ⭕️ No Matrix | ➖ |
57
+ | 🐙 [galtzo-floss/timecop-rspec on GitHub][📜src-gh] | A Dirty Mirror | [💚][🤝gh-issues] | [💚][🤝gh-pulls] | ➖ | 💯 Full Matrix | [💚][gh-discussions] |
58
+ | 🎮️ [Discord Server][✉️discord-invite] | [![Live Chat on Discord][✉️discord-invite-img]][✉️discord-invite] | [Let's][✉️discord-invite] | [talk][✉️discord-invite] | [about][✉️discord-invite] | [this][✉️discord-invite] | [library!][✉️discord-invite] |
59
+
60
+ </details>
61
+
62
+ [gh-discussions]: https://github.com/galtzo-floss/timecop-rspec/discussions
63
+
64
+ ### Enterprise Support [![Tidelift](https://tidelift.com/badges/package/rubygems/timecop-rspec)](https://tidelift.com/subscription/pkg/rubygems-timecop-rspec?utm_source=rubygems-timecop-rspec&utm_medium=referral&utm_campaign=readme)
65
+
66
+ <details>
67
+ <summary>Need enterprise-level guarantees?</summary>
68
+
69
+ [![Get help from me on Tidelift][🏙️entsup-tidelift-img]][🏙️entsup-tidelift]
70
+
71
+ - 💡Subscribe for support guarantees covering _all_ FLOSS dependencies
72
+ - 💡Tidelift is part of [Sonar][🏙️entsup-tidelift-sonar]
73
+ - 💡Tidelift pays maintainers to maintain the software you depend on!<br/>📊`@`Pointy Haired Boss: An [enterprise support][🏙️entsup-tidelift] subscription is "[never gonna let you down][🧮kloc]", and *supports* open source maintainers
74
+
75
+ Alternatively:
76
+
77
+ - [![Live Chat on Discord][✉️discord-invite-img]][✉️discord-invite]
78
+ - [![Get help from me on Upwork][👨🏼‍🏫expsup-upwork-img]][👨🏼‍🏫expsup-upwork]
79
+ - [![Get help from me on Codementor][👨🏼‍🏫expsup-codementor-img]][👨🏼‍🏫expsup-codementor]
80
+
81
+ </details>
82
+
83
+ | Tokens to Remember | [![Gem name][⛳️name-img]][⛳️gem-name] [![Gem namespace][⛳️namespace-img]][⛳️gem-namespace] |
84
+ |-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
85
+ | Works with JRuby | ![JRuby 9.1 Compat][💎jruby-9.1i] ![JRuby 9.2 Compat][💎jruby-9.2i] <br/> [![JRuby 9.3 Compat][💎jruby-9.3i]][🚎10-j-wf] [![JRuby 9.4 Compat][💎jruby-9.4i]][🚎10-j-wf] [![JRuby 10.0 Compat][💎jruby-c-i]][🚎11-c-wf] [![JRuby HEAD Compat][💎jruby-headi]][🚎3-hd-wf] |
86
+ | Works with Truffle Ruby | ![Truffle Ruby 22.3 Compat][💎truby-22.3i] <br/> [![Truffle Ruby 23.0 Compat][💎truby-23.0i]][🚎9-t-wf] [![Truffle Ruby 23.1 Compat][💎truby-23.1i]][🚎9-t-wf] [![Truffle Ruby 24.1 Compat][💎truby-c-i]][🚎11-c-wf] |
87
+ | Works with MRI Ruby 3 | [![Ruby 3.0 Compat][💎ruby-3.0i]][🚎4-lg-wf] [![Ruby 3.1 Compat][💎ruby-3.1i]][🚎6-s-wf] [![Ruby 3.2 Compat][💎ruby-3.2i]][🚎6-s-wf] [![Ruby 3.3 Compat][💎ruby-3.3i]][🚎6-s-wf] [![Ruby 3.4 Compat][💎ruby-c-i]][🚎11-c-wf] [![Ruby HEAD Compat][💎ruby-headi]][🚎3-hd-wf] |
88
+ | Works with MRI Ruby 2 | ![Ruby 2.0 Compat][💎ruby-2.0i] ![Ruby 2.1 Compat][💎ruby-2.1i] ![Ruby 2.2 Compat][💎ruby-2.2i] <br/> [![Ruby 2.3 Compat][💎ruby-2.3i]][🚎1-an-wf] [![Ruby 2.4 Compat][💎ruby-2.4i]][🚎1-an-wf] [![Ruby 2.5 Compat][💎ruby-2.5i]][🚎1-an-wf] [![Ruby 2.6 Compat][💎ruby-2.6i]][🚎7-us-wf] [![Ruby 2.7 Compat][💎ruby-2.7i]][🚎7-us-wf] |
89
+ | Works with MRI Ruby 1 | ![Ruby 1.9 Compat][💎ruby-1.9i] |
90
+ | Source | [![Source on GitLab.com][📜src-gl-img]][📜src-gl] [![Source on CodeBerg.org][📜src-cb-img]][📜src-cb] [![Source on Github.com][📜src-gh-img]][📜src-gh] [![The best SHA: dQw4w9WgXcQ!][🧮kloc-img]][🧮kloc] |
91
+ | Documentation | [![Current release on RubyDoc.info][📜docs-cr-rd-img]][🚎yard-current] [![YARD on Galtzo.com][📜docs-head-rd-img]][🚎yard-head] [![Maintainer Blog][🚂maint-blog-img]][🚂maint-blog] [![Wiki][📜wiki-img]][📜wiki] |
92
+ | Compliance | [![License: MIT][📄license-img]][📄license-ref] [![📄ilo-declaration-img]][📄ilo-declaration] [![Security Policy][🔐security-img]][🔐security] [![Contributor Covenant 2.1][🪇conduct-img]][🪇conduct] [![SemVer 2.0.0][📌semver-img]][📌semver] |
93
+ | Style | [![Enforced Code Style Linter][💎rlts-img]][💎rlts] [![Keep-A-Changelog 1.0.0][📗keep-changelog-img]][📗keep-changelog] [![Gitmoji Commits][📌gitmoji-img]][📌gitmoji] [![Compatibility appraised by: appraisal2][💎appraisal2-img]][💎appraisal2] |
94
+ | Support | [![Live Chat on Discord][✉️discord-invite-img]][✉️discord-invite] [![Get help from me on Upwork][👨🏼‍🏫expsup-upwork-img]][👨🏼‍🏫expsup-upwork] [![Get help from me on Codementor][👨🏼‍🏫expsup-codementor-img]][👨🏼‍🏫expsup-codementor] |
95
+ | Maintainer 🎖️ | [![Follow Me on LinkedIn][💖🖇linkedin-img]][💖🖇linkedin] [![Follow Me on Ruby.Social][💖🐘ruby-mast-img]][💖🐘ruby-mast] [![Follow Me on Bluesky][💖🦋bluesky-img]][💖🦋bluesky] [![Contact Maintainer][🚂maint-contact-img]][🚂maint-contact] [![My technical writing][💖💁🏼‍♂️devto-img]][💖💁🏼‍♂️devto] |
96
+ | `...` 💖 | [![Find Me on WellFound:][💖✌️wellfound-img]][💖✌️wellfound] [![Find Me on CrunchBase][💖💲crunchbase-img]][💖💲crunchbase] [![My LinkTree][💖🌳linktree-img]][💖🌳linktree] [![More About Me][💖💁🏼‍♂️aboutme-img]][💖💁🏼‍♂️aboutme] [🧊][💖🧊berg] [🐙][💖🐙hub] [🛖][💖🛖hut] [🧪][💖🧪lab] |
97
+
98
+ ## ✨ Installation
99
+
100
+ Install the gem and add to the application's Gemfile by executing:
101
+
102
+ $ bundle add timecop-rspec
103
+
104
+ If bundler is not being used to manage dependencies, install the gem by executing:
105
+
106
+ $ gem install timecop-rspec
107
+
108
+ ### 🔒 Secure Installation
109
+
110
+ <details>
111
+ <summary>For Medium or High Security Installations</summary>
112
+
113
+ This gem is cryptographically signed, and has verifiable [SHA-256 and SHA-512][💎SHA_checksums] checksums by
114
+ [stone_checksums][💎stone_checksums]. Be sure the gem you install hasn’t been tampered with
115
+ by following the instructions below.
116
+
117
+ Add my public key (if you haven’t already, expires 2045-04-29) as a trusted certificate:
118
+
119
+ ```console
120
+ gem cert --add <(curl -Ls https://raw.github.com/galtzo-floss/certs/main/pboling.pem)
121
+ ```
122
+
123
+ You only need to do that once. Then proceed to install with:
124
+
125
+ ```console
126
+ gem install timecop-rspec -P HighSecurity
127
+ ```
128
+
129
+ The `HighSecurity` trust profile will verify signed gems, and not allow the installation of unsigned dependencies.
130
+
131
+ If you want to up your security game full-time:
132
+
133
+ ```console
134
+ bundle config set --global trust-policy MediumSecurity
135
+ ```
136
+
137
+ `MediumSecurity` instead of `HighSecurity` is necessary if not all the gems you use are signed.
138
+
139
+ NOTE: Be prepared to track down certs for signed gems and add them the same way you added mine.
140
+
141
+ </details>
142
+
143
+ ## ⚙️ Configuration
144
+
145
+ #### Regular Time Machine
146
+
147
+ ```ruby
148
+ # spec_helper.rb or some configuration file loaded by spec_helper.rb
149
+
150
+ require "timecop/rspec"
151
+
152
+ RSpec.configure do |config|
153
+ config.around(:example) do |example|
154
+ Timecop::Rspec.time_machine.run(example)
155
+ end
156
+ end
157
+ ```
158
+
159
+ The regular time machine will run each example at the time specified by the
160
+ RSpec metadata, or the global travel time.
161
+
162
+ #### Sequential Time Machine
163
+
164
+ ```ruby
165
+ # spec_helper.rb or some configuration file loaded by spec_helper.rb
166
+
167
+ require "timecop/rspec"
168
+
169
+ RSpec.configure do |config|
170
+ config.around(:example) do |example|
171
+ Timecop::Rspec.time_machine(:sequential => true).run(example)
172
+ end
173
+ end
174
+ ```
175
+
176
+ The sequential time machine is almost the same as the regular time machine,
177
+ except that it will sometimes resume time travel.
178
+
179
+ Global travel will always resume from when the previous global traveled
180
+ example ended. E.g.
181
+ ```ruby
182
+ # GLOBAL_TIME_TRAVEL_TIME=2014-11-15 bundle exec rspec some_spec.rb
183
+
184
+ it "example 1" do
185
+ Time.now # => 2014-11-15 00:00:00
186
+ sleep 6
187
+ end
188
+
189
+ it "example 2" do
190
+ Time.now # => 2014-11-15 00:00:06 (resumed from end of previous example)
191
+ end
192
+ ```
193
+
194
+ Following local travel will resume when specified time is the same as the
195
+ previous examples specified time. If the time is different, it will
196
+ start from the current examples specified time.
197
+ ```ruby
198
+ describe SomeUnit, :travel => Time.new(2014, 11, 15) do
199
+ it "example 1" do
200
+ Time.now # => 2014-11-15 00:00:00
201
+ sleep 6
202
+ end
203
+
204
+ it "example 2" do
205
+ Time.now # => 2014-11-15 00:00:06 (resumed from end of previous example)
206
+ end
207
+
208
+ it "example 3", :travel => Time.new(1982, 6, 16) do
209
+ Time.now # => 1982-06-16 00:00:00
210
+ end
211
+ end
212
+ ```
213
+
214
+ ## 🔧 Basic Usage
215
+
216
+ #### Local Time Travel
217
+
218
+ Timecop.travel/freeze any RSpec (describe|context|example) with
219
+ `:travel` or `:freeze` metadata.
220
+
221
+ ```ruby
222
+ # Timecop.travel
223
+ it "some description", :travel => Time.new(2014, 11, 15) do
224
+ Time.now # 2014-11-15 00:00:00
225
+ sleep 6
226
+ Time.now # 2014-11-15 00:00:06 (6 seconds later)
227
+ end
228
+
229
+ # Timecop.freeze
230
+ it "some description", :freeze => Time.new(2014, 11, 15) do
231
+ Time.now # 2014-11-15 00:00:00
232
+ sleep 6
233
+ Time.now # 2014-11-15 00:00:00 (Ruby's time hasn't advanced)
234
+ end
235
+ ```
236
+
237
+ #### Global Time Travel
238
+
239
+ Using global time travel will Timecop.travel any example that isn't
240
+ already time traveling. I.e. example level timecop metadata will take
241
+ precedence.
242
+
243
+ ```sh
244
+ GLOBAL_TIME_TRAVEL_TIME=2014-11-15 bundle exec rspec spec/some_directory/
245
+ ```
246
+
247
+ The global time travel can also be skipped. You may want to skip
248
+ time travel when testing with some external service, such as redis,
249
+ where you can't modify time the same way as within ruby.
250
+
251
+ ```ruby
252
+ it "some example that can't time travel", :skip_global_travel do
253
+ # Time.now will be real time
254
+ end
255
+ ```
256
+
257
+ ## 🦷 FLOSS Funding
258
+
259
+ > How wonderful it is that nobody need wait a single moment before starting to improve the world.<br/>
260
+ >—Anne Frank
261
+
262
+ I’m driven by a passion to foster a thriving open-source community – a space where people can tackle complex problems, no matter how small. Revitalizing libraries that have fallen into disrepair, and building new libraries focused on solving real-world challenges, are my passions — totaling 79 hours of FLOSS coding over just the past seven days, a pretty regular week for me. I was recently affected by layoffs, and the tech jobs market is unwelcoming. I’m reaching out here because your support would significantly aid my efforts to provide for my family, and my farm (11 🐔 chickens, 2 🐶 dogs, 3 🐰 rabbits, 8 🐈‍ cats).
263
+
264
+ 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 `bundle fund`.
265
+
266
+ I’m developing a new library, [floss_funding][🖇floss-funding-gem], 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.
267
+
268
+ **[Floss-Funding.dev][🖇floss-funding.dev]: 👉️ No network calls. 👉️ No tracking. 👉️ No oversight. 👉️ Minimal crypto hashing. 💡 Easily disabled nags**
269
+
270
+ [![Liberapay Goal Progress][⛳liberapay-img]][⛳liberapay] [![Donate on PayPal][🖇paypal-img]][🖇paypal] [![Sponsor Me on Github][🖇sponsor-img]][🖇sponsor] [![Buy me a coffee][🖇buyme-small-img]][🖇buyme] [![Donate on Polar][🖇polar-img]][🖇polar] [![Donate to my FLOSS or refugee efforts at ko-fi.com][🖇kofi-img]][🖇kofi] [![Donate to my FLOSS or refugee efforts using Patreon][🖇patreon-img]][🖇patreon]
271
+
272
+ ## 🔐 Security
273
+
274
+ See [SECURITY.md][🔐security].
275
+
276
+ ## 🤝 Contributing
277
+
278
+ If you need some ideas of where to help, you could work on adding more code coverage,
279
+ or if it is already 💯 (see [below](#code-coverage)) check [reek](REEK), [issues][🤝gh-issues], or [PRs][🤝gh-pulls],
280
+ or use the gem and think about how it could be better.
281
+
282
+ We [![Keep A Changelog][📗keep-changelog-img]][📗keep-changelog] so if you make changes, remember to update it.
283
+
284
+ See [CONTRIBUTING.md][🤝contributing] for more detailed instructions.
285
+
286
+ ### 🚀 Release Instructions
287
+
288
+ See [CONTRIBUTING.md][🤝contributing].
289
+
290
+ ### Code Coverage
291
+
292
+ [![Coverage Graph][🔑codecov-g♻️]][🔑codecov]
293
+
294
+ [![Coveralls Test Coverage][🔑coveralls-img]][🔑coveralls]
295
+
296
+ [![QLTY Test Coverage][🔑qlty-covi]][🔑qlty-cov]
297
+
298
+ ### 🪇 Code of Conduct
299
+
300
+ Everyone interacting with this project's codebases, issue trackers,
301
+ chat rooms and mailing lists agrees to follow the [![Contributor Covenant 2.1][🪇conduct-img]][🪇conduct].
302
+
303
+ ## 🌈 Contributors
304
+
305
+ [![Contributors][🖐contributors-img]][🖐contributors]
306
+
307
+ Made with [contributors-img][🖐contrib-rocks].
308
+
309
+ Also see GitLab Contributors: [https://gitlab.com/galtzo-floss/timecop-rspec/-/graphs/main][🚎contributors-gl]
310
+
311
+ ## ⭐️ Star History
312
+
313
+ <a href="https://star-history.com/#galtzo-floss/timecop-rspec&Date">
314
+ <picture>
315
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=galtzo-floss/timecop-rspec&type=Date&theme=dark" />
316
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=galtzo-floss/timecop-rspec&type=Date" />
317
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=galtzo-floss/timecop-rspec&type=Date" />
318
+ </picture>
319
+ </a>
320
+
321
+ ## 📌 Versioning
322
+
323
+ This Library adheres to [![Semantic Versioning 2.0.0][📌semver-img]][📌semver].
324
+ Violations of this scheme should be reported as bugs.
325
+ Specifically, if a minor or patch version is released that breaks backward compatibility,
326
+ a new version should be immediately released that restores compatibility.
327
+ Breaking changes to the public API will only be introduced with new major versions.
328
+
329
+ > dropping support for a platform is both obviously and objectively a breaking change <br/>
330
+ >—Jordan Harband ([@ljharb](https://github.com/ljharb), maintainer of SemVer) [in SemVer issue 716][📌semver-breaking]
331
+
332
+ I understand that policy doesn't work universally ("exceptions to every rule!"),
333
+ but it is the policy here.
334
+ As such, in many cases it is good to specify a dependency on this library using
335
+ the [Pessimistic Version Constraint][📌pvc] with two digits of precision.
336
+
337
+ For example:
338
+
339
+ ```ruby
340
+ spec.add_dependency("timecop-rspec", "~> 1.0")
341
+ ```
342
+
343
+ <details>
344
+ <summary>📌 Is "Platform Support" part of the public API? More details inside.</summary>
345
+
346
+ SemVer should, but doesn't explicitly, say that dropping support for specific Platforms
347
+ is a *breaking change* to an API.
348
+ It is obvious to many, but not all, and since the spec is silent, the bike shedding is endless.
349
+
350
+ To get a better understanding of how SemVer is intended to work over a project's lifetime,
351
+ read this article from the creator of SemVer:
352
+
353
+ - ["Major Version Numbers are Not Sacred"][📌major-versions-not-sacred]
354
+
355
+ </details>
356
+
357
+ See [CHANGELOG.md][📌changelog] for a list of releases.
358
+
359
+ ## 📄 License
360
+
361
+ The gem is available as open source under the terms of
362
+ the [MIT License][📄license] [![License: MIT][📄license-img]][📄license-ref].
363
+ See [LICENSE.txt][📄license] for the official [Copyright Notice][📄copyright-notice-explainer].
364
+
365
+ ### © Copyright
366
+
367
+ <ul>
368
+ <li>
369
+ Copyright (c) 2025 Peter H. Boling, of
370
+ <a href="https://discord.gg/3qme4XHNKN">
371
+ Galtzo.com
372
+ <picture>
373
+ <img src="https://logos.galtzo.com/assets/images/galtzo-floss/avatar-128px-blank.svg" alt="Galtzo.com Logo (Wordless) by Aboling0, CC BY-SA 4.0" width="24">
374
+ </picture>
375
+ </a>, and timecop-rspec contributors.
376
+ </li>
377
+ <li>Copyright (c) 2014-2017 Zach Taylor & Avant</li>
378
+ </ul>
379
+
380
+ P.S. If you need help️ or want to say thanks, 👇 Join the Discord.
381
+
382
+ [![Live Chat on Discord][✉️discord-invite-img]][✉️discord-invite]
383
+
384
+ [⛳liberapay-img]: https://img.shields.io/liberapay/goal/pboling.svg?logo=liberapay&color=a51611
385
+ [⛳liberapay]: https://liberapay.com/pboling/donate
386
+ [🖇sponsor-img]: https://img.shields.io/badge/Sponsor_Me!-pboling.svg?style=social&logo=github
387
+ [🖇sponsor]: https://github.com/sponsors/pboling
388
+ [🖇polar-img]: https://img.shields.io/badge/polar-donate-a51611.svg
389
+ [🖇polar]: https://polar.sh/pboling
390
+ [🖇kofi-img]: https://img.shields.io/badge/ko--fi-✓-a51611.svg
391
+ [🖇kofi]: https://ko-fi.com/O5O86SNP4
392
+ [🖇patreon-img]: https://img.shields.io/badge/patreon-donate-a51611.svg
393
+ [🖇patreon]: https://patreon.com/galtzo
394
+ [🖇buyme-small-img]: https://img.shields.io/badge/buy_me_a_coffee-✓-a51611.svg?style=flat
395
+ [🖇buyme-img]: https://img.buymeacoffee.com/button-api/?text=Buy%20me%20a%20latte&emoji=&slug=pboling&button_colour=FFDD00&font_colour=000000&font_family=Cookie&outline_colour=000000&coffee_colour=ffffff
396
+ [🖇buyme]: https://www.buymeacoffee.com/pboling
397
+ [🖇paypal-img]: https://img.shields.io/badge/donate-paypal-a51611.svg?style=flat&logo=paypal
398
+ [🖇paypal]: https://www.paypal.com/paypalme/peterboling
399
+ [🖇floss-funding.dev]: https://floss-funding.dev
400
+ [🖇floss-funding-gem]: https://github.com/galtzo-floss/timecop-rspec
401
+ [✉️discord-invite]: https://discord.gg/3qme4XHNKN
402
+ [✉️discord-invite-img]: https://img.shields.io/discord/1373797679469170758?style=for-the-badge
403
+
404
+ [✇bundle-group-pattern]: https://gist.github.com/pboling/4564780
405
+ [⛳️gem-namespace]: https://github.com/galtzo-floss/timecop-rspec
406
+ [⛳️namespace-img]: https://img.shields.io/badge/namespace-FlossFunding-brightgreen.svg?style=flat&logo=ruby&logoColor=white
407
+ [⛳️gem-name]: https://rubygems.org/gems/timecop-rspec
408
+ [⛳️name-img]: https://img.shields.io/badge/name-floss__funding-brightgreen.svg?style=flat&logo=rubygems&logoColor=red
409
+ [🚂maint-blog]: http://www.railsbling.com/tags/timecop-rspec
410
+ [🚂maint-blog-img]: https://img.shields.io/badge/blog-railsbling-0093D0.svg?style=for-the-badge&logo=rubyonrails&logoColor=orange
411
+ [🚂maint-contact]: http://www.railsbling.com/contact
412
+ [🚂maint-contact-img]: https://img.shields.io/badge/Contact-Maintainer-0093D0.svg?style=flat&logo=rubyonrails&logoColor=red
413
+ [💖🖇linkedin]: http://www.linkedin.com/in/peterboling
414
+ [💖🖇linkedin-img]: https://img.shields.io/badge/PeterBoling-LinkedIn-0B66C2?style=flat&logo=newjapanprowrestling
415
+ [💖✌️wellfound]: https://wellfound.com/u/peter-boling/u/peter-boling
416
+ [💖✌️wellfound-img]: https://img.shields.io/badge/peter--boling-orange?style=flat&logo=wellfound
417
+ [💖💲crunchbase]: https://www.crunchbase.com/person/peter-boling
418
+ [💖💲crunchbase-img]: https://img.shields.io/badge/peter--boling-purple?style=flat&logo=crunchbase
419
+ [💖🐘ruby-mast]: https://ruby.social/@galtzo
420
+ [💖🐘ruby-mast-img]: https://img.shields.io/mastodon/follow/109447111526622197?domain=https%3A%2F%2Fruby.social&style=flat&logo=mastodon&label=Ruby%20%40galtzo
421
+ [💖🦋bluesky]: https://bsky.app/profile/galtzo.com
422
+ [💖🦋bluesky-img]: https://img.shields.io/badge/@galtzo.com-0285FF?style=flat&logo=bluesky&logoColor=white
423
+ [💖🌳linktree]: https://linktr.ee/galtzo
424
+ [💖🌳linktree-img]: https://img.shields.io/badge/galtzo-purple?style=flat&logo=linktree
425
+ [💖💁🏼‍♂️devto]: https://dev.to/galtzo
426
+ [💖💁🏼‍♂️devto-img]: https://img.shields.io/badge/dev.to-0A0A0A?style=flat&logo=devdotto&logoColor=white
427
+ [💖💁🏼‍♂️aboutme]: https://about.me/peter.boling
428
+ [💖💁🏼‍♂️aboutme-img]: https://img.shields.io/badge/about.me-0A0A0A?style=flat&logo=aboutme&logoColor=white
429
+ [💖🧊berg]: https://codeberg.org/pboling
430
+ [💖🐙hub]: https://github.org/pboling
431
+ [💖🛖hut]: https://sr.ht/~galtzo/
432
+ [💖🧪lab]: https://gitlab.com/pboling
433
+ [👨🏼‍🏫expsup-upwork]: https://www.upwork.com/freelancers/~014942e9b056abdf86?mp_source=share
434
+ [👨🏼‍🏫expsup-upwork-img]: https://img.shields.io/badge/UpWork-13544E?style=for-the-badge&logo=Upwork&logoColor=white
435
+ [👨🏼‍🏫expsup-codementor]: https://www.codementor.io/peterboling?utm_source=github&utm_medium=button&utm_term=peterboling&utm_campaign=github
436
+ [👨🏼‍🏫expsup-codementor-img]: https://img.shields.io/badge/CodeMentor-Get_Help-1abc9c?style=for-the-badge&logo=CodeMentor&logoColor=white
437
+ [🏙️entsup-tidelift]: https://tidelift.com/subscription
438
+ [🏙️entsup-tidelift-img]: https://img.shields.io/badge/Tidelift_and_Sonar-Enterprise_Support-FD3456?style=for-the-badge&logo=sonar&logoColor=white
439
+ [🏙️entsup-tidelift-sonar]: https://blog.tidelift.com/tidelift-joins-sonar
440
+ [💁🏼‍♂️peterboling]: http://www.peterboling.com
441
+ [🚂railsbling]: http://www.railsbling.com
442
+ [📜src-gl-img]: https://img.shields.io/badge/GitLab-FBA326?style=for-the-badge&logo=Gitlab&logoColor=orange
443
+ [📜src-gl]: https://gitlab.com/galtzo-floss/timecop-rspec/
444
+ [📜src-cb-img]: https://img.shields.io/badge/CodeBerg-4893CC?style=for-the-badge&logo=CodeBerg&logoColor=blue
445
+ [📜src-cb]: https://codeberg.org/galtzo-floss/timecop-rspec
446
+ [📜src-gh-img]: https://img.shields.io/badge/GitHub-238636?style=for-the-badge&logo=Github&logoColor=green
447
+ [📜src-gh]: https://github.com/galtzo-floss/timecop-rspec
448
+ [📜docs-cr-rd-img]: https://img.shields.io/badge/RubyDoc-Current_Release-943CD2?style=for-the-badge&logo=readthedocs&logoColor=white
449
+ [📜docs-head-rd-img]: https://img.shields.io/badge/YARD_on_Galtzo.com-HEAD-943CD2?style=for-the-badge&logo=readthedocs&logoColor=white
450
+ [📜wiki]: https://gitlab.com/galtzo-floss/timecop-rspec/-/wikis/home
451
+ [📜wiki-img]: https://img.shields.io/badge/wiki-examples-943CD2.svg?style=for-the-badge&logo=Wiki&logoColor=white
452
+ [👽dl-rank]: https://rubygems.org/gems/timecop-rspec
453
+ [👽dl-ranki]: https://img.shields.io/gem/rd/timecop-rspec.svg
454
+ [👽oss-help]: https://www.codetriage.com/galtzo-floss/timecop-rspec
455
+ [👽oss-helpi]: https://www.codetriage.com/galtzo-floss/timecop-rspec/badges/users.svg
456
+ [👽version]: https://rubygems.org/gems/timecop-rspec
457
+ [👽versioni]: https://img.shields.io/gem/v/timecop-rspec.svg
458
+ [🔑qlty-mnt]: https://qlty.sh/gh/galtzo-floss/projects/timecop-rspec
459
+ [🔑qlty-mnti]: https://qlty.sh/gh/galtzo-floss/projects/timecop-rspec/maintainability.svg
460
+ [🔑qlty-cov]: https://qlty.sh/gh/galtzo-floss/projects/timecop-rspec/metrics/code?sort=coverageRating
461
+ [🔑qlty-covi]: https://qlty.sh/gh/galtzo-floss/projects/timecop-rspec/coverage.svg
462
+ [🔑codecov]: https://codecov.io/gh/galtzo-floss/timecop-rspec
463
+ [🔑codecovi♻️]: https://codecov.io/gh/galtzo-floss/timecop-rspec/graph/badge.svg?token=hRnUCPqxMu
464
+ [🔑coveralls]: https://coveralls.io/github/galtzo-floss/timecop-rspec?branch=main
465
+ [🔑coveralls-img]: https://coveralls.io/repos/github/galtzo-floss/timecop-rspec/badge.svg?branch=main
466
+ [🖐codeQL]: https://github.com/galtzo-floss/timecop-rspec/security/code-scanning
467
+ [🖐codeQL-img]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/codeql-analysis.yml/badge.svg
468
+ [🚎1-an-wf]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/ancient.yml
469
+ [🚎1-an-wfi]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/ancient.yml/badge.svg
470
+ [🚎2-cov-wf]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/coverage.yml
471
+ [🚎2-cov-wfi]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/coverage.yml/badge.svg
472
+ [🚎3-hd-wf]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/heads.yml
473
+ [🚎3-hd-wfi]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/heads.yml/badge.svg
474
+ [🚎4-lg-wf]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/legacy.yml
475
+ [🚎4-lg-wfi]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/legacy.yml/badge.svg
476
+ [🚎5-st-wf]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/style.yml
477
+ [🚎5-st-wfi]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/style.yml/badge.svg
478
+ [🚎6-s-wf]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/supported.yml
479
+ [🚎6-s-wfi]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/supported.yml/badge.svg
480
+ [🚎7-us-wf]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/unsupported.yml
481
+ [🚎7-us-wfi]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/unsupported.yml/badge.svg
482
+ [🚎8-ho-wf]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/hoary.yml
483
+ [🚎8-ho-wfi]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/hoary.yml/badge.svg
484
+ [🚎9-t-wf]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/truffle.yml
485
+ [🚎9-t-wfi]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/truffle.yml/badge.svg
486
+ [🚎10-j-wf]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/jruby.yml
487
+ [🚎10-j-wfi]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/jruby.yml/badge.svg
488
+ [🚎11-c-wf]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/current.yml
489
+ [🚎11-c-wfi]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/current.yml/badge.svg
490
+ [🚎13-🔒️-wf]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/deps_locked.yml
491
+ [🚎13-🔒️-wfi]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/deps_locked.yml/badge.svg
492
+ [🚎14-🔓️-wf]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/deps_unlocked.yml
493
+ [🚎14-🔓️-wfi]: https://github.com/galtzo-floss/timecop-rspec/actions/workflows/deps_unlocked.yml/badge.svg
494
+ [💎ruby-1.9i]: https://img.shields.io/badge/Ruby-1.9_(%F0%9F%9A%ABCI)-AABBCC?style=for-the-badge&logo=ruby&logoColor=white
495
+ [💎ruby-2.0i]: https://img.shields.io/badge/Ruby-2.0_(%F0%9F%9A%ABCI)-AABBCC?style=for-the-badge&logo=ruby&logoColor=white
496
+ [💎ruby-2.1i]: https://img.shields.io/badge/Ruby-2.1_(%F0%9F%9A%ABCI)-AABBCC?style=for-the-badge&logo=ruby&logoColor=white
497
+ [💎ruby-2.2i]: https://img.shields.io/badge/Ruby-2.2_(%F0%9F%9A%ABCI)-AABBCC?style=for-the-badge&logo=ruby&logoColor=white
498
+ [💎ruby-2.3i]: https://img.shields.io/badge/Ruby-2.3-DF00CA?style=for-the-badge&logo=ruby&logoColor=white
499
+ [💎ruby-2.4i]: https://img.shields.io/badge/Ruby-2.4-DF00CA?style=for-the-badge&logo=ruby&logoColor=white
500
+ [💎ruby-2.5i]: https://img.shields.io/badge/Ruby-2.5-DF00CA?style=for-the-badge&logo=ruby&logoColor=white
501
+ [💎ruby-2.6i]: https://img.shields.io/badge/Ruby-2.6-DF00CA?style=for-the-badge&logo=ruby&logoColor=white
502
+ [💎ruby-2.7i]: https://img.shields.io/badge/Ruby-2.7-DF00CA?style=for-the-badge&logo=ruby&logoColor=white
503
+ [💎ruby-3.0i]: https://img.shields.io/badge/Ruby-3.0-CC342D?style=for-the-badge&logo=ruby&logoColor=white
504
+ [💎ruby-3.1i]: https://img.shields.io/badge/Ruby-3.1-CC342D?style=for-the-badge&logo=ruby&logoColor=white
505
+ [💎ruby-3.2i]: https://img.shields.io/badge/Ruby-3.2-CC342D?style=for-the-badge&logo=ruby&logoColor=white
506
+ [💎ruby-3.3i]: https://img.shields.io/badge/Ruby-3.3-CC342D?style=for-the-badge&logo=ruby&logoColor=white
507
+ [💎ruby-c-i]: https://img.shields.io/badge/Ruby-current-CC342D?style=for-the-badge&logo=ruby&logoColor=green
508
+ [💎ruby-headi]: https://img.shields.io/badge/Ruby-HEAD-CC342D?style=for-the-badge&logo=ruby&logoColor=blue
509
+ [💎truby-22.3i]: https://img.shields.io/badge/Truffle_Ruby-22.3_(%F0%9F%9A%ABCI)-AABBCC?style=for-the-badge&logo=ruby&logoColor=pink
510
+ [💎truby-23.0i]: https://img.shields.io/badge/Truffle_Ruby-23.0-34BCB1?style=for-the-badge&logo=ruby&logoColor=pink
511
+ [💎truby-23.1i]: https://img.shields.io/badge/Truffle_Ruby-23.1-34BCB1?style=for-the-badge&logo=ruby&logoColor=pink
512
+ [💎truby-c-i]: https://img.shields.io/badge/Truffle_Ruby-current-34BCB1?style=for-the-badge&logo=ruby&logoColor=green
513
+ [💎truby-headi]: https://img.shields.io/badge/Truffle_Ruby-HEAD-34BCB1?style=for-the-badge&logo=ruby&logoColor=blue
514
+ [💎jruby-9.1i]: https://img.shields.io/badge/JRuby-9.1_(%F0%9F%9A%ABCI)-AABBCC?style=for-the-badge&logo=ruby&logoColor=red
515
+ [💎jruby-9.2i]: https://img.shields.io/badge/JRuby-9.2_(%F0%9F%9A%ABCI)-AABBCC?style=for-the-badge&logo=ruby&logoColor=red
516
+ [💎jruby-9.3i]: https://img.shields.io/badge/JRuby-9.3-FBE742?style=for-the-badge&logo=ruby&logoColor=red
517
+ [💎jruby-9.4i]: https://img.shields.io/badge/JRuby-9.4-FBE742?style=for-the-badge&logo=ruby&logoColor=red
518
+ [💎jruby-c-i]: https://img.shields.io/badge/JRuby-current-FBE742?style=for-the-badge&logo=ruby&logoColor=green
519
+ [💎jruby-headi]: https://img.shields.io/badge/JRuby-HEAD-FBE742?style=for-the-badge&logo=ruby&logoColor=blue
520
+ [🤝gh-issues]: https://github.com/galtzo-floss/timecop-rspec/issues
521
+ [🤝gh-pulls]: https://github.com/galtzo-floss/timecop-rspec/pulls
522
+ [🤝gl-issues]: https://gitlab.com/galtzo-floss/timecop-rspec/-/issues
523
+ [🤝gl-pulls]: https://gitlab.com/galtzo-floss/timecop-rspec/-/merge_requests
524
+ [🤝cb-issues]: https://codeberg.org/galtzo-floss/timecop-rspec/issues
525
+ [🤝cb-pulls]: https://codeberg.org/galtzo-floss/timecop-rspec/pulls
526
+ [🤝cb-donate]: https://donate.codeberg.org/
527
+ [🤝contributing]: CONTRIBUTING.md
528
+ [🔑codecov-g♻️]: https://codecov.io/gh/galtzo-floss/timecop-rspec/graphs/tree.svg?token=hRnUCPqxMu
529
+ [🖐contrib-rocks]: https://contrib.rocks
530
+ [🖐contributors]: https://github.com/galtzo-floss/timecop-rspec/graphs/contributors
531
+ [🖐contributors-img]: https://contrib.rocks/image?repo=galtzo-floss/timecop-rspec
532
+ [🚎contributors-gl]: https://gitlab.com/galtzo-floss/timecop-rspec/-/graphs/main
533
+ [🪇conduct]: CODE_OF_CONDUCT.md
534
+ [🪇conduct-img]: https://img.shields.io/badge/Contributor_Covenant-2.1-259D6C.svg
535
+ [📌pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
536
+ [📌semver]: https://semver.org/spec/v2.0.0.html
537
+ [📌semver-img]: https://img.shields.io/badge/semver-2.0.0-259D6C.svg?style=flat
538
+ [📌semver-breaking]: https://github.com/semver/semver/issues/716#issuecomment-869336139
539
+ [📌major-versions-not-sacred]: https://tom.preston-werner.com/2022/05/23/major-version-numbers-are-not-sacred.html
540
+ [📌changelog]: CHANGELOG.md
541
+ [📗keep-changelog]: https://keepachangelog.com/en/1.0.0/
542
+ [📗keep-changelog-img]: https://img.shields.io/badge/keep--a--changelog-1.0.0-34495e.svg?style=flat
543
+ [📌gitmoji]:https://gitmoji.dev
544
+ [📌gitmoji-img]:https://img.shields.io/badge/gitmoji_commits-%20😜%20😍-34495e.svg?style=flat-square
545
+ [🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
546
+ [🧮kloc-img]: https://img.shields.io/badge/KLOC-0.130-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
547
+ [🔐security]: SECURITY.md
548
+ [🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
549
+ [📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
550
+ [📄license]: LICENSE.txt
551
+ [📄license-ref]: https://opensource.org/licenses/MIT
552
+ [📄license-img]: https://img.shields.io/badge/License-MIT-259D6C.svg
553
+ [📄ilo-declaration]: https://www.ilo.org/declaration/lang--en/index.htm
554
+ [📄ilo-declaration-img]: https://img.shields.io/badge/ILO_Fundamental_Principles-✓-259D6C.svg?style=flat
555
+ [🚎yard-current]: http://rubydoc.info/gems/timecop-rspec
556
+ [🚎yard-head]: https://rspec-stubbed-env.galtzo.com
557
+ [💎stone_checksums]: https://github.com/galtzo-floss/stone_checksums
558
+ [💎SHA_checksums]: https://gitlab.com/galtzo-floss/timecop-rspec/-/tree/main/checksums
559
+ [💎rlts]: https://github.com/rubocop-lts/rubocop-lts
560
+ [💎rlts-img]: https://img.shields.io/badge/code_style_%26_linting-rubocop--lts-34495e.svg?plastic&logo=ruby&logoColor=white
561
+ [💎appraisal2]: https://github.com/appraisal-rb/appraisal2
562
+ [💎appraisal2-img]: https://img.shields.io/badge/appraised_by-appraisal2-34495e.svg?plastic&logo=ruby&logoColor=white
563
+ [💎d-in-dvcs]: https://railsbling.com/posts/dvcs/put_the_d_in_dvcs/
data/REEK ADDED
File without changes
data/RUBOCOP.md ADDED
@@ -0,0 +1,71 @@
1
+ # RuboCop Usage Guide
2
+
3
+ ## Overview
4
+
5
+ A tale of two RuboCop plugin gems.
6
+
7
+ ### RuboCop Gradual
8
+
9
+ This project uses `rubocop_gradual` instead of vanilla RuboCop for code style checking. The `rubocop_gradual` tool allows for gradual adoption of RuboCop rules by tracking violations in a lock file.
10
+
11
+ ### RuboCop LTS
12
+
13
+ This project uses `rubocop-lts` to ensure, on a best-effort basis, compatibility with Ruby >= 1.9.2.
14
+ RuboCop rules are meticulously configured by the `rubocop-lts` family of gems to ensure that a project is compatible with a specific version of Ruby. See: https://rubocop-lts.gitlab.io for more.
15
+
16
+ ## Checking RuboCop Violations
17
+
18
+ To check for RuboCop violations in this project, always use:
19
+
20
+ ```bash
21
+ bundle exec rake rubocop_gradual:check
22
+ ```
23
+
24
+ **Do not use** the standard RuboCop commands like:
25
+ - `bundle exec rubocop`
26
+ - `rubocop`
27
+
28
+ ## Understanding the Lock File
29
+
30
+ The `.rubocop_gradual.lock` file tracks all current RuboCop violations in the project. This allows the team to:
31
+
32
+ 1. Prevent new violations while gradually fixing existing ones
33
+ 2. Track progress on code style improvements
34
+ 3. Ensure CI builds don't fail due to pre-existing violations
35
+
36
+ ## Common Commands
37
+
38
+ - **Check violations**
39
+ - `bundle exec rake rubocop_gradual`
40
+ - `bundle exec rake rubocop_gradual:check`
41
+ - **(Safe) Autocorrect violations, and update lockfile if no new violations**
42
+ - `bundle exec rake rubocop_gradual:autocorrect`
43
+ - **Force update the lock file (w/o autocorrect) to match violations present in code**
44
+ - `bundle exec rake rubocop_gradual:force_update`
45
+
46
+ ## Workflow
47
+
48
+ 1. Before submitting a PR, run `bundle exec rake rubocop_gradual:autocorrect`
49
+ a. or just the default `bundle exec rake`, as autocorrection is a pre-requisite of the default task.
50
+ 2. If there are new violations, either:
51
+ - Fix them in your code
52
+ - Run `bundle exec rake rubocop_gradual:force_update` to update the lock file (only for violations you can't fix immediately)
53
+ 3. Commit the updated `.rubocop_gradual.lock` file along with your changes
54
+
55
+ ## Never add inline RuboCop disables
56
+
57
+ Do not add inline `rubocop:disable` / `rubocop:enable` comments anywhere in the codebase (including specs, except when following the few existing `rubocop:disable` patterns for a rule already being disabled elsewhere in the code). We handle exceptions in two supported ways:
58
+
59
+ - Permanent/structural exceptions: prefer adjusting the RuboCop configuration (e.g., in `.rubocop.yml`) to exclude a rule for a path or file pattern when it makes sense project-wide.
60
+ - Temporary exceptions while improving code: record the current violations in `.rubocop_gradual.lock` via the gradual workflow:
61
+ - `bundle exec rake rubocop_gradual:autocorrect` (preferred; will autocorrect what it can and update the lock only if no new violations were introduced)
62
+ - If needed, `bundle exec rake rubocop_gradual:force_update` (as a last resort when you cannot fix the newly reported violations immediately)
63
+
64
+ In general, treat the rules as guidance to follow; fix violations rather than ignore them. For example, RSpec conventions in this project expect `described_class` to be used in specs that target a specific class under test.
65
+
66
+ ## Benefits of rubocop_gradual
67
+
68
+ - Allows incremental adoption of code style rules
69
+ - Prevents CI failures due to pre-existing violations
70
+ - Provides a clear record of code style debt
71
+ - Enables focused efforts on improving code quality over time