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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 20cb6846c9eed771ecb4652d95a568e0fe53066a
4
- data.tar.gz: 887873c54cc4dc84fc1b01c0da708289d67e8c76
3
+ metadata.gz: 6e96be7760b99a2b26e5d68800d2980190fe22c2
4
+ data.tar.gz: 9c55cc8abe218ff8dd6035452ffe5e1056d592a4
5
5
  SHA512:
6
- metadata.gz: bde686bc5c574e8901c82ce9b66cd45649b03da6a55fedb6cab3dc71a730d0f42bcf23f1da70a410222f8fe2cfc39c23f4ce72bd8a535dce3f3b7bb3feb8a0b7
7
- data.tar.gz: 78fef5abf78c22bec175382563eb4fc3d92d87fbb107de4d1a24ece25c85b40bcb52d1dad7d174b59a15493abf128af0ac53e9cab820f4f4abfd26d540fa43bc
6
+ metadata.gz: 6f5b765cd3bc5ead77b8947e18d8230f164a1b4655f26ccc73bc7715a70666bf6e623a8567274fda5b375955f30a7bbeb825921fa24c2bb046de9cd8b26df429
7
+ data.tar.gz: 2170ebdcf36371775b6b2abd27faf6ed435ba3d7469c405d8dbda47328622a9375b847de7663e25ff23a6dd8fbddc64012246f4127752a21a143d87458ee0f94
@@ -51,7 +51,8 @@ describe "some set of tests to mock" do
51
51
  Timecop.return
52
52
  end
53
53
 
54
- it "should do blah blah blah" {}
54
+ it "should do blah blah blah" do
55
+ end
55
56
  end
56
57
  ```
57
58
 
@@ -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)
@@ -1,3 +1,3 @@
1
1
  class Timecop
2
- VERSION = "0.7.4"
2
+ VERSION = "0.8.0"
3
3
  end
@@ -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.7.4
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-05-31 00:00:00.000000000 Z
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
- - "--charset=UTF-8"
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.2.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