fiscali 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/LICENSE +18 -17
- data/README.markdown +3 -1
- data/fiscali.gemspec +2 -2
- data/lib/rising_sun/version.rb +1 -1
- data/spec/fiscali_spec.rb +65 -66
- data/spec/spec_helper.rb +3 -0
- metadata +18 -17
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MTMwYWM4M2YzYmQzMjAxM2ExNGNlOGMyMTcxYzEyYjM5MmJlMGMzMg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YWY1NDM3MTdjZjFkNWJmN2Y1MDkwYjM2OTlmZTFkNGVjM2NjZWE0OA==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
OTkxMzYyNDYyZDYzZWZlY2NmMzI1ZGZlMjRlZTAwNTVkNjQxZmUzZjFkYWI0
|
10
|
+
MWVkMmU1OWJlM2ZmNjUzOTAyYjQwZmUzMTJkZmM3ZWU1MGUwOWI3NzU2YjRl
|
11
|
+
OTc5ODY4ZDZlNWVlYjk5NzM1ZTFjODBhMTQzYTJjYmZiMzIwMDI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MTI4MDkwODI4ZjYyOTM3ZmMwZTk0MDA0ZTk0OTkzYjRmNzNjMGNjODIxOGYx
|
14
|
+
Mzc4OTEyMjU2YWYyMWZlYzQ1MGMwNTNjNjEzYTQ5MmE0MjlmMjhhZDQwZjY1
|
15
|
+
MGZkZTdjODAxZWI1ZWRiOWVlNWZkNDUyNWVlNTFlODk3MDdmNzk=
|
data/LICENSE
CHANGED
@@ -1,20 +1,21 @@
|
|
1
|
-
|
1
|
+
The MIT License (MIT)
|
2
2
|
|
3
|
-
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
3
|
+
Copyright (c) 2009 Aditya Sanghi
|
10
4
|
|
11
|
-
|
12
|
-
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.markdown
CHANGED
@@ -199,7 +199,6 @@ Assume Date.today is 1st May 2009
|
|
199
199
|
Date.today.beginning_of_year.previous_financial_quarter
|
200
200
|
=> 1st Apr 2008
|
201
201
|
|
202
|
-
|
203
202
|
## Contributors
|
204
203
|
|
205
204
|
* [@reed](https://github.com/reed)
|
@@ -207,3 +206,6 @@ Assume Date.today is 1st May 2009
|
|
207
206
|
* [@rshallit](https://github.com/rshallit)
|
208
207
|
* [@asanghi](https://github.com/asanghi)
|
209
208
|
|
209
|
+
## License
|
210
|
+
|
211
|
+
Fiscali is released under the [MIT License](http://www.opensource.org/licenses/MIT).
|
data/fiscali.gemspec
CHANGED
@@ -9,6 +9,7 @@ Gem::Specification.new do |gem|
|
|
9
9
|
gem.description = %q{Fiscal Year Date Functions}
|
10
10
|
gem.summary = %q{Fiscal Year Date Functions}
|
11
11
|
gem.homepage = "https://github.com/asanghi/fiscali"
|
12
|
+
gem.license = 'MIT'
|
12
13
|
|
13
14
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
14
15
|
gem.files = `git ls-files`.split("\n")
|
@@ -18,6 +19,5 @@ Gem::Specification.new do |gem|
|
|
18
19
|
gem.add_dependency 'activesupport'
|
19
20
|
|
20
21
|
gem.add_development_dependency 'rake'
|
21
|
-
gem.add_development_dependency 'rspec', '~>
|
22
|
+
gem.add_development_dependency 'rspec', '~> 3.3'
|
22
23
|
end
|
23
|
-
|
data/lib/rising_sun/version.rb
CHANGED
data/spec/fiscali_spec.rb
CHANGED
@@ -2,127 +2,127 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe "fiscali" do
|
4
4
|
it "should be possible to read fiscal zone" do
|
5
|
-
Date.fiscal_zone.
|
5
|
+
expect(Date.fiscal_zone).to be_nil
|
6
6
|
end
|
7
7
|
|
8
8
|
it "should be possible to write fiscal zone" do
|
9
9
|
Date.fiscal_zone = :india
|
10
|
-
Date.fiscal_zone.
|
10
|
+
expect(Date.fiscal_zone).to eql(:india)
|
11
11
|
end
|
12
12
|
|
13
13
|
it "should be possible to read fiscal start month" do
|
14
14
|
Date.fy_start_month = 2
|
15
|
-
Date.fy_start_month.
|
15
|
+
expect(Date.fy_start_month).to eql(2)
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should report financial year start" do
|
19
19
|
Date.fiscal_zone = :india
|
20
20
|
this_year = Date.today.year
|
21
|
-
Date.financial_year_start.
|
21
|
+
expect(Date.financial_year_start).to eql(Date.new(this_year,4,1))
|
22
22
|
|
23
|
-
Date.financial_year_start(2009).
|
23
|
+
expect(Date.financial_year_start(2009)).to eql(Date.new(2009,4,1))
|
24
24
|
end
|
25
25
|
|
26
26
|
context "Forward Year settings" do
|
27
|
-
after
|
27
|
+
after :each do
|
28
28
|
Date.reset_forward_year!
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should be possible to read year forward field" do
|
32
|
-
Date.uses_forward_year
|
32
|
+
expect(Date.uses_forward_year?).to eql(false)
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should be possible to set year forward field" do
|
36
36
|
Date.use_forward_year!
|
37
|
-
Date.uses_forward_year
|
37
|
+
expect(Date.uses_forward_year?).to eql(true)
|
38
38
|
end
|
39
39
|
|
40
40
|
it "should report the correct financial eyar if forward year is being used" do
|
41
41
|
Date.use_forward_year!
|
42
42
|
@d = Date.new(2009,1,1)
|
43
|
-
@d.financial_year.
|
43
|
+
expect(@d.financial_year).to eql(2009)
|
44
44
|
@d = Date.new(2009,4,1)
|
45
|
-
@d.financial_year.
|
45
|
+
expect(@d.financial_year).to eql(2010)
|
46
46
|
end
|
47
47
|
|
48
48
|
it "should report the correct beginning_of_financial_year when forward year is set" do
|
49
49
|
Date.use_forward_year!
|
50
50
|
@d = Date.new(2009,6,1)
|
51
|
-
@d.beginning_of_financial_year.
|
51
|
+
expect(@d.beginning_of_financial_year).to eql(Date.new(2009,4,1))
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
context "should report correct date field" do
|
56
|
-
before
|
56
|
+
before :each do
|
57
57
|
Date.fiscal_zone = :india
|
58
58
|
@d = Date.new(2009,1,1)
|
59
59
|
end
|
60
60
|
|
61
61
|
it "should report correct financial year" do
|
62
|
-
@d.financial_year.
|
62
|
+
expect(@d.financial_year).to eql(2008)
|
63
63
|
end
|
64
64
|
|
65
65
|
it "should report correct beginning and of financial year" do
|
66
|
-
@d.beginning_of_financial_year.
|
67
|
-
@d.end_of_financial_year.
|
66
|
+
expect(@d.beginning_of_financial_year).to eql(Date.new(2008,4,1))
|
67
|
+
expect(@d.end_of_financial_year).to eql(Date.new(2009,3,31))
|
68
68
|
end
|
69
69
|
|
70
70
|
it "should report correct beginning of financial halves and quarters" do
|
71
|
-
@d.beginning_of_financial_h1.
|
72
|
-
@d.beginning_of_financial_h2.
|
73
|
-
@d.beginning_of_financial_q1.
|
74
|
-
@d.beginning_of_financial_q2.
|
75
|
-
@d.beginning_of_financial_q3.
|
76
|
-
@d.beginning_of_financial_q4.
|
71
|
+
expect(@d.beginning_of_financial_h1).to eql(Date.new(2008,4,1))
|
72
|
+
expect(@d.beginning_of_financial_h2).to eql(Date.new(2008,10,1))
|
73
|
+
expect(@d.beginning_of_financial_q1).to eql(Date.new(2008,4,1))
|
74
|
+
expect(@d.beginning_of_financial_q2).to eql(Date.new(2008,7,1))
|
75
|
+
expect(@d.beginning_of_financial_q3).to eql(Date.new(2008,10,1))
|
76
|
+
expect(@d.beginning_of_financial_q4).to eql(Date.new(2009,1,1))
|
77
77
|
end
|
78
78
|
|
79
79
|
it "should report correct end of financial halves and quarters" do
|
80
|
-
@d.end_of_financial_h1.
|
81
|
-
@d.end_of_financial_h2.
|
82
|
-
@d.end_of_financial_q1.
|
83
|
-
@d.end_of_financial_q2.
|
84
|
-
@d.end_of_financial_q3.
|
85
|
-
@d.end_of_financial_q4.
|
80
|
+
expect(@d.end_of_financial_h1).to eql(Date.new(2008,9,30))
|
81
|
+
expect(@d.end_of_financial_h2).to eql(Date.new(2009,3,31))
|
82
|
+
expect(@d.end_of_financial_q1).to eql(Date.new(2008,6,30))
|
83
|
+
expect(@d.end_of_financial_q2).to eql(Date.new(2008,9,30))
|
84
|
+
expect(@d.end_of_financial_q3).to eql(Date.new(2008,12,31))
|
85
|
+
expect(@d.end_of_financial_q4).to eql(Date.new(2009,3,31))
|
86
86
|
|
87
|
-
Date.fiscal_zone = :us
|
87
|
+
Date.fiscal_zone = :us
|
88
88
|
|
89
|
-
@d.end_of_financial_h1.
|
90
|
-
@d.end_of_financial_h2.
|
91
|
-
@d.end_of_financial_q1.
|
92
|
-
@d.end_of_financial_q2.
|
93
|
-
@d.end_of_financial_q3.
|
94
|
-
@d.end_of_financial_q4.
|
89
|
+
expect(@d.end_of_financial_h1).to eql(Date.new(2009,3,31))
|
90
|
+
expect(@d.end_of_financial_h2).to eql(Date.new(2009,9,30))
|
91
|
+
expect(@d.end_of_financial_q1).to eql(Date.new(2008,12,31))
|
92
|
+
expect(@d.end_of_financial_q2).to eql(Date.new(2009,3,31))
|
93
|
+
expect(@d.end_of_financial_q3).to eql(Date.new(2009,6,30))
|
94
|
+
expect(@d.end_of_financial_q4).to eql(Date.new(2009,9,30))
|
95
95
|
end
|
96
96
|
|
97
97
|
it "should report financial quarters" do
|
98
|
-
@d.financial_quarter.
|
98
|
+
expect(@d.financial_quarter).to eql('Q4 2008')
|
99
99
|
end
|
100
100
|
|
101
101
|
it "should report financial half" do
|
102
|
-
@d.financial_half.
|
103
|
-
Date.new(2009,11,30).financial_half.
|
102
|
+
expect(@d.financial_half).to eql('H2 2008')
|
103
|
+
expect(Date.new(2009, 11, 30).financial_half).to eql('H2 2009')
|
104
104
|
end
|
105
105
|
|
106
106
|
it "should report next half and quarter" do
|
107
|
-
@d.next_financial_half.
|
108
|
-
Date.new(2009,6,1).next_financial_half.
|
107
|
+
expect(@d.next_financial_half).to eql(Date.new(2009,4,1))
|
108
|
+
expect(Date.new(2009,6,1).next_financial_half).to eql(Date.new(2009,10,1))
|
109
109
|
|
110
|
-
@d.next_financial_quarter.
|
111
|
-
Date.new(2009,10,30).next_financial_quarter.
|
110
|
+
expect(@d.next_financial_quarter).to eql(Date.new(2009,4,1))
|
111
|
+
expect(Date.new(2009,10,30).next_financial_quarter).to eql(Date.new(2010,1,1))
|
112
112
|
end
|
113
113
|
|
114
114
|
it "should report beginning of financial half and quarter" do
|
115
|
-
@d.beginning_of_financial_half.
|
116
|
-
@d.beginning_of_financial_quarter.
|
117
|
-
Date.new(2009,6,1).beginning_of_financial_half.
|
118
|
-
Date.new(2009,10,30).beginning_of_financial_quarter.
|
115
|
+
expect(@d.beginning_of_financial_half).to eql(Date.new(2008,10,1))
|
116
|
+
expect(@d.beginning_of_financial_quarter).to eql(Date.new(2009,1,1))
|
117
|
+
expect(Date.new(2009,6,1).beginning_of_financial_half).to eql(Date.new(2009,4,1))
|
118
|
+
expect(Date.new(2009,10,30).beginning_of_financial_quarter).to eql(Date.new(2009,10,1))
|
119
119
|
end
|
120
120
|
|
121
121
|
it "should report previous financial half and quarter" do
|
122
|
-
@d.previous_financial_half.
|
123
|
-
@d.previous_financial_quarter.
|
124
|
-
Date.new(2009,6,1).previous_financial_half.
|
125
|
-
Date.new(2009,10,30).previous_financial_quarter.
|
122
|
+
expect(@d.previous_financial_half).to eql(Date.new(2008,4,1))
|
123
|
+
expect(@d.previous_financial_quarter).to eql(Date.new(2008,10,1))
|
124
|
+
expect(Date.new(2009,6,1).previous_financial_half).to eql(Date.new(2008,10,1))
|
125
|
+
expect(Date.new(2009,10,30).previous_financial_quarter).to eql(Date.new(2009,7,1))
|
126
126
|
end
|
127
127
|
|
128
128
|
end
|
@@ -134,23 +134,23 @@ describe "fiscali" do
|
|
134
134
|
end
|
135
135
|
|
136
136
|
it "should report beginning of year/half/quarter with timestamp at beginning of day" do
|
137
|
-
@t.beginning_of_financial_year.
|
138
|
-
@t.beginning_of_financial_h1.
|
139
|
-
@t.beginning_of_financial_h2.
|
140
|
-
@t.beginning_of_financial_q1.
|
141
|
-
@t.beginning_of_financial_q2.
|
142
|
-
@t.beginning_of_financial_q3.
|
143
|
-
@t.beginning_of_financial_q4.
|
137
|
+
expect(@t.beginning_of_financial_year).to eql(Time.new(2008,4,1,0,0,0))
|
138
|
+
expect(@t.beginning_of_financial_h1).to eql(Time.new(2008,4,1,0,0,0))
|
139
|
+
expect(@t.beginning_of_financial_h2).to eql(Time.new(2008,10,1,0,0,0))
|
140
|
+
expect(@t.beginning_of_financial_q1).to eql(Time.new(2008,4,1,0,0,0))
|
141
|
+
expect(@t.beginning_of_financial_q2).to eql(Time.new(2008,7,1,0,0,0))
|
142
|
+
expect(@t.beginning_of_financial_q3).to eql(Time.new(2008,10,1,0,0,0))
|
143
|
+
expect(@t.beginning_of_financial_q4).to eql(Time.new(2009,1,1,0,0,0))
|
144
144
|
end
|
145
145
|
|
146
146
|
it "should report end of year/half/quarter with timestamp at end of day" do
|
147
|
-
@t.end_of_financial_year.
|
148
|
-
@t.end_of_financial_h1.
|
149
|
-
@t.end_of_financial_h2.
|
150
|
-
@t.end_of_financial_q1.
|
151
|
-
@t.end_of_financial_q2.
|
152
|
-
@t.end_of_financial_q3.
|
153
|
-
@t.end_of_financial_q4.
|
147
|
+
expect(@t.end_of_financial_year).to eql(Time.new(2009,3,31).end_of_day)
|
148
|
+
expect(@t.end_of_financial_h1).to eql(Time.new(2008,9,30).end_of_day)
|
149
|
+
expect(@t.end_of_financial_h2).to eql(Time.new(2009,3,31).end_of_day)
|
150
|
+
expect(@t.end_of_financial_q1).to eql(Time.new(2008,6,30).end_of_day)
|
151
|
+
expect(@t.end_of_financial_q2).to eql(Time.new(2008,9,30).end_of_day)
|
152
|
+
expect(@t.end_of_financial_q3).to eql(Time.new(2008,12,31).end_of_day)
|
153
|
+
expect(@t.end_of_financial_q4).to eql(Time.new(2009,3,31).end_of_day)
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
@@ -158,7 +158,6 @@ describe "fiscali" do
|
|
158
158
|
Date.fiscal_zone = :india
|
159
159
|
thread = Thread.new { Thread.current["my_fiscal_zone"] = Date.fiscal_zone }
|
160
160
|
thread.join
|
161
|
-
thread[
|
161
|
+
expect(thread['my_fiscal_zone']).to eql(:india)
|
162
162
|
end
|
163
|
-
|
164
|
-
end
|
163
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fiscali
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aditya Sanghi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ! '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ! '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ! '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3.3'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '3.3'
|
55
55
|
description: Fiscal Year Date Functions
|
56
56
|
email:
|
57
57
|
- asanghi@me.com
|
@@ -59,9 +59,9 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
-
|
63
|
-
-
|
64
|
-
-
|
62
|
+
- .document
|
63
|
+
- .gitignore
|
64
|
+
- .travis.yml
|
65
65
|
- CHANGELOG
|
66
66
|
- Gemfile
|
67
67
|
- LICENSE
|
@@ -75,7 +75,8 @@ files:
|
|
75
75
|
- spec/fiscali_spec.rb
|
76
76
|
- spec/spec_helper.rb
|
77
77
|
homepage: https://github.com/asanghi/fiscali
|
78
|
-
licenses:
|
78
|
+
licenses:
|
79
|
+
- MIT
|
79
80
|
metadata: {}
|
80
81
|
post_install_message:
|
81
82
|
rdoc_options: []
|
@@ -83,17 +84,17 @@ require_paths:
|
|
83
84
|
- lib
|
84
85
|
required_ruby_version: !ruby/object:Gem::Requirement
|
85
86
|
requirements:
|
86
|
-
- -
|
87
|
+
- - ! '>='
|
87
88
|
- !ruby/object:Gem::Version
|
88
89
|
version: '0'
|
89
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
91
|
requirements:
|
91
|
-
- -
|
92
|
+
- - ! '>='
|
92
93
|
- !ruby/object:Gem::Version
|
93
94
|
version: '0'
|
94
95
|
requirements: []
|
95
96
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.
|
97
|
+
rubygems_version: 2.4.8
|
97
98
|
signing_key:
|
98
99
|
specification_version: 4
|
99
100
|
summary: Fiscal Year Date Functions
|