timecop 0.7.4 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +2 -1
- data/lib/timecop/timecop.rb +5 -0
- data/lib/timecop/version.rb +1 -1
- data/test/timecop_test.rb +18 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e96be7760b99a2b26e5d68800d2980190fe22c2
|
4
|
+
data.tar.gz: 9c55cc8abe218ff8dd6035452ffe5e1056d592a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f5b765cd3bc5ead77b8947e18d8230f164a1b4655f26ccc73bc7715a70666bf6e623a8567274fda5b375955f30a7bbeb825921fa24c2bb046de9cd8b26df429
|
7
|
+
data.tar.gz: 2170ebdcf36371775b6b2abd27faf6ed435ba3d7469c405d8dbda47328622a9375b847de7663e25ff23a6dd8fbddc64012246f4127752a21a143d87458ee0f94
|
data/README.markdown
CHANGED
data/lib/timecop/timecop.rb
CHANGED
@@ -111,6 +111,11 @@ class Timecop
|
|
111
111
|
@safe_mode ||= false
|
112
112
|
end
|
113
113
|
|
114
|
+
# Returns whether or not Timecop is currently frozen/travelled
|
115
|
+
def frozen?
|
116
|
+
!instance.instance_variable_get(:@_stack).empty?
|
117
|
+
end
|
118
|
+
|
114
119
|
private
|
115
120
|
def send_travel(mock_type, *args, &block)
|
116
121
|
val = instance.send(:travel, mock_type, *args, &block)
|
data/lib/timecop/version.rb
CHANGED
data/test/timecop_test.rb
CHANGED
@@ -293,7 +293,7 @@ class TestTimecop < Minitest::Unit::TestCase
|
|
293
293
|
end
|
294
294
|
end
|
295
295
|
end
|
296
|
-
|
296
|
+
|
297
297
|
def test_freeze_without_arguments_instance_works_as_expected
|
298
298
|
t = Time.local(2008, 10, 10, 10, 10, 10)
|
299
299
|
Timecop.freeze(t) do
|
@@ -519,6 +519,23 @@ class TestTimecop < Minitest::Unit::TestCase
|
|
519
519
|
end
|
520
520
|
end
|
521
521
|
|
522
|
+
def test_frozen_after_freeze
|
523
|
+
Timecop.freeze
|
524
|
+
assert Timecop.frozen?
|
525
|
+
end
|
526
|
+
|
527
|
+
def test_frozen_inside_freeze
|
528
|
+
Timecop.freeze do
|
529
|
+
assert Timecop.frozen?
|
530
|
+
end
|
531
|
+
end
|
532
|
+
|
533
|
+
def test_not_frozen_after_return
|
534
|
+
Timecop.freeze
|
535
|
+
Timecop.return
|
536
|
+
assert !Timecop.frozen?
|
537
|
+
end
|
538
|
+
|
522
539
|
private
|
523
540
|
|
524
541
|
def with_safe_mode(enabled=true)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timecop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis Jeffery
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-07-28 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A gem providing "time travel" and "time freezing" capabilities, making
|
15
15
|
it dead simple to test time-dependent code. It provides a unified method to mock
|
@@ -27,36 +27,36 @@ files:
|
|
27
27
|
- lib/timecop.rb
|
28
28
|
- lib/timecop/time_extensions.rb
|
29
29
|
- lib/timecop/time_stack_item.rb
|
30
|
-
- lib/timecop/timecop.rb
|
31
30
|
- lib/timecop/version.rb
|
31
|
+
- lib/timecop/timecop.rb
|
32
32
|
- test/run_tests.sh
|
33
33
|
- test/test_helper.rb
|
34
34
|
- test/time_stack_item_test.rb
|
35
35
|
- test/timecop_test.rb
|
36
|
-
- test/timecop_without_date_but_with_time_test.rb
|
37
36
|
- test/timecop_without_date_test.rb
|
37
|
+
- test/timecop_without_date_but_with_time_test.rb
|
38
38
|
homepage: https://github.com/travisjeffery/timecop
|
39
39
|
licenses:
|
40
40
|
- MIT
|
41
41
|
metadata: {}
|
42
42
|
post_install_message:
|
43
43
|
rdoc_options:
|
44
|
-
-
|
44
|
+
- --charset=UTF-8
|
45
45
|
require_paths:
|
46
46
|
- lib
|
47
47
|
required_ruby_version: !ruby/object:Gem::Requirement
|
48
48
|
requirements:
|
49
|
-
- -
|
49
|
+
- - '>='
|
50
50
|
- !ruby/object:Gem::Version
|
51
51
|
version: 1.9.2
|
52
52
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- -
|
54
|
+
- - '>='
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '0'
|
57
57
|
requirements: []
|
58
58
|
rubyforge_project: timecop
|
59
|
-
rubygems_version: 2.
|
59
|
+
rubygems_version: 2.0.14
|
60
60
|
signing_key:
|
61
61
|
specification_version: 3
|
62
62
|
summary: A gem providing "time travel" and "time freezing" capabilities, making it
|