timecop-rspec 1.0.0 → 1.0.1
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.idea/timecop-rspec.iml +11 -9
- data/.rubocop_gradual.lock +57 -57
- data/CHANGELOG.md +12 -4
- data/Gemfile.lock +3 -25
- data/README.md +10 -4
- data/bin/console +0 -26
- data/bin/setup +0 -26
- data/checksums/timecop-rspec-1.0.1.gem.sha256 +1 -0
- data/checksums/timecop-rspec-1.0.1.gem.sha512 +1 -0
- data/docs/Timecop/Rspec/ExampleDecorator.html +26 -26
- data/docs/Timecop/Rspec/SequentialTimeMachine.html +11 -11
- data/docs/Timecop/Rspec/TimeMachine.html +18 -18
- data/docs/Timecop/Rspec/TravelLog.html +18 -18
- data/docs/Timecop/Rspec/Traveler.html +25 -25
- data/docs/Timecop/Rspec/Version.html +2 -2
- data/docs/Timecop/Rspec.html +20 -18
- data/docs/Timecop.html +2 -8
- data/docs/_index.html +7 -1
- data/docs/file.CHANGELOG.html +16 -5
- data/docs/file.CITATION.html +1 -1
- data/docs/file.CODE_OF_CONDUCT.html +1 -1
- data/docs/file.CONTRIBUTING.html +1 -1
- data/docs/file.LICENSE.html +1 -1
- data/docs/file.README.html +12 -4
- data/docs/file.REEK.html +1 -1
- data/docs/file.RUBOCOP.html +1 -1
- data/docs/file.SECURITY.html +1 -1
- data/docs/file.rspec.html +1 -1
- data/docs/file.timecop-rspec-1.0.0.gem.html +71 -0
- data/docs/file.timecop.html +1 -1
- data/docs/file_list.html +10 -0
- data/docs/index.html +12 -4
- data/docs/top-level-namespace.html +1 -1
- data/lib/timecop/rspec/example_decorator.rb +3 -24
- data/lib/timecop/rspec/sequential_time_machine.rb +0 -24
- data/lib/timecop/rspec/time_machine.rb +0 -24
- data/lib/timecop/rspec/travel_log.rb +6 -28
- data/lib/timecop/rspec/traveler.rb +0 -24
- data/lib/timecop/rspec/version.rb +1 -25
- data/lib/timecop/rspec.rb +2 -26
- data/timecop-rspec.gemspec +1 -1
- data.tar.gz.sig +1 -2
- metadata +14 -9
- metadata.gz.sig +0 -0
@@ -0,0 +1,71 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
File: timecop-rspec-1.0.0.gem
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.37
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "timecop-rspec-1.0.0.gem";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="file_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index</a> »
|
40
|
+
<span class="title">File: timecop-rspec-1.0.0.gem</span>
|
41
|
+
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div id="search">
|
45
|
+
|
46
|
+
<a class="full_list_link" id="class_list_link"
|
47
|
+
href="class_list.html">
|
48
|
+
|
49
|
+
<svg width="24" height="24">
|
50
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
</svg>
|
54
|
+
</a>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
<div class="clear"></div>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div id="content"><div id='filecontents'><p>33eb0a04d6ea0cffb26108d404e70e04ee2e53d7f5e62b9c5b0c83c75f91ff06fc507e2e086bd190d8e978e61a95034aa014fa7c03c9d60019d885226a6a0372</p>
|
61
|
+
</div></div>
|
62
|
+
|
63
|
+
<div id="footer">
|
64
|
+
Generated on Sun Aug 17 17:04:07 2025 by
|
65
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
66
|
+
0.9.37 (ruby-3.4.5).
|
67
|
+
</div>
|
68
|
+
|
69
|
+
</div>
|
70
|
+
</body>
|
71
|
+
</html>
|
data/docs/file.timecop.html
CHANGED
@@ -62,7 +62,7 @@ end</p>
|
|
62
62
|
</div></div>
|
63
63
|
|
64
64
|
<div id="footer">
|
65
|
-
Generated on Sun Aug 17
|
65
|
+
Generated on Sun Aug 17 17:04:07 2025 by
|
66
66
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
67
67
|
0.9.37 (ruby-3.4.5).
|
68
68
|
</div>
|
data/docs/file_list.html
CHANGED
@@ -87,6 +87,16 @@
|
|
87
87
|
</li>
|
88
88
|
|
89
89
|
|
90
|
+
<li id="object_timecop-rspec-1.0.0.gem" class="odd">
|
91
|
+
<div class="item"><span class="object_link"><a href="file.timecop-rspec-1.0.0.gem.html" title="timecop-rspec-1.0.0.gem">timecop-rspec-1.0.0.gem</a></span></div>
|
92
|
+
</li>
|
93
|
+
|
94
|
+
|
95
|
+
<li id="object_timecop-rspec-1.0.0.gem" class="even">
|
96
|
+
<div class="item"><span class="object_link"><a href="file.timecop-rspec-1.0.0.gem.html" title="timecop-rspec-1.0.0.gem">timecop-rspec-1.0.0.gem</a></span></div>
|
97
|
+
</li>
|
98
|
+
|
99
|
+
|
90
100
|
<li id="object_REEK" class="odd">
|
91
101
|
<div class="item"><span class="object_link"><a href="file.REEK.html" title="REEK">REEK</a></span></div>
|
92
102
|
</li>
|
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=
|
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 & 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-
|
158
|
+
<a href="https://rubygems.org/gems/timecop-rspec"><img src="https://img.shields.io/badge/name-timecop--rspec-3C2D2D.svg?style=square&logo=rubygems&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&logo=ruby&logoColor=white" alt="Gem namespace"></a>
|
151
159
|
</th>
|
152
160
|
</tr>
|
153
161
|
</thead>
|
@@ -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=
|
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
|
|
@@ -513,7 +521,7 @@ See <a href="file.LICENSE.html" title="LICENSE.txt">LICENSE.txt</a> for the offi
|
|
513
521
|
</div></div>
|
514
522
|
|
515
523
|
<div id="footer">
|
516
|
-
Generated on Sun Aug 17
|
524
|
+
Generated on Sun Aug 17 17:04:07 2025 by
|
517
525
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
518
526
|
0.9.37 (ruby-3.4.5).
|
519
527
|
</div>
|
@@ -100,7 +100,7 @@
|
|
100
100
|
</div>
|
101
101
|
|
102
102
|
<div id="footer">
|
103
|
-
Generated on Sun Aug 17
|
103
|
+
Generated on Sun Aug 17 17:04:07 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
|
-
#
|
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.
|
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.
|
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
|
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
|
-
|
62
|
+
# Convert to a Time in local zone to perform arithmetic in seconds
|
63
|
+
start_time.to_time
|
87
64
|
when Date
|
88
|
-
|
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.
|
7
|
+
VERSION = "1.0.1"
|
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
|
34
|
+
str = global_time_travel_string
|
35
|
+
!(str.nil? || str == "")
|
60
36
|
end
|
61
37
|
|
62
38
|
# The globally configured time parsed from ENV.
|
data/timecop-rspec.gemspec
CHANGED
@@ -112,7 +112,7 @@ Gem::Specification.new do |spec|
|
|
112
112
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
113
113
|
spec.require_paths = ["lib"]
|
114
114
|
|
115
|
-
spec.add_dependency("
|
115
|
+
spec.add_dependency("delegate", "~> 0.1") # ruby > 0, for SimpleDelegator, newer versions drop support for older rubies
|
116
116
|
spec.add_dependency("rspec", "~> 3.0") # ruby > 0
|
117
117
|
spec.add_dependency("timecop", ">= 0.7", "< 1") # ruby >= 1.9.2, for time-based testing
|
118
118
|
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
VQ� .nۘя"�-V�T��2r�xIJM���l��@ޛ<�`jOQ�2�����^��8���ma�����We{mZ8.!l������HC��Ҹ�8x5�M��ξ����8F8J�*�{y^������&/g� �%��I"�!�~�ֶ��L���U���Ώ^� 0/{��|{X�(^������
|
1
|
+
]����X�D��o�ގc�_�T�Y�P9�bV���4��Ф����pog?`9@�ٶ�~ʄgeH_�'V��4��>�d;�������q�h�ω�P�N�sH���n[���W�_��\�?upDyaL)E�j��-�n}*J��r� V�f��^Q!RE��������x��q�M���Z6������bT�N�yOBg�(��w����
|
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.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter H. Boling
|
@@ -40,19 +40,19 @@ cert_chain:
|
|
40
40
|
date: 2025-08-17 00:00:00.000000000 Z
|
41
41
|
dependencies:
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
43
|
+
name: delegate
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - "
|
46
|
+
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
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: '
|
55
|
+
version: '0.1'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: rspec
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -229,6 +229,8 @@ extra_rdoc_files:
|
|
229
229
|
- SECURITY.md
|
230
230
|
- checksums/timecop-rspec-1.0.0.gem.sha256
|
231
231
|
- checksums/timecop-rspec-1.0.0.gem.sha512
|
232
|
+
- checksums/timecop-rspec-1.0.1.gem.sha256
|
233
|
+
- checksums/timecop-rspec-1.0.1.gem.sha512
|
232
234
|
- sig/timecop.rbs
|
233
235
|
- sig/timecop/rspec.rbs
|
234
236
|
files:
|
@@ -321,6 +323,8 @@ files:
|
|
321
323
|
- certs/pboling.pem
|
322
324
|
- checksums/timecop-rspec-1.0.0.gem.sha256
|
323
325
|
- checksums/timecop-rspec-1.0.0.gem.sha512
|
326
|
+
- checksums/timecop-rspec-1.0.1.gem.sha256
|
327
|
+
- checksums/timecop-rspec-1.0.1.gem.sha512
|
324
328
|
- docs/Timecop.html
|
325
329
|
- docs/Timecop/Rspec.html
|
326
330
|
- docs/Timecop/Rspec/ExampleDecorator.html
|
@@ -344,6 +348,7 @@ files:
|
|
344
348
|
- docs/file.RUBOCOP.html
|
345
349
|
- docs/file.SECURITY.html
|
346
350
|
- docs/file.rspec.html
|
351
|
+
- docs/file.timecop-rspec-1.0.0.gem.html
|
347
352
|
- docs/file.timecop.html
|
348
353
|
- docs/file_list.html
|
349
354
|
- docs/frames.html
|
@@ -387,10 +392,10 @@ licenses:
|
|
387
392
|
- MIT
|
388
393
|
metadata:
|
389
394
|
homepage_uri: https://timecop-rspec.galtzo.com/
|
390
|
-
source_code_uri: https://github.com/galtzo-floss/timecop-rspec/tree/v1.0.
|
391
|
-
changelog_uri: https://github.com/galtzo-floss/timecop-rspec/blob/v1.0.
|
395
|
+
source_code_uri: https://github.com/galtzo-floss/timecop-rspec/tree/v1.0.1
|
396
|
+
changelog_uri: https://github.com/galtzo-floss/timecop-rspec/blob/v1.0.1/CHANGELOG.md
|
392
397
|
bug_tracker_uri: https://github.com/galtzo-floss/timecop-rspec/issues
|
393
|
-
documentation_uri: https://www.rubydoc.info/gems/timecop-rspec/1.0.
|
398
|
+
documentation_uri: https://www.rubydoc.info/gems/timecop-rspec/1.0.1
|
394
399
|
funding_uri: https://github.com/sponsors/pboling
|
395
400
|
wiki_uri: https://github.com/galtzo-floss/timecop-rspec/wiki
|
396
401
|
news_uri: https://www.railsbling.com/tags/timecop-rspec
|
metadata.gz.sig
CHANGED
Binary file
|