calendarium-romanum 0.2.1 → 0.3.0
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/config/locales/cs.yml +37 -1
- data/config/locales/en.yml +37 -1
- data/config/locales/it.yml +36 -2
- data/config/locales/la.yml +35 -1
- data/data/README.md +62 -4
- data/data/czech-brno-cs.txt +10 -2
- data/data/czech-budejovice-cs.txt +10 -2
- data/data/czech-cechy-cs.txt +9 -2
- data/data/czech-cs.txt +7 -1
- data/data/czech-hradec-cs.txt +10 -2
- data/data/czech-litomerice-cs.txt +10 -2
- data/data/czech-morava-cs.txt +9 -2
- data/data/czech-olomouc-cs.txt +10 -2
- data/data/czech-ostrava-cs.txt +10 -2
- data/data/czech-plzen-cs.txt +10 -2
- data/data/czech-praha-cs.txt +10 -2
- data/data/universal-en.txt +4 -1
- data/data/universal-it.txt +4 -1
- data/data/universal-la.txt +4 -1
- data/lib/calendarium-romanum.rb +3 -0
- data/lib/calendarium-romanum/calendar.rb +13 -6
- data/lib/calendarium-romanum/data.rb +1 -1
- data/lib/calendarium-romanum/day.rb +0 -3
- data/lib/calendarium-romanum/enums.rb +41 -21
- data/lib/calendarium-romanum/ordinalizer.rb +37 -0
- data/lib/calendarium-romanum/sanctoraleloader.rb +13 -2
- data/lib/calendarium-romanum/temporale.rb +145 -232
- data/lib/calendarium-romanum/temporale/dates.rb +151 -0
- data/lib/calendarium-romanum/temporale/extensions/christ_eternal_priest.rb +25 -0
- data/lib/calendarium-romanum/transfers.rb +23 -5
- data/lib/calendarium-romanum/version.rb +1 -1
- data/spec/calendar_spec.rb +72 -19
- data/spec/dates_spec.rb +45 -0
- data/spec/rank_spec.rb +2 -2
- data/spec/readme_spec.rb +11 -9
- data/spec/spec_helper.rb +16 -1
- data/spec/temporale_spec.rb +252 -126
- metadata +19 -1
data/spec/rank_spec.rb
CHANGED
@@ -29,7 +29,7 @@ describe CR::Rank do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
describe '#desc' do
|
32
|
-
it { expect(CR::Ranks[1.1].desc).to
|
32
|
+
it { expect(CR::Ranks[1.1].desc).to have_translation 'Easter triduum' }
|
33
33
|
end
|
34
34
|
|
35
35
|
describe '#short_desc' do
|
@@ -37,6 +37,6 @@ describe CR::Rank do
|
|
37
37
|
expect(CR::Ranks[1.1].short_desc).to be_nil
|
38
38
|
end
|
39
39
|
|
40
|
-
it { expect(CR::Ranks[2.8].short_desc).to
|
40
|
+
it { expect(CR::Ranks[2.8].short_desc).to have_translation 'feast' }
|
41
41
|
end
|
42
42
|
end
|
data/spec/readme_spec.rb
CHANGED
@@ -34,16 +34,18 @@ class MarkdownDocument
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
%w(README.md data/README.md).each do |path|
|
38
|
+
describe path do
|
39
|
+
readme_path = File.expand_path('../../' + path, __FILE__)
|
40
|
+
readme = File.read readme_path
|
41
|
+
doc = MarkdownDocument.new readme
|
41
42
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
doc.each_ruby_example do |code, line|
|
44
|
+
describe "example L#{line}" do
|
45
|
+
it 'executes without failure' do
|
46
|
+
cls = Class.new
|
47
|
+
cls.class_eval(code, readme_path, line)
|
48
|
+
end
|
47
49
|
end
|
48
50
|
end
|
49
51
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -5,7 +5,6 @@
|
|
5
5
|
#
|
6
6
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
7
|
RSpec.configure do |config|
|
8
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
9
8
|
config.run_all_when_everything_filtered = true
|
10
9
|
config.filter_run :focus
|
11
10
|
|
@@ -16,5 +15,21 @@ RSpec.configure do |config|
|
|
16
15
|
config.order = 'random'
|
17
16
|
end
|
18
17
|
|
18
|
+
RSpec::Matchers.define :have_translation do |expected, locale|
|
19
|
+
match do |actual|
|
20
|
+
locale ||= :en
|
21
|
+
if I18n.locale == locale
|
22
|
+
actual == expected
|
23
|
+
else
|
24
|
+
# with locale different from the one the spec is written for
|
25
|
+
# just test that the string isn't left untranslated
|
26
|
+
!(actual.empty? || actual.include?('translation missing'))
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
19
31
|
require 'calendarium-romanum'
|
20
32
|
CR = CalendariumRomanum
|
33
|
+
|
34
|
+
I18n.enforce_available_locales = true
|
35
|
+
I18n.locale = ENV['LOCALE'] || :en
|
data/spec/temporale_spec.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
require_relative 'spec_helper'
|
2
3
|
|
3
4
|
describe CR::Temporale do
|
@@ -13,110 +14,73 @@ describe CR::Temporale do
|
|
13
14
|
[Date.new(2014, 11, 1), 2013],
|
14
15
|
[Date.new(2014, 12, 1), 2014]
|
15
16
|
].each do |date, year|
|
16
|
-
described_class.liturgical_year(date).
|
17
|
+
expect(described_class.liturgical_year(date)).to eq year
|
17
18
|
end
|
18
19
|
end
|
19
20
|
end
|
20
21
|
|
21
|
-
describe '#
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
describe '#weekday_after' do
|
35
|
-
it 'works well for all 7 weekdays' do
|
36
|
-
today = Date.new 2014, 3, 16
|
37
|
-
@t.monday_after(today).should eq Date.new(2014, 3, 17)
|
38
|
-
@t.tuesday_after(today).should eq Date.new(2014, 3, 18)
|
39
|
-
@t.wednesday_after(today).should eq Date.new(2014, 3, 19)
|
40
|
-
@t.thursday_after(today).should eq Date.new(2014, 3, 20)
|
41
|
-
@t.friday_after(today).should eq Date.new(2014, 3, 21)
|
42
|
-
@t.saturday_after(today).should eq Date.new(2014, 3, 22)
|
43
|
-
@t.sunday_after(today).should eq Date.new(2014, 3, 23)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
describe '#advent_sunday' do
|
48
|
-
it 'determines first Sunday of Advent' do
|
49
|
-
[
|
50
|
-
[2004, [11, 28]],
|
51
|
-
[2010, [11, 28]],
|
52
|
-
[2011, [11, 27]],
|
53
|
-
[2012, [12, 2]],
|
54
|
-
[2013, [12, 1]]
|
55
|
-
].each do |d|
|
56
|
-
year, date = d
|
57
|
-
@t.advent_sunday(1, year).should eq Date.new(year, *date)
|
22
|
+
describe '#first_advent_sunday determines first Sunday of Advent' do
|
23
|
+
[
|
24
|
+
[2004, [11, 28]],
|
25
|
+
[2010, [11, 28]],
|
26
|
+
[2011, [11, 27]],
|
27
|
+
[2012, [12, 2]],
|
28
|
+
[2013, [12, 1]]
|
29
|
+
].each do |d|
|
30
|
+
year, date = d
|
31
|
+
it year do
|
32
|
+
temporale = described_class.new(year)
|
33
|
+
expect(temporale.first_advent_sunday).to eq Date.new(year, *date)
|
58
34
|
end
|
59
35
|
end
|
60
|
-
|
61
|
-
it 'determines second Sunday of Advent' do
|
62
|
-
@t.advent_sunday(2, 2013).should eq Date.new(2013,12,8)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe '#second_advent_sunday' do
|
67
|
-
# alias of advent_sunday through method_missing
|
68
|
-
|
69
|
-
it 'determines second Sunday of Advent' do
|
70
|
-
@t.second_advent_sunday(2013).should eq Date.new(2013,12,8)
|
71
|
-
end
|
72
36
|
end
|
73
37
|
|
74
|
-
describe '#easter_sunday' do
|
75
|
-
|
76
|
-
[
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
38
|
+
describe '#easter_sunday determines Easter Sunday' do
|
39
|
+
[
|
40
|
+
[2003, [2004, 4, 11]],
|
41
|
+
[2004, [2005, 3, 27]],
|
42
|
+
[2005, [2006, 4, 16]],
|
43
|
+
[2006, [2007, 4, 8]],
|
44
|
+
[2014, [2015, 4, 5]]
|
45
|
+
].each do |d|
|
46
|
+
year, date = d
|
47
|
+
it year do
|
48
|
+
temporale = described_class.new(year)
|
49
|
+
expect(temporale.easter_sunday).to eq Date.new(*date)
|
85
50
|
end
|
86
51
|
end
|
87
52
|
end
|
88
53
|
|
89
54
|
describe '#date_range' do
|
90
55
|
it 'includes days of the year' do
|
91
|
-
@t.date_range.
|
92
|
-
@t.date_range.
|
56
|
+
expect(@t.date_range).to include Date.new(2012, 12, 3)
|
57
|
+
expect(@t.date_range).to include Date.new(2013, 11, 5)
|
93
58
|
end
|
94
59
|
end
|
95
60
|
|
96
61
|
describe '#season' do
|
97
62
|
it 'determines Advent' do
|
98
|
-
@t13.season(Date.new(2013, 12,
|
99
|
-
@t13.season(Date.new(2013, 12,
|
100
|
-
@t13.season(Date.new(2013, 12, 24)).should eq :advent
|
63
|
+
expect(@t13.season(Date.new(2013, 12, 1))).to eq CR::Seasons::ADVENT
|
64
|
+
expect(@t13.season(Date.new(2013, 12, 24))).to eq CR::Seasons::ADVENT
|
101
65
|
end
|
102
66
|
|
103
67
|
it 'determines Christmas' do
|
104
|
-
@t13.season(Date.new(2013, 12, 25)).
|
105
|
-
@t13.season(Date.new(2014, 1, 12)).
|
106
|
-
@t13.season(Date.new(2014, 1, 13)).
|
68
|
+
expect(@t13.season(Date.new(2013, 12, 25))).to eq CR::Seasons::CHRISTMAS
|
69
|
+
expect(@t13.season(Date.new(2014, 1, 12))).to eq CR::Seasons::CHRISTMAS
|
70
|
+
expect(@t13.season(Date.new(2014, 1, 13))).to eq CR::Seasons::ORDINARY
|
107
71
|
end
|
108
72
|
|
109
73
|
it 'determines Lent' do
|
110
|
-
@t13.season(Date.new(2014, 3, 4)).
|
111
|
-
@t13.season(Date.new(2014, 3, 5)).
|
112
|
-
@t13.season(Date.new(2014, 4, 19)).
|
113
|
-
@t13.season(Date.new(2014, 4, 20)).
|
74
|
+
expect(@t13.season(Date.new(2014, 3, 4))).to eq CR::Seasons::ORDINARY
|
75
|
+
expect(@t13.season(Date.new(2014, 3, 5))).to eq CR::Seasons::LENT
|
76
|
+
expect(@t13.season(Date.new(2014, 4, 19))).to eq CR::Seasons::LENT
|
77
|
+
expect(@t13.season(Date.new(2014, 4, 20))).to eq CR::Seasons::EASTER
|
114
78
|
end
|
115
79
|
|
116
80
|
it 'determines Easter time' do
|
117
|
-
@t13.season(Date.new(2014, 4, 20)).
|
118
|
-
@t13.season(Date.new(2014, 6, 8)).
|
119
|
-
@t13.season(Date.new(2014, 6, 9)).
|
81
|
+
expect(@t13.season(Date.new(2014, 4, 20))).to eq CR::Seasons::EASTER
|
82
|
+
expect(@t13.season(Date.new(2014, 6, 8))).to eq CR::Seasons::EASTER
|
83
|
+
expect(@t13.season(Date.new(2014, 6, 9))).to eq CR::Seasons::ORDINARY
|
120
84
|
end
|
121
85
|
end
|
122
86
|
|
@@ -206,7 +170,7 @@ describe CR::Temporale do
|
|
206
170
|
it 'Nativity' do
|
207
171
|
c = @t13.get(12, 25)
|
208
172
|
expect(c.rank).to eq CR::Ranks::PRIMARY
|
209
|
-
expect(c.title).to
|
173
|
+
expect(c.title).to have_translation 'The Nativity of the Lord'
|
210
174
|
expect(c.colour).to eq CR::Colours::WHITE
|
211
175
|
end
|
212
176
|
|
@@ -219,7 +183,7 @@ describe CR::Temporale do
|
|
219
183
|
it 'Holy Family' do
|
220
184
|
c = @t13.get(12, 29)
|
221
185
|
expect(c.rank).to eq CR::Ranks::FEAST_LORD_GENERAL
|
222
|
-
expect(c.title).to
|
186
|
+
expect(c.title).to have_translation 'The Holy Family of Jesus, Mary and Joseph'
|
223
187
|
expect(c.colour).to eq CR::Colours::WHITE
|
224
188
|
end
|
225
189
|
|
@@ -227,146 +191,308 @@ describe CR::Temporale do
|
|
227
191
|
it 'is Holy Family on Friday Dec 30' do
|
228
192
|
@t16 = described_class.new 2016
|
229
193
|
c = @t16.get(12, 30)
|
230
|
-
expect(c.title).to
|
194
|
+
expect(c.title).to have_translation 'The Holy Family of Jesus, Mary and Joseph'
|
231
195
|
end
|
232
196
|
end
|
233
197
|
|
234
198
|
it 'Epiphany' do
|
235
199
|
c = @t13.get(1, 6)
|
236
200
|
expect(c.rank).to eq CR::Ranks::PRIMARY
|
237
|
-
expect(c.title).to
|
201
|
+
expect(c.title).to have_translation 'The Epiphany of the Lord'
|
238
202
|
expect(c.colour).to eq CR::Colours::WHITE
|
239
203
|
end
|
240
204
|
|
241
205
|
it 'Baptism of the Lord' do
|
242
206
|
c = @t13.get(1, 12)
|
243
207
|
expect(c.rank).to eq CR::Ranks::FEAST_LORD_GENERAL
|
244
|
-
expect(c.title).to
|
208
|
+
expect(c.title).to have_translation 'The Baptism of the Lord'
|
245
209
|
expect(c.colour).to eq CR::Colours::WHITE
|
246
210
|
end
|
247
211
|
|
248
212
|
it 'Ash Wednesday' do
|
249
213
|
c = @t13.get(3, 5)
|
250
214
|
expect(c.rank).to eq CR::Ranks::PRIMARY
|
251
|
-
expect(c.title).to
|
215
|
+
expect(c.title).to have_translation 'Ash Wednesday'
|
252
216
|
expect(c.colour).to eq CR::Colours::VIOLET
|
253
217
|
end
|
254
218
|
|
255
219
|
it 'Palm Sunday' do
|
256
220
|
c = @t13.get(4, 13)
|
257
221
|
expect(c.rank).to eq CR::Ranks::PRIMARY
|
258
|
-
expect(c.title).to
|
222
|
+
expect(c.title).to have_translation 'Palm Sunday of the Passion of the Lord'
|
259
223
|
expect(c.colour).to eq CR::Colours::RED
|
260
224
|
end
|
261
225
|
|
262
226
|
it 'Good Friday' do
|
263
227
|
c = @t13.get(4, 18)
|
264
228
|
expect(c.rank).to eq CR::Ranks::TRIDUUM
|
265
|
-
expect(c.title).to
|
229
|
+
expect(c.title).to have_translation 'Friday of the Passion of the Lord'
|
266
230
|
expect(c.colour).to eq CR::Colours::RED
|
267
231
|
end
|
268
232
|
|
269
233
|
it 'Holy Saturday' do
|
270
234
|
c = @t13.get(4, 19)
|
271
235
|
expect(c.rank).to eq CR::Ranks::TRIDUUM
|
272
|
-
expect(c.title).to
|
236
|
+
expect(c.title).to have_translation 'Holy Saturday'
|
273
237
|
expect(c.colour).to eq CR::Colours::VIOLET
|
274
238
|
end
|
275
239
|
|
276
240
|
it 'Resurrection' do
|
277
241
|
c = @t13.get(4, 20)
|
278
242
|
expect(c.rank).to eq CR::Ranks::TRIDUUM
|
279
|
-
expect(c.title).to
|
280
|
-
expect(c.colour).to eq CR::Colours::WHITE
|
281
|
-
end
|
282
|
-
|
283
|
-
it 'day in the Easter Octave' do
|
284
|
-
c = @t13.get(4, 22)
|
285
|
-
expect(c.rank).to eq CR::Ranks::PRIMARY
|
243
|
+
expect(c.title).to have_translation 'Easter Sunday of the Resurrection of the Lord'
|
286
244
|
expect(c.colour).to eq CR::Colours::WHITE
|
287
245
|
end
|
288
246
|
|
289
247
|
it 'Ascension' do
|
290
248
|
c = @t13.get(5, 29)
|
291
249
|
expect(c.rank).to eq CR::Ranks::PRIMARY
|
292
|
-
expect(c.title).to
|
250
|
+
expect(c.title).to have_translation 'Ascension of the Lord'
|
293
251
|
expect(c.colour).to eq CR::Colours::WHITE
|
294
252
|
end
|
295
253
|
|
296
254
|
it 'Pentecost' do
|
297
255
|
c = @t13.get(6, 8)
|
298
256
|
expect(c.rank).to eq CR::Ranks::PRIMARY
|
299
|
-
expect(c.title).to
|
257
|
+
expect(c.title).to have_translation 'Pentecost Sunday'
|
300
258
|
expect(c.colour).to eq CR::Colours::RED
|
301
259
|
end
|
302
260
|
|
303
261
|
it 'Trinity' do
|
304
262
|
c = @t13.get(6, 15)
|
305
263
|
expect(c.rank).to eq CR::Ranks::SOLEMNITY_GENERAL
|
306
|
-
expect(c.title).to
|
264
|
+
expect(c.title).to have_translation 'The Most Holy Trinity'
|
307
265
|
expect(c.colour).to eq CR::Colours::WHITE
|
308
266
|
end
|
309
267
|
|
310
268
|
it 'Body of Christ' do
|
311
269
|
c = @t13.get(6, 19)
|
312
270
|
expect(c.rank).to eq CR::Ranks::SOLEMNITY_GENERAL
|
313
|
-
expect(c.title).to
|
271
|
+
expect(c.title).to have_translation 'The Most Holy Body and Blood of Christ'
|
314
272
|
expect(c.colour).to eq CR::Colours::WHITE
|
315
273
|
end
|
316
274
|
|
317
275
|
it 'Sacred Heart' do
|
318
276
|
c = @t13.get(6, 27)
|
319
277
|
expect(c.rank).to eq CR::Ranks::SOLEMNITY_GENERAL
|
320
|
-
expect(c.title).to
|
278
|
+
expect(c.title).to have_translation 'The Most Sacred Heart of Jesus'
|
321
279
|
expect(c.colour).to eq CR::Colours::WHITE
|
322
280
|
end
|
323
281
|
|
324
282
|
it 'Christ the King' do
|
325
283
|
c = @t13.get(11, 23)
|
326
284
|
expect(c.rank).to eq CR::Ranks::SOLEMNITY_GENERAL
|
327
|
-
expect(c.title).to
|
285
|
+
expect(c.title).to have_translation 'Our Lord Jesus Christ, King of the Universe'
|
328
286
|
expect(c.colour).to eq CR::Colours::WHITE
|
329
287
|
end
|
288
|
+
|
289
|
+
describe 'other locales' do
|
290
|
+
it 'Latin' do
|
291
|
+
I18n.with_locale(:la) do
|
292
|
+
c = @t13.get(11, 23)
|
293
|
+
expect(c.title).to eq 'Domini nostri Iesu Christi universorum regis'
|
294
|
+
end
|
295
|
+
end
|
296
|
+
|
297
|
+
it 'Czech' do
|
298
|
+
I18n.with_locale(:cs) do
|
299
|
+
c = @t13.get(11, 23)
|
300
|
+
expect(c.title).to eq 'Ježíše Krista krále'
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
it 'Italian' do
|
305
|
+
I18n.with_locale(:it) do
|
306
|
+
c = @t13.get(11, 23)
|
307
|
+
expect(c.title).to eq "Nostro Signore Gesù Cristo Re dell'universo"
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
330
311
|
end
|
331
|
-
end
|
332
|
-
end
|
333
312
|
|
334
|
-
|
335
|
-
|
336
|
-
|
313
|
+
# movable sanctorale feasts don't really belong in Temporale, but ...
|
314
|
+
describe 'movable sanctorale feasts' do
|
315
|
+
it 'Immaculate Heart' do
|
316
|
+
c = @t13.get(6, 28)
|
317
|
+
expect(c.title).to have_translation 'Immaculate Heart of Mary'
|
318
|
+
expect(c.rank).to eq CR::Ranks::MEMORIAL_GENERAL
|
319
|
+
end
|
320
|
+
end
|
337
321
|
end
|
338
322
|
|
339
|
-
|
340
|
-
|
323
|
+
describe 'titles of Sundays and ferials' do
|
324
|
+
def title_for(month, day)
|
325
|
+
@t13.get(month, day).title
|
326
|
+
end
|
327
|
+
|
328
|
+
describe 'Ordinary time' do
|
329
|
+
it 'Sunday' do
|
330
|
+
expect(title_for(1, 19)).to have_translation '2nd Sunday in Ordinary Time'
|
331
|
+
end
|
332
|
+
|
333
|
+
it 'ferial' do
|
334
|
+
expect(title_for(1, 13)).to have_translation 'Monday, 1st week in Ordinary Time'
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
describe 'Advent' do
|
339
|
+
it 'Sunday' do
|
340
|
+
expect(title_for(12, 1)).to have_translation '1st Sunday of Advent'
|
341
|
+
end
|
342
|
+
|
343
|
+
it 'ferial' do
|
344
|
+
expect(title_for(12, 2)).to have_translation 'Monday, 1st week of Advent'
|
345
|
+
end
|
346
|
+
end
|
347
|
+
|
348
|
+
describe 'Christmas time' do
|
349
|
+
describe 'Octave of Christmas' do
|
350
|
+
it 'ferial' do
|
351
|
+
day = @t13.get(12, 30)
|
352
|
+
expect(day.rank).to eq CR::Ranks::FERIAL_PRIVILEGED
|
353
|
+
expect(day.title).to have_translation '6th day of Christmas Octave'
|
354
|
+
end
|
355
|
+
end
|
356
|
+
|
357
|
+
describe 'after Octave of Christmas' do
|
358
|
+
it 'ferial' do
|
359
|
+
expect(title_for(1, 2)).to have_translation 'Thursday after Christmas Octave'
|
360
|
+
end
|
361
|
+
|
362
|
+
it 'Sunday' do
|
363
|
+
expect(title_for(1, 5)).to have_translation '2nd Sunday after the Nativity of the Lord'
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
367
|
+
describe 'after Epiphany' do
|
368
|
+
it 'ferial' do
|
369
|
+
expect(title_for(1, 7)).to have_translation 'Tuesday after Epiphany'
|
370
|
+
end
|
371
|
+
end
|
372
|
+
end
|
373
|
+
|
374
|
+
describe 'Lent' do
|
375
|
+
describe 'before first Sunday' do
|
376
|
+
it 'ferial' do
|
377
|
+
expect(title_for(3, 6)).to have_translation 'Thursday after Ash Wednesday'
|
378
|
+
end
|
379
|
+
end
|
380
|
+
|
381
|
+
it 'Sunday' do
|
382
|
+
expect(title_for(3, 9)).to have_translation '1st Sunday of Lent'
|
383
|
+
end
|
384
|
+
|
385
|
+
it 'ferial' do
|
386
|
+
expect(title_for(3, 10)).to have_translation 'Monday, 1st week of Lent'
|
387
|
+
end
|
388
|
+
|
389
|
+
describe 'Holy Week' do
|
390
|
+
it 'ferial' do
|
391
|
+
day = @t13.get(4, 14)
|
392
|
+
expect(day.rank).to eq CR::Ranks::PRIMARY
|
393
|
+
expect(day.title).to have_translation 'Monday of Holy Week'
|
394
|
+
end
|
395
|
+
end
|
396
|
+
end
|
397
|
+
|
398
|
+
describe 'Easter' do
|
399
|
+
describe 'Easter Octave' do
|
400
|
+
it 'ferial' do
|
401
|
+
c = @t13.get(4, 22)
|
402
|
+
expect(c.rank).to eq CR::Ranks::PRIMARY
|
403
|
+
expect(c.title).to have_translation 'Easter Tuesday'
|
404
|
+
end
|
405
|
+
|
406
|
+
it 'Sunday (the octave day)' do
|
407
|
+
c = @t13.get(4, 27)
|
408
|
+
expect(c.rank).to eq CR::Ranks::PRIMARY
|
409
|
+
expect(c.title).to have_translation '2nd Sunday of Easter'
|
410
|
+
end
|
411
|
+
end
|
412
|
+
|
413
|
+
it 'Sunday' do
|
414
|
+
expect(title_for(5, 4)).to have_translation '3rd Sunday of Easter'
|
415
|
+
end
|
416
|
+
|
417
|
+
it 'ferial' do
|
418
|
+
expect(title_for(5, 5)).to have_translation 'Monday, 3rd week of Easter'
|
419
|
+
end
|
420
|
+
end
|
421
|
+
|
422
|
+
describe 'other locales' do
|
423
|
+
it 'Latin' do
|
424
|
+
I18n.with_locale(:la) do
|
425
|
+
expect(title_for(5, 5)).to eq 'Feria secunda, hebdomada III temporis paschalis'
|
426
|
+
end
|
427
|
+
end
|
428
|
+
|
429
|
+
it 'Czech' do
|
430
|
+
I18n.with_locale(:cs) do
|
431
|
+
expect(title_for(5, 5)).to eq 'Pondělí po 3. neděli velikonoční'
|
432
|
+
end
|
433
|
+
end
|
434
|
+
|
435
|
+
it 'Italian' do
|
436
|
+
I18n.with_locale(:it) do
|
437
|
+
expect(title_for(5, 5)).to eq 'Lunedì, III di Pasqua'
|
438
|
+
end
|
439
|
+
end
|
440
|
+
end
|
341
441
|
end
|
442
|
+
end
|
342
443
|
|
343
|
-
|
344
|
-
|
444
|
+
describe '.add_celebration' do
|
445
|
+
let(:celebration) { CR::Celebration.new('Monday after Pentecost', CR::Ranks::FEAST_PROPER, CR::Colours::WHITE) }
|
446
|
+
let(:date_proc) { proc { pentecost + 1 } }
|
447
|
+
let(:subclass) { Class.new(described_class) }
|
448
|
+
let(:date) { Date.new(2017, 6, 5) }
|
449
|
+
|
450
|
+
describe 'on Temporale itself' do
|
451
|
+
it 'fails' do
|
452
|
+
expect do
|
453
|
+
described_class.add_celebration date_proc, celebration
|
454
|
+
end.to raise_exception(RuntimeError, /Don't add celebrations to Temporale itself/)
|
455
|
+
end
|
345
456
|
end
|
346
457
|
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
458
|
+
describe 'on a subclass' do
|
459
|
+
describe 'with date method' do
|
460
|
+
it 'adds the celebration' do
|
461
|
+
subclass.instance_eval do
|
462
|
+
define_method :date_method do
|
463
|
+
pentecost + 1
|
464
|
+
end
|
465
|
+
end
|
466
|
+
|
467
|
+
subclass.add_celebration :date_method, celebration
|
352
468
|
|
353
|
-
|
354
|
-
|
355
|
-
|
469
|
+
instance = subclass.new 2016
|
470
|
+
expect(instance.get(date)).to eq celebration
|
471
|
+
end
|
472
|
+
end
|
473
|
+
|
474
|
+
describe 'with date Proc' do
|
475
|
+
it 'adds the celebration' do
|
476
|
+
subclass.add_celebration date_proc, celebration
|
477
|
+
|
478
|
+
instance = subclass.new 2016
|
479
|
+
expect(instance.get(date)).to eq celebration
|
480
|
+
end
|
356
481
|
end
|
357
482
|
end
|
483
|
+
end
|
358
484
|
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
expect
|
485
|
+
describe 'packaged extensions' do
|
486
|
+
describe 'ChristEternalPriest' do
|
487
|
+
let(:klass) { described_class.with_extensions(CR::Temporale::Extensions::ChristEternalPriest) }
|
488
|
+
let(:t) { klass.new(2016) }
|
489
|
+
|
490
|
+
it 'adds the feast' do
|
491
|
+
I18n.with_locale(:cs) do
|
492
|
+
c = t.get(6, 8)
|
493
|
+
expect(c.title).to eq 'Ježíše Krista, nejvyššího a věčného kněze'
|
494
|
+
expect(c.rank).to eq CR::Ranks::FEAST_PROPER
|
495
|
+
expect(c.colour).to eq CR::Colours::WHITE
|
370
496
|
end
|
371
497
|
end
|
372
498
|
end
|