timecop 0.4.2 → 0.4.3

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.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 2
2
+ :patch: 3
3
3
  :major: 0
4
4
  :minor: 4
@@ -17,7 +17,17 @@ class Time #:nodoc:
17
17
 
18
18
  # Alias now to now_with_mock_time
19
19
  alias_method :now, :now_with_mock_time
20
- alias_method :new, :now
20
+
21
+ alias_method :new_without_mock_time, :new
22
+ def new_with_mock_time *args
23
+ if args.size > 0
24
+ new_without_mock_time *args
25
+ else
26
+ now
27
+ end
28
+ end
29
+
30
+ alias_method :new, :new_with_mock_time
21
31
  end
22
32
  end
23
33
 
@@ -19,6 +19,18 @@ class TestTimeStackItem < Test::Unit::TestCase
19
19
  assert_equal min, stack_item.min
20
20
  assert_equal s, stack_item.sec
21
21
  end
22
+
23
+ def test_new_with_time_and_arguments
24
+ t = Time.new(2012, 7, 28, 20, 0)
25
+ y, m, d, h, min, s = t.year, t.month, t.day, t.hour, t.min, t.sec
26
+ stack_item = Timecop::TimeStackItem.new(:freeze, t)
27
+ assert_equal y, stack_item.year
28
+ assert_equal m, stack_item.month
29
+ assert_equal d, stack_item.day
30
+ assert_equal h, stack_item.hour
31
+ assert_equal min, stack_item.min
32
+ assert_equal s, stack_item.sec
33
+ end
22
34
 
23
35
  def test_new_with_datetime_now
24
36
  t = DateTime.now
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.2
4
+ version: 0.4.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-06-27 00:00:00.000000000Z
13
+ date: 2012-06-28 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: A gem providing "time travel" and "time freezing" capabilities, making
16
16
  it dead simple to test time-dependent code. It provides a unified method to mock
@@ -58,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  version: '0'
59
59
  requirements: []
60
60
  rubyforge_project: johntrupiano
61
- rubygems_version: 1.8.10
61
+ rubygems_version: 1.8.19
62
62
  signing_key:
63
63
  specification_version: 3
64
64
  summary: A gem providing "time travel" and "time freezing" capabilities, making it
@@ -70,3 +70,4 @@ test_files:
70
70
  - test/timecop_test.rb
71
71
  - test/timecop_without_date_test.rb
72
72
  - test/timecop_without_date_but_with_time_test.rb
73
+ has_rdoc: