calendarium-romanum 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/locales/cs.yml +14 -1
- data/config/locales/en.yml +12 -1
- data/config/locales/fr.yml +87 -0
- data/config/locales/it.yml +15 -2
- data/config/locales/la.yml +14 -1
- data/data/czech-cs.txt +1 -2
- data/data/universal-en.txt +1 -1
- data/data/universal-fr.txt +239 -0
- data/data/universal-it.txt +1 -1
- data/data/universal-la.txt +1 -1
- data/lib/calendarium-romanum.rb +1 -0
- data/lib/calendarium-romanum/calendar.rb +30 -18
- data/lib/calendarium-romanum/cli.rb +8 -4
- data/lib/calendarium-romanum/data.rb +1 -0
- data/lib/calendarium-romanum/day.rb +15 -0
- data/lib/calendarium-romanum/enums.rb +12 -2
- data/lib/calendarium-romanum/ordinalizer.rb +7 -4
- data/lib/calendarium-romanum/perpetual_calendar.rb +49 -0
- data/lib/calendarium-romanum/rank.rb +1 -1
- data/lib/calendarium-romanum/sanctorale.rb +8 -1
- data/lib/calendarium-romanum/temporale.rb +63 -36
- data/lib/calendarium-romanum/temporale/dates.rb +38 -25
- data/lib/calendarium-romanum/temporale/extensions/christ_eternal_priest.rb +4 -4
- data/lib/calendarium-romanum/version.rb +1 -1
- data/spec/calendar_spec.rb +233 -255
- data/spec/celebration_spec.rb +23 -0
- data/spec/colour_spec.rb +17 -0
- data/spec/data_spec.rb +1 -1
- data/spec/day_spec.rb +59 -0
- data/spec/ordinalizer_spec.rb +22 -0
- data/spec/perpetual_calendar_spec.rb +91 -0
- data/spec/rank_spec.rb +22 -7
- data/spec/sanctorale_spec.rb +84 -60
- data/spec/season_spec.rb +17 -0
- data/spec/spec_helper.rb +2 -2
- data/spec/temporale_spec.rb +62 -43
- metadata +12 -3
@@ -3,7 +3,7 @@ module CalendariumRomanum
|
|
3
3
|
# dates of movable feasts
|
4
4
|
module Dates
|
5
5
|
def self.first_advent_sunday(year)
|
6
|
-
sunday_before(nativity(year)) - 3 *
|
6
|
+
sunday_before(nativity(year)) - 3 * WEEK
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.nativity(year)
|
@@ -23,16 +23,26 @@ module CalendariumRomanum
|
|
23
23
|
octave_of(nativity(year))
|
24
24
|
end
|
25
25
|
|
26
|
-
def self.epiphany(year)
|
26
|
+
def self.epiphany(year, sunday: false)
|
27
|
+
if sunday
|
28
|
+
# GNLYC 7 a)
|
29
|
+
return sunday_after(Date.new(year + 1, 1, 1))
|
30
|
+
end
|
31
|
+
|
27
32
|
Date.new(year+1, 1, 6)
|
28
33
|
end
|
29
34
|
|
30
|
-
def self.baptism_of_lord(year)
|
31
|
-
|
35
|
+
def self.baptism_of_lord(year, epiphany_on_sunday: false)
|
36
|
+
e = epiphany(year, sunday: epiphany_on_sunday)
|
37
|
+
if epiphany_on_sunday
|
38
|
+
e + 1
|
39
|
+
else
|
40
|
+
sunday_after e
|
41
|
+
end
|
32
42
|
end
|
33
43
|
|
34
44
|
def self.ash_wednesday(year)
|
35
|
-
easter_sunday(year) - (6 *
|
45
|
+
easter_sunday(year) - (6 * WEEK + 4)
|
36
46
|
end
|
37
47
|
|
38
48
|
def self.easter_sunday(year)
|
@@ -42,17 +52,10 @@ module CalendariumRomanum
|
|
42
52
|
# https://github.com/jrobertson/easter
|
43
53
|
|
44
54
|
golden_number = (year % 19) + 1
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
else
|
50
|
-
# Gregorian calendar
|
51
|
-
dominical_number = (year + (year / 4) - (year / 100) + (year / 400)) % 7
|
52
|
-
solar_correction = (year - 1600) / 100 - (year - 1600) / 400
|
53
|
-
lunar_correction = (((year - 1400) / 100) * 8) / 25
|
54
|
-
paschal_full_moon = (3 - 11 * golden_number + solar_correction - lunar_correction) % 30
|
55
|
-
end
|
55
|
+
dominical_number = (year + (year / 4) - (year / 100) + (year / 400)) % 7
|
56
|
+
solar_correction = (year - 1600) / 100 - (year - 1600) / 400
|
57
|
+
lunar_correction = (((year - 1400) / 100) * 8) / 25
|
58
|
+
paschal_full_moon = (3 - 11 * golden_number + solar_correction - lunar_correction) % 30
|
56
59
|
dominical_number += 7 until dominical_number > 0
|
57
60
|
paschal_full_moon += 30 until paschal_full_moon > 0
|
58
61
|
paschal_full_moon -= 1 if paschal_full_moon == 29 or (paschal_full_moon == 28 and golden_number > 11)
|
@@ -80,24 +83,34 @@ module CalendariumRomanum
|
|
80
83
|
easter_sunday(year) - 1
|
81
84
|
end
|
82
85
|
|
83
|
-
def self.ascension(year)
|
86
|
+
def self.ascension(year, sunday: false)
|
87
|
+
if sunday
|
88
|
+
# GNLYC 7 b)
|
89
|
+
return easter_sunday(year) + 6 * WEEK
|
90
|
+
end
|
91
|
+
|
84
92
|
pentecost(year) - 10
|
85
93
|
end
|
86
94
|
|
87
95
|
def self.pentecost(year)
|
88
|
-
easter_sunday(year) + 7 *
|
96
|
+
easter_sunday(year) + 7 * WEEK
|
89
97
|
end
|
90
98
|
|
91
99
|
def self.holy_trinity(year)
|
92
100
|
octave_of(pentecost(year))
|
93
101
|
end
|
94
102
|
|
95
|
-
def self.
|
103
|
+
def self.corpus_christi(year, sunday: false)
|
104
|
+
if sunday
|
105
|
+
# GNLYC 7 c)
|
106
|
+
return holy_trinity(year) + WEEK
|
107
|
+
end
|
108
|
+
|
96
109
|
holy_trinity(year) + 4
|
97
110
|
end
|
98
111
|
|
99
112
|
def self.sacred_heart(year)
|
100
|
-
|
113
|
+
corpus_christi(year) + 8
|
101
114
|
end
|
102
115
|
|
103
116
|
def self.immaculate_heart(year)
|
@@ -112,26 +125,26 @@ module CalendariumRomanum
|
|
112
125
|
|
113
126
|
def self.weekday_before(weekday, date)
|
114
127
|
if date.wday == weekday then
|
115
|
-
return date -
|
128
|
+
return date - WEEK
|
116
129
|
elsif weekday < date.wday
|
117
130
|
return date - (date.wday - weekday)
|
118
131
|
else
|
119
|
-
return date - (date.wday +
|
132
|
+
return date - (date.wday + WEEK - weekday)
|
120
133
|
end
|
121
134
|
end
|
122
135
|
|
123
136
|
def self.weekday_after(weekday, date)
|
124
137
|
if date.wday == weekday then
|
125
|
-
return date +
|
138
|
+
return date + WEEK
|
126
139
|
elsif weekday > date.wday
|
127
140
|
return date + (weekday - date.wday)
|
128
141
|
else
|
129
|
-
return date + (
|
142
|
+
return date + (WEEK - date.wday + weekday)
|
130
143
|
end
|
131
144
|
end
|
132
145
|
|
133
146
|
def self.octave_of(date)
|
134
|
-
date +
|
147
|
+
date + WEEK
|
135
148
|
end
|
136
149
|
|
137
150
|
class << self
|
@@ -4,8 +4,8 @@ module CalendariumRomanum
|
|
4
4
|
# Temporale extension adding feast of Christ Eternal Priests,
|
5
5
|
# included in some local calendars
|
6
6
|
module ChristEternalPriest
|
7
|
-
def self.
|
8
|
-
|
7
|
+
def self.each_celebration
|
8
|
+
yield(
|
9
9
|
:christ_eternal_priest,
|
10
10
|
Celebration.new(
|
11
11
|
proc { I18n.t('temporale.extension.christ_eternal_priest') },
|
@@ -16,8 +16,8 @@ module CalendariumRomanum
|
|
16
16
|
end
|
17
17
|
|
18
18
|
# method computing date
|
19
|
-
def christ_eternal_priest
|
20
|
-
pentecost + 4
|
19
|
+
def self.christ_eternal_priest(year)
|
20
|
+
Dates.pentecost(year) + 4
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
data/spec/calendar_spec.rb
CHANGED
@@ -1,201 +1,223 @@
|
|
1
1
|
require_relative 'spec_helper'
|
2
2
|
|
3
3
|
describe CR::Calendar do
|
4
|
+
before :all do
|
5
|
+
@c = described_class.new(2013).freeze
|
6
|
+
end
|
4
7
|
|
5
|
-
describe '
|
6
|
-
|
7
|
-
|
8
|
+
describe '.new' do
|
9
|
+
it 'throws RangeError on invalid year' do
|
10
|
+
expect do
|
11
|
+
described_class.new(1968)
|
12
|
+
end.to raise_exception(RangeError, /in use only since 1st January 1970/)
|
8
13
|
end
|
9
14
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
15
|
+
it 'throws ArgumentError when Temporale year does not match' do
|
16
|
+
year = 2000
|
17
|
+
temporale = CR::Temporale.new year
|
18
|
+
expect do
|
19
|
+
CR::Calendar.new(year + 1, nil, temporale)
|
20
|
+
end.to raise_exception ArgumentError
|
21
|
+
end
|
22
|
+
end
|
14
23
|
|
15
|
-
|
16
|
-
|
17
|
-
|
24
|
+
describe '.for_day' do
|
25
|
+
it 'continues the previous year\'s calendar in summer' do
|
26
|
+
expect(described_class.for_day(Date.new(2014, 6, 9))).to eq described_class.new(2013)
|
18
27
|
end
|
19
28
|
|
20
|
-
|
21
|
-
|
22
|
-
expect(described_class.new(2014).lectionary).to eq :B
|
23
|
-
expect(described_class.new(2013).lectionary).to eq :A
|
24
|
-
expect(described_class.new(2012).lectionary).to eq :C
|
25
|
-
end
|
29
|
+
it 'provides the current year\'s calendar in December' do
|
30
|
+
expect(described_class.for_day(Date.new(2014, 12, 20))).to eq described_class.new(2014)
|
26
31
|
end
|
32
|
+
end
|
27
33
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
34
|
+
describe '#==' do
|
35
|
+
it 'considers calendars with the same year same' do
|
36
|
+
expect(described_class.new(2014) == described_class.new(2014)).to be true
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'considers calendars with different year different' do
|
40
|
+
expect(described_class.new(2014) == described_class.new(2010)).to be false
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe '#lectionary' do
|
45
|
+
it 'detects correctly' do
|
46
|
+
expect(described_class.new(2014).lectionary).to eq :B
|
47
|
+
expect(described_class.new(2013).lectionary).to eq :A
|
48
|
+
expect(described_class.new(2012).lectionary).to eq :C
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe '#ferial_lectionary' do
|
53
|
+
it 'detects correctly' do
|
54
|
+
expect(described_class.new(2014).ferial_lectionary).to eq 1
|
55
|
+
expect(described_class.new(2013).ferial_lectionary).to eq 2
|
33
56
|
end
|
57
|
+
end
|
34
58
|
|
35
|
-
|
36
|
-
|
37
|
-
|
59
|
+
describe '#day' do
|
60
|
+
describe 'received arguments' do
|
61
|
+
describe 'Date' do
|
62
|
+
it 'returns a Day' do
|
63
|
+
expect(@c.day(Date.new(2013, 12, 10))).to be_a CR::Day
|
64
|
+
end
|
38
65
|
end
|
39
66
|
|
40
|
-
|
41
|
-
|
67
|
+
describe 'DateTime' do
|
68
|
+
it 'returns a Day' do
|
69
|
+
expect(@c.day(DateTime.new(2013, 12, 10, 12, 10, 0))).to be_a CR::Day
|
70
|
+
end
|
42
71
|
end
|
43
|
-
end
|
44
72
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
it 'returns a Day' do
|
49
|
-
expect(@c.day(Date.new(2013, 12, 10))).to be_a CR::Day
|
50
|
-
end
|
73
|
+
describe 'three Integers' do
|
74
|
+
it 'returns a Day' do
|
75
|
+
expect(@c.day(2013, 12, 10)).to be_a CR::Day
|
51
76
|
end
|
77
|
+
end
|
52
78
|
|
53
|
-
|
54
|
-
|
55
|
-
|
79
|
+
describe 'two integers' do
|
80
|
+
describe 'autumn' do
|
81
|
+
it 'supplies year' do
|
82
|
+
day = @c.day(12, 10)
|
83
|
+
expect(day).to be_a CR::Day
|
84
|
+
expect(day.date).to eq Date.new(2013, 12, 10)
|
56
85
|
end
|
57
86
|
end
|
58
87
|
|
59
|
-
describe '
|
60
|
-
it '
|
61
|
-
|
88
|
+
describe 'spring' do
|
89
|
+
it 'supplies year' do
|
90
|
+
day = @c.day(4, 10)
|
91
|
+
expect(day).to be_a CR::Day
|
92
|
+
expect(day.date).to eq Date.new(2014, 4, 10)
|
62
93
|
end
|
63
94
|
end
|
64
95
|
|
65
|
-
describe '
|
66
|
-
describe '
|
67
|
-
it '
|
68
|
-
|
69
|
-
|
70
|
-
|
96
|
+
describe 'invalid' do
|
97
|
+
describe 'absolutely' do
|
98
|
+
it 'fails' do
|
99
|
+
expect do
|
100
|
+
day = @c.day(0, 34)
|
101
|
+
end.to raise_exception(ArgumentError, 'invalid date')
|
71
102
|
end
|
72
103
|
end
|
73
104
|
|
74
|
-
describe '
|
75
|
-
it '
|
76
|
-
|
77
|
-
|
78
|
-
|
105
|
+
describe 'for the given year' do
|
106
|
+
it 'fails' do
|
107
|
+
expect do
|
108
|
+
day = @c.day(2, 29)
|
109
|
+
end.to raise_exception(ArgumentError, 'invalid date')
|
79
110
|
end
|
80
111
|
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
81
115
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
end.to raise_exception(ArgumentError, 'invalid date')
|
88
|
-
end
|
89
|
-
end
|
116
|
+
describe "date not included in the calendar's year" do
|
117
|
+
it 'throws RangeError' do
|
118
|
+
expect { @c.day(2000, 1, 1) }.to raise_exception RangeError
|
119
|
+
end
|
120
|
+
end
|
90
121
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
end.to raise_exception(ArgumentError, 'invalid date')
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
122
|
+
describe 'date before system effectiveness' do
|
123
|
+
it 'throws RangeError' do
|
124
|
+
c = described_class.new 1969
|
125
|
+
expect { c.day(1969, 12, 20) }.to raise_exception RangeError
|
100
126
|
end
|
127
|
+
end
|
101
128
|
|
102
|
-
|
103
|
-
|
129
|
+
describe 'temporale features' do
|
130
|
+
describe 'season' do
|
131
|
+
it 'detects Advent correctly' do
|
132
|
+
expect(@c.day(2013, 12, 10).season).to eq CR::Seasons::ADVENT
|
133
|
+
end
|
104
134
|
end
|
105
135
|
|
106
|
-
describe '
|
107
|
-
describe '
|
108
|
-
it '
|
109
|
-
expect(@c.day(2013, 12, 10).
|
136
|
+
describe 'week of the season' do
|
137
|
+
describe 'Advent' do
|
138
|
+
it 'sets Advent week correctly' do
|
139
|
+
expect(@c.day(2013, 12, 10).season_week).to eq 2
|
140
|
+
expect(@c.day(2013, 12, 15).season_week).to eq 3
|
110
141
|
end
|
111
142
|
end
|
112
143
|
|
113
|
-
describe '
|
114
|
-
|
115
|
-
|
116
|
-
expect(@c.day(2013, 12, 10).season_week).to eq 2
|
117
|
-
expect(@c.day(2013, 12, 15).season_week).to eq 3
|
118
|
-
end
|
144
|
+
describe 'Christmas' do
|
145
|
+
it 'days before the first Sunday are week 0' do
|
146
|
+
expect(@c.day(2013, 12, 25).season_week).to eq 0
|
119
147
|
end
|
120
148
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
149
|
+
it 'first Sunday starts week 1' do
|
150
|
+
expect(@c.day(2013, 12, 29).season_week).to eq 1
|
151
|
+
end
|
152
|
+
end
|
125
153
|
|
126
|
-
|
127
|
-
|
128
|
-
|
154
|
+
describe 'Lent' do
|
155
|
+
it 'Ash Wednesday is week 0' do
|
156
|
+
expect(@c.day(2014, 3, 5).season_week).to eq 0
|
129
157
|
end
|
158
|
+
end
|
130
159
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
end
|
160
|
+
describe 'Easter' do
|
161
|
+
it 'Easter Sunday opens week 1' do
|
162
|
+
expect(@c.day(2014, 4, 20).season_week).to eq 1
|
135
163
|
end
|
164
|
+
end
|
136
165
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
end
|
166
|
+
describe 'Ordinary time' do
|
167
|
+
it 'Monday after Baptism of the Lord is week 1' do
|
168
|
+
expect(@c.day(2014, 1, 13).season_week).to eq 1
|
141
169
|
end
|
142
170
|
|
143
|
-
describe '
|
144
|
-
it '
|
145
|
-
|
171
|
+
describe 'after Pentecost' do
|
172
|
+
it '2014' do
|
173
|
+
c = described_class.new(2013)
|
174
|
+
expect(c.day(2014, 6, 9).season_week).to eq 10
|
146
175
|
end
|
147
176
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
end
|
153
|
-
|
154
|
-
it '2015' do
|
155
|
-
c = described_class.new(2014)
|
156
|
-
expect(c.day(2015, 5, 25).season_week).to eq 8
|
157
|
-
end
|
177
|
+
it '2015' do
|
178
|
+
c = described_class.new(2014)
|
179
|
+
expect(c.day(2015, 5, 25).season_week).to eq 8
|
180
|
+
end
|
158
181
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
182
|
+
it '2016' do
|
183
|
+
c = described_class.new(2015)
|
184
|
+
expect(c.day(2016, 5, 16).season_week).to eq 7
|
185
|
+
end
|
163
186
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
187
|
+
it '2017' do
|
188
|
+
c = described_class.new(2016)
|
189
|
+
expect(c.day(2017, 6, 5).season_week).to eq 9
|
190
|
+
end
|
168
191
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
end
|
192
|
+
describe 'works correctly for the whole week' do
|
193
|
+
describe 'first' do
|
194
|
+
Date.new(2014, 6, 9).upto(Date.new(2014, 6, 14)) do |date|
|
195
|
+
it date do
|
196
|
+
expect(@c.day(date).season_week).to eq 10
|
175
197
|
end
|
176
198
|
end
|
199
|
+
end
|
177
200
|
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
end
|
201
|
+
describe 'second' do
|
202
|
+
Date.new(2014, 6, 15).upto(Date.new(2014, 6, 21)) do |date|
|
203
|
+
it date do
|
204
|
+
expect(@c.day(date).season_week).to eq 11
|
183
205
|
end
|
184
206
|
end
|
207
|
+
end
|
185
208
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
end
|
209
|
+
describe 'second last' do
|
210
|
+
Date.new(2014, 11, 16).upto(Date.new(2014, 11, 22)) do |date|
|
211
|
+
it date do
|
212
|
+
expect(@c.day(date).season_week).to eq 33
|
191
213
|
end
|
192
214
|
end
|
215
|
+
end
|
193
216
|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
end
|
217
|
+
describe 'last' do
|
218
|
+
Date.new(2014, 11, 23).upto(Date.new(2014, 11, 29)) do |date|
|
219
|
+
it date do
|
220
|
+
expect(@c.day(date).season_week).to eq 34
|
199
221
|
end
|
200
222
|
end
|
201
223
|
end
|
@@ -203,149 +225,105 @@ describe CR::Calendar do
|
|
203
225
|
end
|
204
226
|
end
|
205
227
|
end
|
228
|
+
end
|
206
229
|
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
it '"empty" day results in a ferial' do
|
214
|
-
d = @c.day(7, 2)
|
215
|
-
expect(d.celebrations.size).to eq 1
|
216
|
-
expect(d.celebrations[0].rank).to eq CR::Ranks::FERIAL
|
217
|
-
end
|
218
|
-
|
219
|
-
it 'sanctorale feast' do
|
220
|
-
d = @c.day(7, 3)
|
221
|
-
expect(d.celebrations.size).to eq 1
|
222
|
-
expect(d.celebrations[0].rank).to eq CR::Ranks::FEAST_GENERAL
|
223
|
-
expect(d.celebrations[0].title).to include 'Thomas'
|
224
|
-
end
|
225
|
-
|
226
|
-
it 'optional memorial does not suppress ferial' do
|
227
|
-
d = @c.day(7, 14)
|
228
|
-
expect(d.celebrations.size).to eq 2
|
229
|
-
|
230
|
-
expect(d.celebrations[0].rank).to eq CR::Ranks::FERIAL
|
231
|
-
|
232
|
-
expect(d.celebrations[1].rank).to eq CR::Ranks::MEMORIAL_OPTIONAL
|
233
|
-
expect(d.celebrations[1].title).to include 'Lellis'
|
234
|
-
end
|
235
|
-
|
236
|
-
it 'obligatory memorial does suppress ferial' do
|
237
|
-
d = @c.day(1, 17)
|
238
|
-
expect(d.celebrations.size).to eq 1
|
230
|
+
describe 'Temporale x Sanctorale resolution' do
|
231
|
+
before :all do
|
232
|
+
@s = CR::Data::GENERAL_ROMAN_ENGLISH.load
|
233
|
+
@c = described_class.new(2013, @s).freeze
|
234
|
+
end
|
239
235
|
|
240
|
-
|
241
|
-
|
236
|
+
it '"empty" day results in a ferial' do
|
237
|
+
d = @c.day(7, 2)
|
238
|
+
expect(d.celebrations.size).to eq 1
|
239
|
+
expect(d.celebrations[0].rank).to eq CR::Ranks::FERIAL
|
240
|
+
end
|
242
241
|
|
243
|
-
|
244
|
-
|
245
|
-
|
242
|
+
it 'sanctorale feast' do
|
243
|
+
d = @c.day(7, 3)
|
244
|
+
expect(d.celebrations.size).to eq 1
|
245
|
+
expect(d.celebrations[0].rank).to eq CR::Ranks::FEAST_GENERAL
|
246
|
+
expect(d.celebrations[0].title).to include 'Thomas'
|
247
|
+
end
|
246
248
|
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
end
|
249
|
+
it 'optional memorial does not suppress ferial' do
|
250
|
+
d = @c.day(7, 14)
|
251
|
+
expect(d.celebrations.size).to eq 2
|
251
252
|
|
252
|
-
|
253
|
-
san = CR::Sanctorale.new
|
253
|
+
expect(d.celebrations[0].rank).to eq CR::Ranks::FERIAL
|
254
254
|
|
255
|
-
|
256
|
-
|
257
|
-
|
255
|
+
expect(d.celebrations[1].rank).to eq CR::Ranks::MEMORIAL_OPTIONAL
|
256
|
+
expect(d.celebrations[1].title).to include 'Lellis'
|
257
|
+
end
|
258
258
|
|
259
|
-
|
259
|
+
it 'obligatory memorial does suppress ferial' do
|
260
|
+
d = @c.day(1, 17)
|
261
|
+
expect(d.celebrations.size).to eq 1
|
260
262
|
|
261
|
-
|
262
|
-
|
263
|
-
expect(celebs[0].rank).to eq CR::Ranks::SUNDAY_UNPRIVILEGED
|
264
|
-
end
|
263
|
+
expect(d.celebrations[0].rank).to eq CR::Ranks::MEMORIAL_GENERAL
|
264
|
+
end
|
265
265
|
|
266
|
-
|
267
|
-
|
266
|
+
it 'memorial in Lent becomes mere commemoration' do
|
267
|
+
d = @c.day(4, 2)
|
268
|
+
expect(d.celebrations.size).to eq 2
|
268
269
|
|
269
|
-
|
270
|
-
|
271
|
-
|
270
|
+
comm = d.celebrations[1]
|
271
|
+
expect(comm.rank).to eq CR::Ranks::COMMEMORATION
|
272
|
+
expect(comm.title).to eq 'Saint Francis of Paola, hermit'
|
273
|
+
end
|
272
274
|
|
273
|
-
|
275
|
+
it 'Sunday suppresses feast' do
|
276
|
+
san = CR::Sanctorale.new
|
274
277
|
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
expect(celebs[0].rank).to eq CR::Ranks::TRIDUUM
|
279
|
-
expect(celebs[0].title).to have_translation 'Friday of the Passion of the Lord'
|
278
|
+
d = Date.new 2015, 6, 28
|
279
|
+
expect(d).to be_sunday # ensure
|
280
|
+
san.add d.month, d.day, CR::Celebration.new('St. None, programmer', CR::Ranks::FEAST_GENERAL)
|
280
281
|
|
281
|
-
|
282
|
-
d = c.temporale.easter_sunday + 8
|
283
|
-
celebs = c.day(d).celebrations
|
284
|
-
expect(celebs.size).to eq 1
|
285
|
-
expect(celebs[0]).to eq st_none
|
286
|
-
end
|
282
|
+
c = described_class.new 2014, san
|
287
283
|
|
288
|
-
|
289
|
-
|
284
|
+
celebs = c.day(d).celebrations
|
285
|
+
expect(celebs.size).to eq 1
|
286
|
+
expect(celebs[0].rank).to eq CR::Ranks::SUNDAY_UNPRIVILEGED
|
287
|
+
end
|
290
288
|
|
291
|
-
|
289
|
+
it 'suppressed fictive solemnity is transferred' do
|
290
|
+
san = CR::Sanctorale.new
|
292
291
|
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
expect(celebs[0].rank).to eq CR::Ranks::TRIDUUM
|
297
|
-
expect(celebs[0].title).to have_translation 'Friday of the Passion of the Lord'
|
292
|
+
d = CR::Temporale.new(2014).good_friday
|
293
|
+
st_none = CR::Celebration.new('St. None, abbot, founder of the Order of Programmers (OProg)', CR::Ranks::SOLEMNITY_PROPER)
|
294
|
+
san.add d.month, d.day, st_none
|
298
295
|
|
299
|
-
|
300
|
-
d = c.temporale.easter_sunday + 8
|
301
|
-
celebs = c.day(d).celebrations
|
302
|
-
expect(celebs.size).to eq 1
|
303
|
-
expect(celebs[0].title).to eq 'Annunciation of the Lord'
|
304
|
-
end
|
305
|
-
end
|
306
|
-
end
|
296
|
+
c = described_class.new 2014, san
|
307
297
|
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
expect(
|
312
|
-
expect(
|
313
|
-
end
|
298
|
+
# Good Friday suppresses the solemnity
|
299
|
+
celebs = c.day(d).celebrations
|
300
|
+
expect(celebs.size).to eq 1
|
301
|
+
expect(celebs[0].rank).to eq CR::Ranks::TRIDUUM
|
302
|
+
expect(celebs[0].title).to have_translation 'Friday of the Passion of the Lord'
|
314
303
|
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
expect(
|
304
|
+
# it is transferred on a day after the Easter octave
|
305
|
+
d = c.temporale.easter_sunday + 8
|
306
|
+
celebs = c.day(d).celebrations
|
307
|
+
expect(celebs.size).to eq 1
|
308
|
+
expect(celebs[0]).to eq st_none
|
320
309
|
end
|
321
310
|
|
322
|
-
it '
|
323
|
-
|
324
|
-
cal = described_class.new(2000, nil, t_class)
|
325
|
-
new_cal = cal.pred
|
326
|
-
expect(new_cal.temporale).to be_a t_class
|
327
|
-
end
|
328
|
-
end
|
311
|
+
it 'transfer of suppressed Annunciation (real world example)' do
|
312
|
+
c = described_class.new 2015, @s
|
329
313
|
|
330
|
-
|
331
|
-
it 'returns a calendar for the subsequent year' do
|
332
|
-
new_cal = @c.succ
|
333
|
-
expect(new_cal.year).to eq(@c.year + 1)
|
334
|
-
expect(new_cal.sanctorale).to eq (@c.sanctorale)
|
335
|
-
end
|
314
|
+
d = Date.new(2016, 3, 25)
|
336
315
|
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
expect(
|
342
|
-
end
|
316
|
+
# Good Friday suppresses the solemnity
|
317
|
+
celebs = c.day(d).celebrations
|
318
|
+
expect(celebs.size).to eq 1
|
319
|
+
expect(celebs[0].rank).to eq CR::Ranks::TRIDUUM
|
320
|
+
expect(celebs[0].title).to have_translation 'Friday of the Passion of the Lord'
|
343
321
|
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
expect(
|
322
|
+
# it is transferred on a day after the Easter octave
|
323
|
+
d = c.temporale.easter_sunday + 8
|
324
|
+
celebs = c.day(d).celebrations
|
325
|
+
expect(celebs.size).to eq 1
|
326
|
+
expect(celebs[0].title).to eq 'Annunciation of the Lord'
|
349
327
|
end
|
350
328
|
end
|
351
329
|
end
|