timecop 0.9.5 → 0.9.6

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
  SHA256:
3
- metadata.gz: 681f52d846b808b06ff833f3fbfc21e3c7c4c1bf426baa03f101c0a2c3b79ce8
4
- data.tar.gz: b95b6d4a3c357e7f11f046d82dad3badd81d4903c96ef2b8e77762f241eeb66e
3
+ metadata.gz: c86a01ea95f5019cb15a6a66c5668e68e7f1e293ca14b910a10cbe1cdd70d668
4
+ data.tar.gz: e5c6987d3a452fa9ead841021f93bf4ea6bac713c1f6cea38cfc1c1d49baf6ee
5
5
  SHA512:
6
- metadata.gz: e62e48939fb924a78d59199222688ae7692a2f6649c16daac296375ac1e537fa1c85e6a34d1a5cbd64b209e643ffa08d180ce3d933905f91284ce4c819873c1e
7
- data.tar.gz: f6f5ef32ee1bfadfd43a5a8899bb521873d61eafd2f242942df6e80a3ed11f80a170d074ada23a61eb3b92009eeaf3a1046b126c802dc9a1c014c77d32acb3ab
6
+ metadata.gz: 4abbcd2d37b9fdf6dfb1ed1f63f945a882cd62a47ae2ae237da003ccac0bc660572be0800933ea484fb1632707bdc2de457b96f9aad8a62b1dfd96d766220692
7
+ data.tar.gz: a19cc9026478a29161a832454edebf76105d56d3841575af71e9dbaa305a40a68af285d17b7473369ae913e463cadd7b67ab2e099d13d3162b713d2c3cd87d05
data/README.markdown CHANGED
@@ -9,7 +9,7 @@ A gem providing "time travel" and "time freezing" capabilities, making it dead s
9
9
 
10
10
  ## INSTALL
11
11
 
12
- `gem install timecop`
12
+ `bundle add timecop`
13
13
 
14
14
  ## FEATURES
15
15
 
@@ -45,36 +45,31 @@ class Date #:nodoc:
45
45
  alias_method :strptime_without_mock_date, :strptime
46
46
 
47
47
  def strptime_with_mock_date(str = '-4712-01-01', fmt = '%F', start = Date::ITALY)
48
- unless start == Date::ITALY
49
- raise ArgumentError, "Timecop's #{self}::#{__method__} only " +
50
- "supports Date::ITALY for the start argument."
51
- end
52
-
53
48
  #If date is not valid the following line raises
54
- Date.strptime_without_mock_date(str, fmt)
49
+ Date.strptime_without_mock_date(str, fmt, start)
55
50
 
56
51
  d = Date._strptime(str, fmt)
57
52
  now = Time.now.to_date
58
53
  year = d[:year] || now.year
59
54
  mon = d[:mon] || now.mon
60
55
  if d.keys == [:year]
61
- Date.new(year)
56
+ Date.new(year, 1, 1, start)
62
57
  elsif d[:mday]
63
- Date.new(year, mon, d[:mday])
58
+ Date.new(year, mon, d[:mday], start)
64
59
  elsif d[:wday]
65
- Date.new(year, mon, now.mday) + (d[:wday] - now.wday)
60
+ Date.new(year, mon, now.mday, start) + (d[:wday] - now.wday)
66
61
  elsif d[:yday]
67
- Date.new(year).next_day(d[:yday] - 1)
62
+ Date.new(year, 1, 1, start).next_day(d[:yday] - 1)
68
63
  elsif d[:cwyear] && d[:cweek]
69
64
  if d[:cwday]
70
- Date.commercial(d[:cwyear], d[:cweek], d[:cwday])
65
+ Date.commercial(d[:cwyear], d[:cweek], d[:cwday], start)
71
66
  else
72
- Date.commercial(d[:cwyear], d[:cweek])
67
+ Date.commercial(d[:cwyear], d[:cweek], 1, start)
73
68
  end
74
69
  elsif d[:seconds]
75
70
  Time.at(d[:seconds]).to_date
76
71
  else
77
- Date.new(year, mon)
72
+ Date.new(year, mon, 1, start)
78
73
  end
79
74
  end
80
75
 
@@ -1,3 +1,3 @@
1
1
  class Timecop
2
- VERSION = "0.9.5"
2
+ VERSION = "0.9.6"
3
3
  end
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.9.5
4
+ version: 0.9.6
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: 2022-03-07 00:00:00.000000000 Z
12
+ date: 2022-11-29 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
@@ -54,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  requirements: []
57
- rubygems_version: 3.2.22
57
+ rubygems_version: 3.2.15
58
58
  signing_key:
59
59
  specification_version: 3
60
60
  summary: A gem providing "time travel" and "time freezing" capabilities, making it