double_entry 0.10.0 → 0.10.1
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/.rspec +2 -1
- data/.rubocop.yml +55 -0
- data/.travis.yml +23 -12
- data/README.md +5 -1
- data/Rakefile +8 -3
- data/double_entry.gemspec +4 -3
- data/lib/active_record/locking_extensions.rb +28 -40
- data/lib/active_record/locking_extensions/log_subscriber.rb +4 -4
- data/lib/double_entry.rb +0 -2
- data/lib/double_entry/account.rb +13 -16
- data/lib/double_entry/account_balance.rb +0 -4
- data/lib/double_entry/balance_calculator.rb +4 -5
- data/lib/double_entry/configurable.rb +0 -2
- data/lib/double_entry/configuration.rb +2 -3
- data/lib/double_entry/errors.rb +2 -2
- data/lib/double_entry/line.rb +13 -16
- data/lib/double_entry/locking.rb +13 -18
- data/lib/double_entry/reporting.rb +2 -3
- data/lib/double_entry/reporting/aggregate.rb +90 -88
- data/lib/double_entry/reporting/aggregate_array.rb +58 -58
- data/lib/double_entry/reporting/day_range.rb +37 -35
- data/lib/double_entry/reporting/hour_range.rb +40 -37
- data/lib/double_entry/reporting/line_aggregate.rb +27 -28
- data/lib/double_entry/reporting/month_range.rb +67 -67
- data/lib/double_entry/reporting/time_range.rb +40 -38
- data/lib/double_entry/reporting/time_range_array.rb +3 -5
- data/lib/double_entry/reporting/week_range.rb +77 -78
- data/lib/double_entry/reporting/year_range.rb +27 -27
- data/lib/double_entry/transfer.rb +14 -15
- data/lib/double_entry/validation/line_check.rb +92 -86
- data/lib/double_entry/version.rb +1 -1
- data/lib/generators/double_entry/install/install_generator.rb +1 -2
- data/lib/generators/double_entry/install/templates/migration.rb +0 -2
- data/script/jack_hammer +1 -1
- data/spec/active_record/locking_extensions_spec.rb +45 -38
- data/spec/double_entry/account_balance_spec.rb +4 -5
- data/spec/double_entry/account_spec.rb +43 -44
- data/spec/double_entry/balance_calculator_spec.rb +6 -8
- data/spec/double_entry/configuration_spec.rb +14 -16
- data/spec/double_entry/line_spec.rb +25 -26
- data/spec/double_entry/locking_spec.rb +34 -39
- data/spec/double_entry/reporting/aggregate_array_spec.rb +8 -10
- data/spec/double_entry/reporting/aggregate_spec.rb +84 -44
- data/spec/double_entry/reporting/line_aggregate_spec.rb +7 -6
- data/spec/double_entry/reporting/month_range_spec.rb +109 -103
- data/spec/double_entry/reporting/time_range_array_spec.rb +145 -135
- data/spec/double_entry/reporting/time_range_spec.rb +36 -35
- data/spec/double_entry/reporting/week_range_spec.rb +82 -76
- data/spec/double_entry/reporting_spec.rb +9 -13
- data/spec/double_entry/transfer_spec.rb +13 -15
- data/spec/double_entry/validation/line_check_spec.rb +73 -79
- data/spec/double_entry_spec.rb +65 -68
- data/spec/generators/double_entry/install/install_generator_spec.rb +7 -10
- data/spec/spec_helper.rb +68 -10
- data/spec/support/accounts.rb +2 -4
- data/spec/support/double_entry_spec_helper.rb +4 -4
- data/spec/support/gemfiles/Gemfile.rails-3.2.x +1 -0
- metadata +31 -2
@@ -1,10 +1,11 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
|
3
|
-
module
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
module DoubleEntry
|
3
|
+
module Reporting
|
4
|
+
RSpec.describe LineAggregate do
|
5
|
+
describe '.table_name' do
|
6
|
+
subject { LineAggregate.table_name }
|
7
|
+
it { should eq('double_entry_line_aggregates') }
|
8
|
+
end
|
8
9
|
end
|
9
10
|
end
|
10
11
|
end
|
@@ -1,133 +1,139 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
|
3
|
-
module
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
end
|
2
|
+
module DoubleEntry
|
3
|
+
module Reporting
|
4
|
+
RSpec.describe MonthRange do
|
5
|
+
describe '.from_time' do
|
6
|
+
subject(:from_time) { MonthRange.from_time(given_time) }
|
7
|
+
|
8
|
+
context 'given the Time 31st March 2012' do
|
9
|
+
let(:given_time) { Time.new(2012, 3, 31) }
|
10
|
+
its(:year) { should eq 2012 }
|
11
|
+
its(:month) { should eq 3 }
|
12
|
+
end
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
14
|
+
context 'given the Date 31st March 2012' do
|
15
|
+
let(:given_time) { Date.parse('2012-03-31') }
|
16
|
+
its(:year) { should eq 2012 }
|
17
|
+
its(:month) { should eq 3 }
|
18
|
+
end
|
19
|
+
end
|
21
20
|
|
22
|
-
|
23
|
-
|
21
|
+
describe '.reportable_months' do
|
22
|
+
subject(:reportable_months) { MonthRange.reportable_months }
|
24
23
|
|
25
|
-
|
26
|
-
|
24
|
+
context 'The date is 1st March 1970' do
|
25
|
+
before { Timecop.freeze(Time.new(1970, 3, 1)) }
|
27
26
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
specify do
|
28
|
+
should eq [
|
29
|
+
MonthRange.new(:year => 1970, :month => 1),
|
30
|
+
MonthRange.new(:year => 1970, :month => 2),
|
31
|
+
MonthRange.new(:year => 1970, :month => 3),
|
32
|
+
]
|
33
|
+
end
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
context 'My business started on 5th Feb 1970' do
|
36
|
+
before do
|
37
|
+
DoubleEntry::Reporting.configure do |config|
|
38
|
+
config.start_of_business = Time.new(1970, 2, 5)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
specify do
|
43
|
+
should eq [
|
44
|
+
MonthRange.new(:year => 1970, :month => 2),
|
45
|
+
MonthRange.new(:year => 1970, :month => 3),
|
46
|
+
]
|
47
|
+
end
|
38
48
|
end
|
39
49
|
end
|
40
50
|
|
41
|
-
|
42
|
-
|
43
|
-
MonthRange.new(year: 1970, month: 3),
|
44
|
-
] }
|
45
|
-
end
|
46
|
-
end
|
51
|
+
context 'The date is 1st Jan 1970' do
|
52
|
+
before { Timecop.freeze(Time.new(1970, 1, 1)) }
|
47
53
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
it { should eq [ MonthRange.new(year: 1970, month: 1) ] }
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
describe "::beginning_of_financial_year" do
|
56
|
-
let(:month_range) { MonthRange.new(:year => year, :month => month) }
|
57
|
-
let(:year) { 2014 }
|
58
|
-
|
59
|
-
context "the first month of the financial year is July" do
|
60
|
-
subject(:beginning_of_financial_year) { month_range.beginning_of_financial_year }
|
61
|
-
context "returns the current year if the month is after July" do
|
62
|
-
let(:month) { 10 }
|
63
|
-
it { should eq(MonthRange.new(:year => 2014, :month => 7)) }
|
54
|
+
it { should eq [MonthRange.new(:year => 1970, :month => 1)] }
|
55
|
+
end
|
64
56
|
end
|
65
57
|
|
66
|
-
|
67
|
-
let(:
|
68
|
-
|
69
|
-
end
|
70
|
-
end
|
58
|
+
describe '.beginning_of_financial_year' do
|
59
|
+
let(:month_range) { MonthRange.new(:year => year, :month => month) }
|
60
|
+
let(:year) { 2014 }
|
71
61
|
|
72
|
-
|
73
|
-
|
62
|
+
context 'the first month of the financial year is July' do
|
63
|
+
subject(:beginning_of_financial_year) { month_range.beginning_of_financial_year }
|
64
|
+
context 'returns the current year if the month is after July' do
|
65
|
+
let(:month) { 10 }
|
66
|
+
it { should eq(MonthRange.new(:year => 2014, :month => 7)) }
|
67
|
+
end
|
74
68
|
|
75
|
-
|
76
|
-
|
77
|
-
|
69
|
+
context 'returns the previous year if the month is before July' do
|
70
|
+
let(:month) { 3 }
|
71
|
+
it { should eq(MonthRange.new(:year => 2013, :month => 7)) }
|
72
|
+
end
|
78
73
|
end
|
79
|
-
end
|
80
74
|
|
81
|
-
|
82
|
-
|
83
|
-
it { should eq(MonthRange.new(:year => 2014, :month => 1)) }
|
84
|
-
end
|
75
|
+
context 'the first month of the financial year is January' do
|
76
|
+
subject(:beginning_of_financial_year) { month_range.beginning_of_financial_year }
|
85
77
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
78
|
+
before do
|
79
|
+
DoubleEntry::Reporting.configure do |config|
|
80
|
+
config.first_month_of_financial_year = 1
|
81
|
+
end
|
82
|
+
end
|
91
83
|
|
92
|
-
|
93
|
-
|
84
|
+
context 'returns the current year if the month is after January' do
|
85
|
+
let(:month) { 10 }
|
86
|
+
it { should eq(MonthRange.new(:year => 2014, :month => 1)) }
|
87
|
+
end
|
94
88
|
|
95
|
-
|
96
|
-
|
97
|
-
|
89
|
+
context 'returns the current year if the month is January' do
|
90
|
+
let(:month) { 1 }
|
91
|
+
it { should eq(MonthRange.new(:year => 2014, :month => 1)) }
|
92
|
+
end
|
98
93
|
end
|
99
|
-
end
|
100
94
|
|
101
|
-
|
102
|
-
|
103
|
-
it { should eq(MonthRange.new(:year => 2013, :month => 12)) }
|
104
|
-
end
|
95
|
+
context 'the first month of the financial year is December' do
|
96
|
+
subject(:beginning_of_financial_year) { month_range.beginning_of_financial_year }
|
105
97
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
98
|
+
before do
|
99
|
+
DoubleEntry::Reporting.configure do |config|
|
100
|
+
config.first_month_of_financial_year = 12
|
101
|
+
end
|
102
|
+
end
|
111
103
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
104
|
+
context 'returns the previous year if the month is before December (in the same year)' do
|
105
|
+
let(:month) { 11 }
|
106
|
+
it { should eq(MonthRange.new(:year => 2013, :month => 12)) }
|
107
|
+
end
|
108
|
+
|
109
|
+
context 'returns the previous year if the month is after December (in the next year)' do
|
110
|
+
let(:year) { 2015 }
|
111
|
+
let(:month) { 1 }
|
112
|
+
it { should eq(MonthRange.new(:year => 2014, :month => 12)) }
|
113
|
+
end
|
117
114
|
|
118
|
-
|
119
|
-
|
115
|
+
context 'returns the current year if the month is December' do
|
116
|
+
let(:month) { 12 }
|
117
|
+
it { should eq(MonthRange.new(:year => 2014, :month => 12)) }
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
context 'Given a start time of 3rd Dec 1982' do
|
122
|
+
subject(:reportable_months) { MonthRange.reportable_months(:from => Time.new(1982, 12, 3)) }
|
120
123
|
|
121
|
-
|
122
|
-
|
124
|
+
context 'The date is 2nd Feb 1983' do
|
125
|
+
before { Timecop.freeze(Time.new(1983, 2, 2)) }
|
123
126
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
127
|
+
specify do
|
128
|
+
should eq [
|
129
|
+
MonthRange.new(:year => 1982, :month => 12),
|
130
|
+
MonthRange.new(:year => 1983, :month => 1),
|
131
|
+
MonthRange.new(:year => 1983, :month => 2),
|
132
|
+
]
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
129
136
|
end
|
130
137
|
end
|
131
138
|
end
|
132
|
-
end
|
133
139
|
end
|
@@ -1,159 +1,169 @@
|
|
1
|
-
|
2
|
-
module
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
1
|
+
module DoubleEntry
|
2
|
+
module Reporting
|
3
|
+
RSpec.describe TimeRangeArray do
|
4
|
+
describe '.make' do
|
5
|
+
subject(:time_range_array) { TimeRangeArray.make(range_type, start, finish) }
|
6
|
+
|
7
|
+
context 'for "hour" range type' do
|
8
|
+
let(:range_type) { 'hour' }
|
9
|
+
|
10
|
+
context 'given start is "2007-05-03 15:00:00" and finish is "2007-05-03 18:00:00"' do
|
11
|
+
let(:start) { '2007-05-03 15:00:00' }
|
12
|
+
let(:finish) { '2007-05-03 18:00:00' }
|
13
|
+
specify do
|
14
|
+
should eq [
|
15
|
+
HourRange.from_time(Time.new(2007, 5, 3, 15)),
|
16
|
+
HourRange.from_time(Time.new(2007, 5, 3, 16)),
|
17
|
+
HourRange.from_time(Time.new(2007, 5, 3, 17)),
|
18
|
+
HourRange.from_time(Time.new(2007, 5, 3, 18)),
|
19
|
+
]
|
20
|
+
end
|
21
|
+
end
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
context 'given start and finish are nil' do
|
24
|
+
it 'should raise an error' do
|
25
|
+
expect { TimeRangeArray.make(range_type, nil, nil) }.
|
26
|
+
to raise_error 'Must specify start of range'
|
27
|
+
end
|
28
|
+
end
|
25
29
|
end
|
26
|
-
end
|
27
|
-
end
|
28
30
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
context 'given start is "2007-05-03" and finish is "2007-05-07"' do
|
33
|
-
let(:start) { '2007-05-03' }
|
34
|
-
let(:finish) { '2007-05-07' }
|
35
|
-
it { should eq [
|
36
|
-
DayRange.from_time(Time.new(2007, 5, 3)),
|
37
|
-
DayRange.from_time(Time.new(2007, 5, 4)),
|
38
|
-
DayRange.from_time(Time.new(2007, 5, 5)),
|
39
|
-
DayRange.from_time(Time.new(2007, 5, 6)),
|
40
|
-
DayRange.from_time(Time.new(2007, 5, 7)),
|
41
|
-
] }
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'given start and finish are nil' do
|
45
|
-
it 'should raise an error' do
|
46
|
-
expect { TimeRangeArray.make(range_type, nil, nil) }.
|
47
|
-
to raise_error 'Must specify start of range'
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
31
|
+
context 'for "day" range type' do
|
32
|
+
let(:range_type) { 'day' }
|
51
33
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
34
|
+
context 'given start is "2007-05-03" and finish is "2007-05-07"' do
|
35
|
+
let(:start) { '2007-05-03' }
|
36
|
+
let(:finish) { '2007-05-07' }
|
37
|
+
specify do
|
38
|
+
should eq [
|
39
|
+
DayRange.from_time(Time.new(2007, 5, 3)),
|
40
|
+
DayRange.from_time(Time.new(2007, 5, 4)),
|
41
|
+
DayRange.from_time(Time.new(2007, 5, 5)),
|
42
|
+
DayRange.from_time(Time.new(2007, 5, 6)),
|
43
|
+
DayRange.from_time(Time.new(2007, 5, 7)),
|
44
|
+
]
|
45
|
+
end
|
46
|
+
end
|
65
47
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
48
|
+
context 'given start and finish are nil' do
|
49
|
+
it 'should raise an error' do
|
50
|
+
expect { TimeRangeArray.make(range_type, nil, nil) }.
|
51
|
+
to raise_error 'Must specify start of range'
|
52
|
+
end
|
53
|
+
end
|
70
54
|
end
|
71
|
-
end
|
72
|
-
end
|
73
55
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
context 'given start is "2007-05-03" and finish is "2007-08-24"' do
|
78
|
-
let(:start) { '2007-05-03' }
|
79
|
-
let(:finish) { '2007-08-24' }
|
80
|
-
it { should eq [
|
81
|
-
MonthRange.from_time(Time.new(2007, 5)),
|
82
|
-
MonthRange.from_time(Time.new(2007, 6)),
|
83
|
-
MonthRange.from_time(Time.new(2007, 7)),
|
84
|
-
MonthRange.from_time(Time.new(2007, 8)),
|
85
|
-
] }
|
86
|
-
end
|
56
|
+
context 'for "week" range type' do
|
57
|
+
let(:range_type) { 'week' }
|
87
58
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
MonthRange.from_time(Time.new(2006, 12)),
|
101
|
-
MonthRange.from_time(Time.new(2007, 1)),
|
102
|
-
MonthRange.from_time(Time.new(2007, 2)),
|
103
|
-
MonthRange.from_time(Time.new(2007, 3)),
|
104
|
-
MonthRange.from_time(Time.new(2007, 4)),
|
105
|
-
] }
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
59
|
+
context 'given start is "2007-05-03" and finish is "2007-05-24"' do
|
60
|
+
let(:start) { '2007-05-03' }
|
61
|
+
let(:finish) { '2007-05-24' }
|
62
|
+
specify do
|
63
|
+
should eq [
|
64
|
+
WeekRange.from_time(Time.new(2007, 5, 3)),
|
65
|
+
WeekRange.from_time(Time.new(2007, 5, 10)),
|
66
|
+
WeekRange.from_time(Time.new(2007, 5, 17)),
|
67
|
+
WeekRange.from_time(Time.new(2007, 5, 24)),
|
68
|
+
]
|
69
|
+
end
|
70
|
+
end
|
109
71
|
|
110
|
-
|
111
|
-
|
72
|
+
context 'given start and finish are nil' do
|
73
|
+
it 'should raise an error' do
|
74
|
+
expect { TimeRangeArray.make(range_type, nil, nil) }.
|
75
|
+
to raise_error 'Must specify start of range'
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
112
79
|
|
113
|
-
|
114
|
-
|
80
|
+
context 'for "month" range type' do
|
81
|
+
let(:range_type) { 'month' }
|
115
82
|
|
116
|
-
|
117
|
-
|
118
|
-
|
83
|
+
context 'given start is "2007-05-03" and finish is "2007-08-24"' do
|
84
|
+
let(:start) { '2007-05-03' }
|
85
|
+
let(:finish) { '2007-08-24' }
|
86
|
+
specify do
|
87
|
+
should eq [
|
88
|
+
MonthRange.from_time(Time.new(2007, 5)),
|
89
|
+
MonthRange.from_time(Time.new(2007, 6)),
|
90
|
+
MonthRange.from_time(Time.new(2007, 7)),
|
91
|
+
MonthRange.from_time(Time.new(2007, 8)),
|
92
|
+
]
|
93
|
+
end
|
94
|
+
end
|
119
95
|
|
96
|
+
context 'given finish is nil' do
|
97
|
+
let(:start) { '2006-08-03' }
|
98
|
+
let(:finish) { nil }
|
120
99
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
100
|
+
context 'and the date is "2007-04-13"' do
|
101
|
+
before { Timecop.freeze(Time.new(2007, 4, 13)) }
|
102
|
+
|
103
|
+
specify do
|
104
|
+
should eq [
|
105
|
+
MonthRange.from_time(Time.new(2006, 8)),
|
106
|
+
MonthRange.from_time(Time.new(2006, 9)),
|
107
|
+
MonthRange.from_time(Time.new(2006, 10)),
|
108
|
+
MonthRange.from_time(Time.new(2006, 11)),
|
109
|
+
MonthRange.from_time(Time.new(2006, 12)),
|
110
|
+
MonthRange.from_time(Time.new(2007, 1)),
|
111
|
+
MonthRange.from_time(Time.new(2007, 2)),
|
112
|
+
MonthRange.from_time(Time.new(2007, 3)),
|
113
|
+
MonthRange.from_time(Time.new(2007, 4)),
|
114
|
+
]
|
115
|
+
end
|
116
|
+
end
|
126
117
|
end
|
127
118
|
end
|
128
119
|
|
129
|
-
context '
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
120
|
+
context 'for "year" range type' do
|
121
|
+
let(:range_type) { 'year' }
|
122
|
+
|
123
|
+
context 'given the date is "2009-11-23"' do
|
124
|
+
before { Timecop.freeze(Time.new(2009, 11, 23)) }
|
125
|
+
|
126
|
+
context 'given start is "2007-05-03" and finish is "2008-08-24"' do
|
127
|
+
let(:start) { '2007-05-03' }
|
128
|
+
let(:finish) { '2008-08-24' }
|
129
|
+
|
130
|
+
it 'takes notice of start and finish' do
|
131
|
+
should eq [
|
132
|
+
YearRange.from_time(Time.new(2007)),
|
133
|
+
YearRange.from_time(Time.new(2008)),
|
134
|
+
]
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
context 'given the start of business is "2006-07-10"' do
|
139
|
+
before do
|
140
|
+
allow(DoubleEntry::Reporting).
|
141
|
+
to receive_message_chain('configuration.start_of_business').
|
142
|
+
and_return(Time.new(2006, 7, 10))
|
143
|
+
end
|
144
|
+
|
145
|
+
context 'given start and finish are nil' do
|
146
|
+
let(:start) { nil }
|
147
|
+
let(:finish) { nil }
|
148
|
+
specify do
|
149
|
+
should eq [
|
150
|
+
YearRange.from_time(Time.new(2006)),
|
151
|
+
YearRange.from_time(Time.new(2007)),
|
152
|
+
YearRange.from_time(Time.new(2008)),
|
153
|
+
YearRange.from_time(Time.new(2009)),
|
154
|
+
]
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
134
158
|
end
|
159
|
+
end
|
135
160
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
it {
|
140
|
-
should eq [
|
141
|
-
YearRange.from_time(Time.new(2006)),
|
142
|
-
YearRange.from_time(Time.new(2007)),
|
143
|
-
YearRange.from_time(Time.new(2008)),
|
144
|
-
YearRange.from_time(Time.new(2009)),
|
145
|
-
]
|
146
|
-
}
|
161
|
+
context 'given an invalid range type "ueue"' do
|
162
|
+
it 'should raise an error' do
|
163
|
+
expect { TimeRangeArray.make('ueue') }.to raise_error ArgumentError
|
147
164
|
end
|
148
165
|
end
|
149
166
|
end
|
150
167
|
end
|
151
|
-
|
152
|
-
context 'given an invalid range type "ueue"' do
|
153
|
-
it 'should raise an error' do
|
154
|
-
expect { TimeRangeArray.make('ueue') }.to raise_error ArgumentError
|
155
|
-
end
|
156
|
-
end
|
157
168
|
end
|
158
|
-
end
|
159
169
|
end
|