calendarium-romanum 0.3.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +4 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +47 -0
  5. data/.travis.yml +20 -0
  6. data/.yardopts +3 -0
  7. data/CHANGELOG.md +340 -0
  8. data/Gemfile +25 -0
  9. data/Gemfile.lock +86 -0
  10. data/README.md +515 -0
  11. data/Rakefile +9 -0
  12. data/bin/calendariumrom +4 -1
  13. data/calendarium-romanum.gemspec +26 -0
  14. data/config/locales/cs.yml +17 -1
  15. data/config/locales/en.yml +28 -14
  16. data/config/locales/es.yml +90 -0
  17. data/config/locales/fr.yml +90 -0
  18. data/config/locales/it.yml +18 -2
  19. data/config/locales/la.yml +17 -1
  20. data/data/README.md +43 -1
  21. data/data/czech-brno-cs.txt +4 -6
  22. data/data/czech-budejovice-cs.txt +4 -6
  23. data/data/czech-cechy-cs.txt +4 -5
  24. data/data/czech-cs.txt +237 -234
  25. data/data/czech-hradec-cs.txt +3 -5
  26. data/data/czech-litomerice-cs.txt +5 -7
  27. data/data/czech-morava-cs.txt +4 -5
  28. data/data/czech-olomouc-cs.txt +2 -4
  29. data/data/czech-ostrava-cs.txt +3 -5
  30. data/data/czech-plzen-cs.txt +3 -5
  31. data/data/czech-praha-cs.txt +3 -4
  32. data/data/universal-en.txt +214 -211
  33. data/data/universal-es.txt +243 -0
  34. data/data/universal-fr.txt +243 -0
  35. data/data/universal-it.txt +214 -211
  36. data/data/universal-la.txt +214 -210
  37. data/doc/data_readme.md +2 -0
  38. data/doc/images/class_diagram.png +0 -0
  39. data/doc/images/class_diagram.puml +44 -0
  40. data/doc/yard_readme.rdoc +76 -0
  41. data/lib/calendarium-romanum.rb +30 -21
  42. data/lib/calendarium-romanum/abstract_date.rb +12 -0
  43. data/lib/calendarium-romanum/calendar.rb +207 -52
  44. data/lib/calendarium-romanum/cli.rb +101 -52
  45. data/lib/calendarium-romanum/cr.rb +16 -0
  46. data/lib/calendarium-romanum/data.rb +46 -18
  47. data/lib/calendarium-romanum/day.rb +202 -20
  48. data/lib/calendarium-romanum/enum.rb +24 -5
  49. data/lib/calendarium-romanum/enums.rb +102 -36
  50. data/lib/calendarium-romanum/errors.rb +4 -0
  51. data/lib/calendarium-romanum/ordinalizer.rb +30 -6
  52. data/lib/calendarium-romanum/perpetual_calendar.rb +97 -0
  53. data/lib/calendarium-romanum/rank.rb +43 -6
  54. data/lib/calendarium-romanum/sanctorale.rb +170 -24
  55. data/lib/calendarium-romanum/sanctorale_factory.rb +74 -3
  56. data/lib/calendarium-romanum/sanctorale_loader.rb +176 -0
  57. data/lib/calendarium-romanum/temporale.rb +251 -119
  58. data/lib/calendarium-romanum/temporale/celebration_factory.rb +106 -0
  59. data/lib/calendarium-romanum/temporale/dates.rb +117 -36
  60. data/lib/calendarium-romanum/temporale/extensions/christ_eternal_priest.rb +18 -6
  61. data/lib/calendarium-romanum/transfers.rb +20 -1
  62. data/lib/calendarium-romanum/util.rb +36 -3
  63. data/lib/calendarium-romanum/version.rb +5 -1
  64. metadata +29 -21
  65. data/lib/calendarium-romanum/sanctoraleloader.rb +0 -115
  66. data/spec/abstract_date_spec.rb +0 -62
  67. data/spec/calendar_spec.rb +0 -352
  68. data/spec/cli_spec.rb +0 -26
  69. data/spec/data_spec.rb +0 -23
  70. data/spec/date_spec.rb +0 -61
  71. data/spec/dates_spec.rb +0 -45
  72. data/spec/enum_spec.rb +0 -51
  73. data/spec/i18n_spec.rb +0 -59
  74. data/spec/rank_spec.rb +0 -42
  75. data/spec/readme_spec.rb +0 -52
  76. data/spec/sanctorale_factory_spec.rb +0 -42
  77. data/spec/sanctorale_spec.rb +0 -167
  78. data/spec/sanctoraleloader_spec.rb +0 -171
  79. data/spec/spec_helper.rb +0 -35
  80. data/spec/temporale_spec.rb +0 -500
@@ -1,171 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe CR::SanctoraleLoader do
4
-
5
- before :each do
6
- @s = CR::Sanctorale.new
7
- @l = CR::SanctoraleLoader.new
8
- end
9
-
10
- describe 'data sources' do
11
- describe '#load_from_string' do
12
- before :each do
13
- str = '1/3 : Ss.mi Nominis Iesu'
14
- @l.load_from_string str, @s
15
- end
16
-
17
- it 'loads one entry' do
18
- expect(@s.size).to eq 1
19
- end
20
-
21
- it 'loads date correctly' do
22
- expect(@s.get(1, 3).size).to eq 1
23
- end
24
-
25
- it 'loads title correctly' do
26
- expect(@s.get(1, 3)[0].title).to eq 'Ss.mi Nominis Iesu'
27
- end
28
-
29
- it 'sets default rank' do
30
- expect(@s.get(1, 3)[0].rank).to eq CR::Ranks::MEMORIAL_OPTIONAL
31
- end
32
-
33
- it 'sets default colour - white' do
34
- expect(@s.get(1, 3)[0].colour).to eq CR::Colours::WHITE
35
- end
36
-
37
- it 'loads explicit rank if given' do
38
- str = '1/25 f : In conversione S. Pauli, apostoli'
39
- @l.load_from_string str, @s
40
- expect(@s.get(1, 25)[0].rank).to eq CR::Ranks::FEAST_GENERAL
41
- end
42
- end
43
-
44
- describe '#load_from_file' do
45
- it 'loads something from file' do
46
- @l.load_from_file(File.join(%w{data universal-la.txt}), @s)
47
- expect(@s.size).to be > 190
48
- end
49
- end
50
- end
51
-
52
- describe 'record/file format' do
53
- describe 'month as heading' do
54
- it 'loads a month heading and uses the month for subsequent records' do
55
- str = ['= 1', '25 f : In conversione S. Pauli, apostoli'].join "\n"
56
- @l.load_from_string str, @s
57
- expect(@s).not_to be_empty
58
- expect(@s.get(1, 25)).not_to be_empty
59
- end
60
- end
61
-
62
- describe 'colour' do
63
- it 'sets colour if specified' do
64
- str = '4/25 f R : S. Marci, evangelistae'
65
- @l.load_from_string str, @s
66
- expect(@s.get(4, 25).first.colour).to eq CR::Colours::RED
67
- end
68
-
69
- it 'sets colour if specified (lowercase)' do
70
- str = '4/25 f r : S. Marci, evangelistae'
71
- @l.load_from_string str, @s
72
- expect(@s.get(4, 25).first.colour).to eq CR::Colours::RED
73
- end
74
- end
75
-
76
- describe 'rank' do
77
- # say we specify a proper calendar of a church dedicated to St. George
78
-
79
- it 'sets rank if specified' do
80
-
81
- str = '4/23 s R : S. Georgii, martyris'
82
- @l.load_from_string str, @s
83
- celeb = @s.get(4, 23).first
84
- expect(celeb.rank).to eq CR::Ranks::SOLEMNITY_GENERAL
85
- end
86
-
87
- it 'sets rank if specified (uppercase)' do
88
- str = '4/23 S R : S. Georgii, martyris'
89
- @l.load_from_string str, @s
90
- celeb = @s.get(4, 23).first
91
- expect(celeb.rank).to eq CR::Ranks::SOLEMNITY_GENERAL
92
- end
93
-
94
- it 'sets exact rank if specified' do
95
- str = '4/23 s1.4 R : S. Georgii, martyris'
96
- @l.load_from_string str, @s
97
- celeb = @s.get(4, 23).first
98
- expect(celeb.rank).to eq CR::Ranks::SOLEMNITY_PROPER
99
- end
100
-
101
- it 'sets exact rank if specified only by number' do
102
- str = '4/23 1.4 R : S. Georgii, martyris'
103
- @l.load_from_string str, @s
104
- celeb = @s.get(4, 23).first
105
- expect(celeb.rank).to eq CR::Ranks::SOLEMNITY_PROPER
106
- end
107
- end
108
- end
109
-
110
- describe 'invalid input' do
111
- describe 'syntax errors' do
112
- it 'invalid syntax' do
113
- str = 'line without standard beginning'
114
- expect do
115
- @l.load_from_string str, @s
116
- end.to raise_exception /Syntax error/
117
- end
118
- end
119
-
120
- describe 'syntactically correct data making no sense' do
121
- it 'invalid month' do
122
- str = '100/25 f : In conversione S. Pauli, apostoli'
123
- expect do
124
- @l.load_from_string str, @s
125
- end.to raise_exception /Invalid month/
126
- end
127
-
128
- it 'line with day only, without preceding month heading' do
129
- str = '25 f : In conversione S. Pauli, apostoli'
130
- expect do
131
- @l.load_from_string str, @s
132
- end.to raise_exception /Invalid month/
133
- end
134
-
135
- it 'invalid day' do
136
- str = '1/250 f : In conversione S. Pauli, apostoli'
137
- expect do
138
- @l.load_from_string str, @s
139
- end.to raise_exception /Invalid day/
140
- end
141
-
142
- it 'invalid month heading' do
143
- str = '= 0'
144
- expect do
145
- @l.load_from_string str, @s
146
- end.to raise_exception /Invalid month/
147
- end
148
-
149
- it 'invalid rank' do
150
- str = '1/25 X : In conversione S. Pauli, apostoli'
151
- expect do
152
- @l.load_from_string str, @s
153
- end.to raise_exception /Syntax error/
154
- end
155
-
156
- it 'invalid numeric rank' do
157
- str = '4/23 s8.4 R : S. Georgii, martyris'
158
- expect do
159
- @l.load_from_string str, @s
160
- end.to raise_exception /rank/
161
- end
162
-
163
- it 'invalid combination of rank latter and number' do
164
- str = '4/23 m2.5 R : S. Georgii, martyris'
165
- expect do
166
- @l.load_from_string str, @s
167
- end.to raise_exception /rank/
168
- end
169
- end
170
- end
171
- end
@@ -1,35 +0,0 @@
1
- # This file was generated by the `rspec --init` command. Conventionally, all
2
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
- # Require this file using `require "spec_helper"` to ensure that it is only
4
- # loaded once.
5
- #
6
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
- RSpec.configure do |config|
8
- config.run_all_when_everything_filtered = true
9
- config.filter_run :focus
10
-
11
- # Run specs in random order to surface order dependencies. If you find an
12
- # order dependency and want to debug it, you can fix the order by providing
13
- # the seed, which is printed after each run.
14
- # --seed 1234
15
- config.order = 'random'
16
- end
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
-
31
- require 'calendarium-romanum'
32
- CR = CalendariumRomanum
33
-
34
- I18n.enforce_available_locales = true
35
- I18n.locale = ENV['LOCALE'] || :en
@@ -1,500 +0,0 @@
1
- # coding: utf-8
2
- require_relative 'spec_helper'
3
-
4
- describe CR::Temporale do
5
-
6
- before :all do
7
- @t = @t12 = described_class.new 2012
8
- @t13 = described_class.new 2013
9
- end
10
-
11
- describe '.liturgical_year' do
12
- it 'returns liturgical year for the given date' do
13
- [
14
- [Date.new(2014, 11, 1), 2013],
15
- [Date.new(2014, 12, 1), 2014]
16
- ].each do |date, year|
17
- expect(described_class.liturgical_year(date)).to eq year
18
- end
19
- end
20
- end
21
-
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)
34
- end
35
- end
36
- end
37
-
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)
50
- end
51
- end
52
- end
53
-
54
- describe '#date_range' do
55
- it 'includes days of the year' do
56
- expect(@t.date_range).to include Date.new(2012, 12, 3)
57
- expect(@t.date_range).to include Date.new(2013, 11, 5)
58
- end
59
- end
60
-
61
- describe '#season' do
62
- it 'determines Advent' do
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
65
- end
66
-
67
- it 'determines Christmas' do
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
71
- end
72
-
73
- it 'determines Lent' do
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
78
- end
79
-
80
- it 'determines Easter time' do
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
84
- end
85
- end
86
-
87
- describe '#get' do
88
- it 'returns a Celebration' do
89
- expect(@t13.get(8, 12)).to be_a CR::Celebration
90
- end
91
-
92
- describe 'for' do
93
- describe 'ferial' do
94
- it 'in Ordinary Time' do
95
- c = @t13.get(8, 12)
96
- expect(c.rank).to eq CR::Ranks::FERIAL
97
- expect(c.color).to eq CR::Colours::GREEN
98
- end
99
-
100
- it 'in Advent' do
101
- c = @t13.get(12, 12)
102
- expect(c.rank).to eq CR::Ranks::FERIAL
103
- expect(c.color).to eq CR::Colours::VIOLET
104
- end
105
-
106
- it 'in the last week of Advent' do
107
- c = @t13.get(12, 23)
108
- expect(c.rank).to eq CR::Ranks::FERIAL_PRIVILEGED
109
- expect(c.color).to eq CR::Colours::VIOLET
110
- end
111
-
112
- it 'in Christmas time' do
113
- c = @t13.get(1, 3)
114
- expect(c.rank).to eq CR::Ranks::FERIAL
115
- expect(c.color).to eq CR::Colours::WHITE
116
- end
117
-
118
- it 'in Lent' do
119
- c = @t13.get(3, 18)
120
- expect(c.rank).to eq CR::Ranks::FERIAL_PRIVILEGED
121
- expect(c.color).to eq CR::Colours::VIOLET
122
- end
123
-
124
- it 'in Easter Time' do
125
- c = @t13.get(5, 5)
126
- expect(c.rank).to eq CR::Ranks::FERIAL
127
- expect(c.color).to eq CR::Colours::WHITE
128
- end
129
- end
130
-
131
- describe 'Sunday' do
132
- it 'in Ordinary Time' do
133
- c = @t13.get(8, 10)
134
- expect(c.rank).to eq CR::Ranks::SUNDAY_UNPRIVILEGED
135
- expect(c.color).to eq CR::Colours::GREEN
136
- end
137
-
138
- it 'in Advent' do
139
- c = @t13.get(12, 15)
140
- expect(c.rank).to eq CR::Ranks::PRIMARY
141
- expect(c.color).to eq CR::Colours::VIOLET
142
- end
143
-
144
- it 'in Christmas time' do
145
- c = @t13.get(1, 5)
146
- expect(c.rank).to eq CR::Ranks::SUNDAY_UNPRIVILEGED
147
- expect(c.color).to eq CR::Colours::WHITE
148
- end
149
-
150
- it 'in Lent' do
151
- c = @t13.get(3, 23)
152
- expect(c.rank).to eq CR::Ranks::PRIMARY
153
- expect(c.color).to eq CR::Colours::VIOLET
154
- end
155
-
156
- it 'in Easter Time' do
157
- c = @t13.get(5, 11)
158
- expect(c.rank).to eq CR::Ranks::PRIMARY
159
- expect(c.color).to eq CR::Colours::WHITE
160
- end
161
- end
162
-
163
- describe 'solemnities and their cycles - ' do
164
- it 'end of Advent time' do
165
- c = @t13.get(12, 17)
166
- expect(c.rank).to eq CR::Ranks::FERIAL_PRIVILEGED
167
- expect(c.colour).to eq CR::Colours::VIOLET
168
- end
169
-
170
- it 'Nativity' do
171
- c = @t13.get(12, 25)
172
- expect(c.rank).to eq CR::Ranks::PRIMARY
173
- expect(c.title).to have_translation 'The Nativity of the Lord'
174
- expect(c.colour).to eq CR::Colours::WHITE
175
- end
176
-
177
- it 'day in the octave of Nativity' do
178
- c = @t13.get(12, 27)
179
- expect(c.rank).to eq CR::Ranks::FERIAL_PRIVILEGED
180
- expect(c.colour).to eq CR::Colours::WHITE
181
- end
182
-
183
- it 'Holy Family' do
184
- c = @t13.get(12, 29)
185
- expect(c.rank).to eq CR::Ranks::FEAST_LORD_GENERAL
186
- expect(c.title).to have_translation 'The Holy Family of Jesus, Mary and Joseph'
187
- expect(c.colour).to eq CR::Colours::WHITE
188
- end
189
-
190
- context 'when a Sunday does not occur between Dec 25 and Jan 1' do
191
- it 'is Holy Family on Friday Dec 30' do
192
- @t16 = described_class.new 2016
193
- c = @t16.get(12, 30)
194
- expect(c.title).to have_translation 'The Holy Family of Jesus, Mary and Joseph'
195
- end
196
- end
197
-
198
- it 'Epiphany' do
199
- c = @t13.get(1, 6)
200
- expect(c.rank).to eq CR::Ranks::PRIMARY
201
- expect(c.title).to have_translation 'The Epiphany of the Lord'
202
- expect(c.colour).to eq CR::Colours::WHITE
203
- end
204
-
205
- it 'Baptism of the Lord' do
206
- c = @t13.get(1, 12)
207
- expect(c.rank).to eq CR::Ranks::FEAST_LORD_GENERAL
208
- expect(c.title).to have_translation 'The Baptism of the Lord'
209
- expect(c.colour).to eq CR::Colours::WHITE
210
- end
211
-
212
- it 'Ash Wednesday' do
213
- c = @t13.get(3, 5)
214
- expect(c.rank).to eq CR::Ranks::PRIMARY
215
- expect(c.title).to have_translation 'Ash Wednesday'
216
- expect(c.colour).to eq CR::Colours::VIOLET
217
- end
218
-
219
- it 'Palm Sunday' do
220
- c = @t13.get(4, 13)
221
- expect(c.rank).to eq CR::Ranks::PRIMARY
222
- expect(c.title).to have_translation 'Palm Sunday of the Passion of the Lord'
223
- expect(c.colour).to eq CR::Colours::RED
224
- end
225
-
226
- it 'Good Friday' do
227
- c = @t13.get(4, 18)
228
- expect(c.rank).to eq CR::Ranks::TRIDUUM
229
- expect(c.title).to have_translation 'Friday of the Passion of the Lord'
230
- expect(c.colour).to eq CR::Colours::RED
231
- end
232
-
233
- it 'Holy Saturday' do
234
- c = @t13.get(4, 19)
235
- expect(c.rank).to eq CR::Ranks::TRIDUUM
236
- expect(c.title).to have_translation 'Holy Saturday'
237
- expect(c.colour).to eq CR::Colours::VIOLET
238
- end
239
-
240
- it 'Resurrection' do
241
- c = @t13.get(4, 20)
242
- expect(c.rank).to eq CR::Ranks::TRIDUUM
243
- expect(c.title).to have_translation 'Easter Sunday of the Resurrection of the Lord'
244
- expect(c.colour).to eq CR::Colours::WHITE
245
- end
246
-
247
- it 'Ascension' do
248
- c = @t13.get(5, 29)
249
- expect(c.rank).to eq CR::Ranks::PRIMARY
250
- expect(c.title).to have_translation 'Ascension of the Lord'
251
- expect(c.colour).to eq CR::Colours::WHITE
252
- end
253
-
254
- it 'Pentecost' do
255
- c = @t13.get(6, 8)
256
- expect(c.rank).to eq CR::Ranks::PRIMARY
257
- expect(c.title).to have_translation 'Pentecost Sunday'
258
- expect(c.colour).to eq CR::Colours::RED
259
- end
260
-
261
- it 'Trinity' do
262
- c = @t13.get(6, 15)
263
- expect(c.rank).to eq CR::Ranks::SOLEMNITY_GENERAL
264
- expect(c.title).to have_translation 'The Most Holy Trinity'
265
- expect(c.colour).to eq CR::Colours::WHITE
266
- end
267
-
268
- it 'Body of Christ' do
269
- c = @t13.get(6, 19)
270
- expect(c.rank).to eq CR::Ranks::SOLEMNITY_GENERAL
271
- expect(c.title).to have_translation 'The Most Holy Body and Blood of Christ'
272
- expect(c.colour).to eq CR::Colours::WHITE
273
- end
274
-
275
- it 'Sacred Heart' do
276
- c = @t13.get(6, 27)
277
- expect(c.rank).to eq CR::Ranks::SOLEMNITY_GENERAL
278
- expect(c.title).to have_translation 'The Most Sacred Heart of Jesus'
279
- expect(c.colour).to eq CR::Colours::WHITE
280
- end
281
-
282
- it 'Christ the King' do
283
- c = @t13.get(11, 23)
284
- expect(c.rank).to eq CR::Ranks::SOLEMNITY_GENERAL
285
- expect(c.title).to have_translation 'Our Lord Jesus Christ, King of the Universe'
286
- expect(c.colour).to eq CR::Colours::WHITE
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
311
- end
312
-
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
321
- end
322
-
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
441
- end
442
- end
443
-
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
456
- end
457
-
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
468
-
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
481
- end
482
- end
483
- end
484
-
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
496
- end
497
- end
498
- end
499
- end
500
- end