fyuk 0.6.5 → 0.6.7
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/fyuk.gemspec +2 -2
- data/spec/uk_financial_year_spec.rb +25 -25
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.7
|
data/fyuk.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "fyuk"
|
8
|
-
s.version = "0.6.
|
8
|
+
s.version = "0.6.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Nigel Lowry"]
|
12
|
-
s.date = "2012-11-
|
12
|
+
s.date = "2012-11-11"
|
13
13
|
s.description = "Small library with methods for finding the financial or fiscal year for a particular date and suchlike. Used by Hubo https://hubo.herokuapp.com/"
|
14
14
|
s.email = "nigel-lowry@ultra.eclipse.co.uk"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -8,32 +8,32 @@ describe UkFinancialYear do
|
|
8
8
|
|
9
9
|
subject { @fy }
|
10
10
|
|
11
|
-
its(:first_day) { should ==
|
12
|
-
its(:last_day) { should ==
|
11
|
+
its(:first_day) { should == '6 Apr 2012'.to_date }
|
12
|
+
its(:last_day) { should == '5 Apr 2013'.to_date }
|
13
13
|
its(:next) { should == UkFinancialYear.from_s('2013/14') }
|
14
14
|
its(:previous) { should == UkFinancialYear.from_s('2011/12') }
|
15
15
|
its(:to_s) { should == '2012/13' }
|
16
16
|
|
17
|
-
specify { UkFinancialYear.new(
|
18
|
-
specify { UkFinancialYear.new(
|
17
|
+
specify { UkFinancialYear.new('6 Apr 2011'.to_date).should == UkFinancialYear.new('7 Apr 2011'.to_date) }
|
18
|
+
specify { UkFinancialYear.new('5 Apr 2011'.to_date).should_not == UkFinancialYear.new('6 Apr 2011'.to_date) }
|
19
19
|
|
20
|
-
specify { UkFinancialYear.new(
|
20
|
+
specify { UkFinancialYear.new('5 Apr 2011'.to_date).should be < UkFinancialYear.new('6 Apr 2011'.to_date) }
|
21
21
|
|
22
|
-
specify { UkFinancialYear.new(
|
23
|
-
specify { UkFinancialYear.new(
|
22
|
+
specify { UkFinancialYear.new('7 Apr 2011'.to_date).to_s.should == '2011/12' }
|
23
|
+
specify { UkFinancialYear.new('7 Apr 1999'.to_date).to_s.should == '1999/00' }
|
24
24
|
|
25
25
|
describe "#first_day" do
|
26
|
-
specify { UkFinancialYear.new(
|
27
|
-
specify { UkFinancialYear.new(
|
28
|
-
specify { UkFinancialYear.new(
|
29
|
-
specify { UkFinancialYear.new(
|
26
|
+
specify { UkFinancialYear.new('4 Apr 2011'.to_date).first_day.should == '6 Apr 2010'.to_date }
|
27
|
+
specify { UkFinancialYear.new('5 Apr 2011'.to_date).first_day.should == '6 Apr 2010'.to_date }
|
28
|
+
specify { UkFinancialYear.new('6 Apr 2011'.to_date).first_day.should == '6 Apr 2011'.to_date }
|
29
|
+
specify { UkFinancialYear.new('7 Apr 2011'.to_date).first_day.should == '6 Apr 2011'.to_date }
|
30
30
|
end
|
31
31
|
|
32
32
|
describe "#last_day" do
|
33
|
-
specify { UkFinancialYear.new(
|
34
|
-
specify { UkFinancialYear.new(
|
35
|
-
specify { UkFinancialYear.new(
|
36
|
-
specify { UkFinancialYear.new(
|
33
|
+
specify { UkFinancialYear.new('4 Apr 2011'.to_date).last_day.should == '5 Apr 2011'.to_date }
|
34
|
+
specify { UkFinancialYear.new('5 Apr 2011'.to_date).last_day.should == '5 Apr 2011'.to_date }
|
35
|
+
specify { UkFinancialYear.new('6 Apr 2011'.to_date).last_day.should == '5 Apr 2012'.to_date }
|
36
|
+
specify { UkFinancialYear.new('7 Apr 2011'.to_date).last_day.should == '5 Apr 2012'.to_date }
|
37
37
|
end
|
38
38
|
|
39
39
|
describe "#.include?" do
|
@@ -43,10 +43,10 @@ describe UkFinancialYear do
|
|
43
43
|
|
44
44
|
subject { @fy }
|
45
45
|
|
46
|
-
it { should_not include
|
47
|
-
it { should include
|
48
|
-
it { should include
|
49
|
-
it { should_not include
|
46
|
+
it { should_not include '5 Apr 2012'.to_date }
|
47
|
+
it { should include '6 Apr 2012'.to_date }
|
48
|
+
it { should include '5 Apr 2013'.to_date }
|
49
|
+
it { should_not include '6 Apr 2013'.to_date }
|
50
50
|
end
|
51
51
|
|
52
52
|
describe "#from_s" do
|
@@ -105,7 +105,7 @@ describe UkFinancialYear do
|
|
105
105
|
|
106
106
|
describe "creation without date" do
|
107
107
|
it "is the current financial year" do
|
108
|
-
Timecop.freeze(
|
108
|
+
Timecop.freeze('5 Jul 2010'.to_date) do
|
109
109
|
UkFinancialYear.new.should == UkFinancialYear.from_s('2010/11')
|
110
110
|
end
|
111
111
|
end
|
@@ -120,7 +120,7 @@ describe UkFinancialYear do
|
|
120
120
|
|
121
121
|
it "raises an error for a date before the FY" do
|
122
122
|
expect {
|
123
|
-
@fy.period_before(
|
123
|
+
@fy.period_before('5 Apr 2012'.to_date)
|
124
124
|
}.to raise_error(
|
125
125
|
RuntimeError,
|
126
126
|
/2012-04-05 is before FY 2012\/13/
|
@@ -129,15 +129,15 @@ describe UkFinancialYear do
|
|
129
129
|
|
130
130
|
it "raises an error for a date after the FY" do
|
131
131
|
expect {
|
132
|
-
@fy.period_before(
|
132
|
+
@fy.period_before('6 Apr 2013'.to_date)
|
133
133
|
}.to raise_error(
|
134
134
|
RuntimeError,
|
135
135
|
/2013-04-06 is after FY 2012\/13/
|
136
136
|
)
|
137
137
|
end
|
138
138
|
|
139
|
-
specify { @fy.period_before(
|
140
|
-
specify { @fy.period_before(
|
141
|
-
specify { @fy.period_before(
|
139
|
+
specify { @fy.period_before('6 Apr 2012'.to_date).should == ('6 Apr 2012'.to_date...'6 Apr 2012'.to_date) }
|
140
|
+
specify { @fy.period_before('7 Apr 2012'.to_date).should == ('6 Apr 2012'.to_date...'7 Apr 2012'.to_date) }
|
141
|
+
specify { @fy.period_before('8 Apr 2012'.to_date).should == ('6 Apr 2012'.to_date...'8 Apr 2012'.to_date) }
|
142
142
|
end
|
143
143
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fyuk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -176,7 +176,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
176
176
|
version: '0'
|
177
177
|
segments:
|
178
178
|
- 0
|
179
|
-
hash:
|
179
|
+
hash: 423172424874906291
|
180
180
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
181
181
|
none: false
|
182
182
|
requirements:
|