fat_core 0.2.1 → 0.2.2
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
- data/lib/fat_core/date.rb +4 -4
- data/lib/fat_core/version.rb +1 -1
- data/spec/lib/date_spec.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9fb47fa0fa82d7e1123e64ff79386a40ec64081
|
4
|
+
data.tar.gz: 712a346af001436071a8429ddcadc772c3ecd31b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1825b694209cee54cd34fd6a3140875181fefde1e39744c3cc999d64ba9dfe0a85fa6b846f59ad80b49a8cf9a855b027969197a2c6e2256c421600a2537085d
|
7
|
+
data.tar.gz: 645b35b380af7532e49001b58b627915a70c882ebc2f5aeae51c75eb6873113722d767b7e1fd5e4c4c64c723486411b69fa0fe5eb94c95c19afc8a02383ca7b7
|
data/lib/fat_core/date.rb
CHANGED
@@ -128,8 +128,8 @@ class Date
|
|
128
128
|
when /^(this_?)?biweek/
|
129
129
|
spec_type == :from ? today.beginning_of_biweek : today.end_of_biweek
|
130
130
|
when /last_?biweek/
|
131
|
-
spec_type == :from ? (today -
|
132
|
-
(today -
|
131
|
+
spec_type == :from ? (today - 2.week).beginning_of_biweek :
|
132
|
+
(today - 2.week).end_of_biweek
|
133
133
|
when /^(this_?)?semimonth/
|
134
134
|
spec_type == :from ? today.beginning_of_semimonth : today.end_of_semimonth
|
135
135
|
when /^last_?semimonth/
|
@@ -143,8 +143,8 @@ class Date
|
|
143
143
|
when /^(this_?)?bimonth/
|
144
144
|
spec_type == :from ? today.beginning_of_bimonth : today.end_of_bimonth
|
145
145
|
when /^last_?bimonth/
|
146
|
-
spec_type == :from ? (today -
|
147
|
-
(today -
|
146
|
+
spec_type == :from ? (today - 2.month).beginning_of_bimonth :
|
147
|
+
(today - 2.month).end_of_bimonth
|
148
148
|
when /^(this_?)?quarter/
|
149
149
|
spec_type == :from ? today.beginning_of_quarter : today.end_of_quarter
|
150
150
|
when /^last_?quarter/
|
data/lib/fat_core/version.rb
CHANGED
data/spec/lib/date_spec.rb
CHANGED
@@ -201,6 +201,7 @@ describe Date do
|
|
201
201
|
end
|
202
202
|
|
203
203
|
describe "parse_spec" do
|
204
|
+
# For these tests, today is 2012-07-18
|
204
205
|
|
205
206
|
it "should choke if spec type is neither :from or :to" do
|
206
207
|
expect {
|
@@ -311,6 +312,18 @@ describe Date do
|
|
311
312
|
expect(Date.parse_spec('this_bimonth', :to)).to eq Date.parse('2012-08-31')
|
312
313
|
expect(Date.parse_spec('last_bimonth')).to eq Date.parse('2012-05-01')
|
313
314
|
expect(Date.parse_spec('last_bimonth', :to)).to eq Date.parse('2012-06-30')
|
315
|
+
|
316
|
+
# Set today to 2014-12-12: Found that last_bimonth was reporting
|
317
|
+
# current bimonth when today was in the second month of the current
|
318
|
+
# bimonth, i.e., an even month
|
319
|
+
allow(Date).to receive_messages(:today => Date.parse('2014-12-12'))
|
320
|
+
allow(Date).to receive_messages(:current => Date.parse('2014-12-12'))
|
321
|
+
|
322
|
+
expect(Date.parse_spec('last_bimonth')).to eq Date.parse('2014-09-01')
|
323
|
+
expect(Date.parse_spec('last_bimonth', :to)).to eq Date.parse('2014-10-31')
|
324
|
+
|
325
|
+
allow(Date).to receive_messages(:today => Date.parse('2012-07-18'))
|
326
|
+
allow(Date).to receive_messages(:current => Date.parse('2012-07-18'))
|
314
327
|
end
|
315
328
|
|
316
329
|
it "should parse relative quarters: this_quarter, last_quarter" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fat_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel E. Doherty
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simplecov
|