fyuk 0.6.7 → 0.6.8

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.7
1
+ 0.6.8
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "fyuk"
8
- s.version = "0.6.7"
8
+ s.version = "0.6.8"
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-11"
12
+ s.date = "2013-08-15"
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 = [
@@ -2,11 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  describe UkFinancialYear do
4
4
 
5
- before :all do
6
- @fy = UkFinancialYear.from_s '2012/13'
7
- end
8
-
9
- subject { @fy }
5
+ subject { UkFinancialYear.from_s '2012/13' }
10
6
 
11
7
  its(:first_day) { should == '6 Apr 2012'.to_date }
12
8
  its(:last_day) { should == '5 Apr 2013'.to_date }
@@ -19,8 +15,10 @@ describe UkFinancialYear do
19
15
 
20
16
  specify { UkFinancialYear.new('5 Apr 2011'.to_date).should be < UkFinancialYear.new('6 Apr 2011'.to_date) }
21
17
 
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' }
18
+ describe "#to_s" do
19
+ specify { UkFinancialYear.new('7 Apr 2011'.to_date).to_s.should == '2011/12' }
20
+ specify { UkFinancialYear.new('7 Apr 1999'.to_date).to_s.should == '1999/00' }
21
+ end
24
22
 
25
23
  describe "#first_day" do
26
24
  specify { UkFinancialYear.new('4 Apr 2011'.to_date).first_day.should == '6 Apr 2010'.to_date }
@@ -37,11 +35,7 @@ describe UkFinancialYear do
37
35
  end
38
36
 
39
37
  describe "#.include?" do
40
- before :each do
41
- @fy = UkFinancialYear.from_s '2012/13'
42
- end
43
-
44
- subject { @fy }
38
+ subject { UkFinancialYear.from_s '2012/13' }
45
39
 
46
40
  it { should_not include '5 Apr 2012'.to_date }
47
41
  it { should include '6 Apr 2012'.to_date }
@@ -75,32 +69,21 @@ describe UkFinancialYear do
75
69
  end
76
70
 
77
71
  describe "#adjacent" do
78
- before :each do
79
- @fy2011_12 = UkFinancialYear.from_s '2011/12'
80
- @fy2012_13 = @fy2011_12.next
81
- @fy2013_14 = @fy2012_13.next
82
- @fy2013_15 = @fy2013_14.next
83
- end
72
+ subject { UkFinancialYear.from_s '2011/12' }
84
73
 
85
- subject { @fy2012_13 }
86
-
87
- it { should be_adjacent @fy2011_12 }
88
- it { should be_adjacent @fy2013_14 }
89
- it { should_not be_adjacent @fy2013_15 }
90
- it { should_not be_adjacent @fy2012_13 }
74
+ it { should_not be_adjacent UkFinancialYear.from_s '2009/10' }
75
+ it { should be_adjacent UkFinancialYear.from_s '2010/11' }
76
+ it { should be_adjacent UkFinancialYear.from_s '2012/13' }
77
+ it { should_not be_adjacent UkFinancialYear.from_s '2013/14' }
91
78
  end
92
79
 
93
80
  describe "#before? and #after?" do
94
- before :each do
95
- @fy = UkFinancialYear.from_s '2011/12'
96
- end
97
-
98
- subject { @fy }
81
+ subject { UkFinancialYear.from_s '2011/12' }
99
82
 
100
83
  it { should be_before UkFinancialYear.from_s('2012/13') }
84
+ it { should be_before UkFinancialYear.from_s('2012/13').first_day }
101
85
  it { should be_after UkFinancialYear.from_s('2010/11') }
102
- it { should be_before UkFinancialYear.from_s('2012/13').last_day }
103
- it { should be_after UkFinancialYear.from_s('2010/11').first_day }
86
+ it { should be_after UkFinancialYear.from_s('2010/11').last_day }
104
87
  end
105
88
 
106
89
  describe "creation without date" do
@@ -112,15 +95,11 @@ describe UkFinancialYear do
112
95
  end
113
96
 
114
97
  describe "#fy_before" do
115
- before :each do
116
- @fy = UkFinancialYear.from_s '2012/13'
117
- end
118
-
119
- subject { @fy }
98
+ subject { UkFinancialYear.from_s '2012/13' }
120
99
 
121
100
  it "raises an error for a date before the FY" do
122
101
  expect {
123
- @fy.period_before('5 Apr 2012'.to_date)
102
+ subject.period_before('5 Apr 2012'.to_date)
124
103
  }.to raise_error(
125
104
  RuntimeError,
126
105
  /2012-04-05 is before FY 2012\/13/
@@ -129,15 +108,15 @@ describe UkFinancialYear do
129
108
 
130
109
  it "raises an error for a date after the FY" do
131
110
  expect {
132
- @fy.period_before('6 Apr 2013'.to_date)
111
+ subject.period_before('6 Apr 2013'.to_date)
133
112
  }.to raise_error(
134
113
  RuntimeError,
135
114
  /2013-04-06 is after FY 2012\/13/
136
115
  )
137
116
  end
138
117
 
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) }
118
+ specify { subject.period_before('6 Apr 2012'.to_date).should == ('6 Apr 2012'.to_date...'6 Apr 2012'.to_date) }
119
+ specify { subject.period_before('7 Apr 2012'.to_date).should == ('6 Apr 2012'.to_date...'7 Apr 2012'.to_date) }
120
+ specify { subject.period_before('8 Apr 2012'.to_date).should == ('6 Apr 2012'.to_date...'8 Apr 2012'.to_date) }
142
121
  end
143
122
  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.7
4
+ version: 0.6.8
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-11 00:00:00.000000000 Z
12
+ date: 2013-08-15 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: 423172424874906291
179
+ hash: 2673596104134958708
180
180
  required_rubygems_version: !ruby/object:Gem::Requirement
181
181
  none: false
182
182
  requirements: