calendarium-romanum 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  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/calendarium-romanum.gemspec +26 -0
  13. data/doc/data_readme.md +2 -0
  14. data/doc/images/class_diagram.png +0 -0
  15. data/doc/images/class_diagram.puml +44 -0
  16. data/doc/yard_readme.rdoc +76 -0
  17. data/lib/calendarium-romanum/sanctorale.rb +29 -3
  18. data/lib/calendarium-romanum/sanctorale_factory.rb +2 -2
  19. data/lib/calendarium-romanum/sanctorale_loader.rb +3 -3
  20. data/lib/calendarium-romanum/version.rb +2 -2
  21. metadata +17 -26
  22. data/spec/abstract_date_spec.rb +0 -70
  23. data/spec/calendar_spec.rb +0 -756
  24. data/spec/celebration_factory_spec.rb +0 -40
  25. data/spec/celebration_spec.rb +0 -67
  26. data/spec/cli_spec.rb +0 -169
  27. data/spec/colour_spec.rb +0 -22
  28. data/spec/data_spec.rb +0 -46
  29. data/spec/date_parser_spec.rb +0 -68
  30. data/spec/date_spec.rb +0 -61
  31. data/spec/dates_spec.rb +0 -73
  32. data/spec/day_spec.rb +0 -151
  33. data/spec/enum_spec.rb +0 -51
  34. data/spec/i18n_spec.rb +0 -68
  35. data/spec/ordinalizer_spec.rb +0 -44
  36. data/spec/perpetual_calendar_spec.rb +0 -125
  37. data/spec/rank_spec.rb +0 -77
  38. data/spec/readme_spec.rb +0 -58
  39. data/spec/sanctorale_factory_spec.rb +0 -146
  40. data/spec/sanctorale_loader_spec.rb +0 -229
  41. data/spec/sanctorale_spec.rb +0 -281
  42. data/spec/season_spec.rb +0 -22
  43. data/spec/spec_helper.rb +0 -46
  44. data/spec/temporale_spec.rb +0 -693
  45. data/spec/year_spec.rb +0 -25
@@ -1,281 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe CR::Sanctorale do
4
- let(:s) { described_class.new }
5
-
6
- # example celebrations
7
- let(:antonius) { CR::Celebration.new('S. Antonii, abbatis', CR::Ranks::MEMORIAL_GENERAL, CR::Colours::WHITE, :antonius) }
8
- let(:nullus) { CR::Celebration.new('S. Nullius', CR::Ranks::MEMORIAL_OPTIONAL, CR::Colours::WHITE, :nullus) }
9
- let(:ignotus) { CR::Celebration.new('S. Ignoti', CR::Ranks::MEMORIAL_OPTIONAL, CR::Colours::WHITE, :ignotus) }
10
- let(:opt_memorial) { nullus }
11
- let(:opt_memorial_2) { ignotus }
12
- let(:solemnity) { CR::Celebration.new('S. Nullius', CR::Ranks::SOLEMNITY_PROPER, CR::Colours::WHITE, :nullus_solemnity) }
13
-
14
- describe '#get' do
15
- describe 'for an empty day' do
16
- it 'returns an Array' do
17
- expect(s.get(1, 3)).to be_an Array
18
- end
19
- end
20
-
21
- describe 'for an unempty day' do
22
- before :each do
23
- s.add 1, 17, antonius
24
- end
25
-
26
- it 'get by month, day' do
27
- expect(s.get(1, 17)).to eq [antonius]
28
- end
29
-
30
- it 'get by Date' do
31
- expect(s.get(Date.new(2014, 1, 17))).to eq [antonius]
32
- end
33
-
34
- it 'may have more CR::Celebrations for a day' do
35
- [
36
- 'S. Fabiani, papae et martyris',
37
- 'S. Sebastiani, martyris'
38
- ].each {|t| s.add 1, 20, CR::Celebration.new(t, CR::Ranks::MEMORIAL_OPTIONAL) }
39
- expect(s.get(1, 20).size).to eq 2
40
- end
41
- end
42
- end
43
-
44
- describe '#add' do
45
- it 'adds a CR::Celebration to one month only' do
46
- s.add 1, 17, antonius
47
- expect(s.get(2, 17)).to be_empty
48
- end
49
-
50
- it 'does not allow month 0' do
51
- expect { s.add 0, 1, opt_memorial }.to raise_exception RangeError
52
- end
53
-
54
- it 'does not allow month higher than 12' do
55
- expect { s.add 13, 1, opt_memorial }.to raise_exception RangeError
56
- end
57
-
58
- it 'adds solemnity to a dedicated container' do
59
- expect { s.add 1, 13, solemnity }.to change { s.solemnities.size }.by 1
60
- end
61
-
62
- it 'does not add non-solemnity to solemnities' do
63
- expect { s.add 1, 13, opt_memorial }.not_to change { s.solemnities.size }
64
- end
65
-
66
- it 'fails when adding second celebration with the same symbol' do
67
- s.add 1, 13, antonius
68
-
69
- expect do
70
- s.add 1, 14, antonius
71
- end.to raise_exception ArgumentError, /duplicate symbol :antonius/
72
- end
73
-
74
- describe 'multiple celebrations on a single day' do
75
- it 'succeeds for any number of optional memorials' do
76
- s.add 1, 13, opt_memorial
77
-
78
- expect do
79
- s.add 1, 13, opt_memorial_2
80
- end.not_to raise_exception
81
- end
82
-
83
- it 'fails when adding a non-optional memorial' do
84
- s.add 1, 13, opt_memorial
85
-
86
- expect do
87
- s.add 1, 13, CR::Celebration.new('S. Ignoti', CR::Ranks::MEMORIAL_GENERAL)
88
- end.to raise_exception ArgumentError
89
- end
90
-
91
- it 'fails when adding to a non-optional memorial' do
92
- s.add 1, 13, CR::Celebration.new('S. Nullius', CR::Ranks::MEMORIAL_GENERAL)
93
-
94
- expect do
95
- s.add 1, 13, opt_memorial_2
96
- end.to raise_exception ArgumentError
97
- end
98
-
99
- # there used to be a bug, registering a solemnity *before*
100
- # checking if it can be added at all
101
- it 'does not modify internal state when it fails' do
102
- s.add 1, 13, opt_memorial
103
-
104
- expect do
105
- begin
106
- s.add 1, 13, CR::Celebration.new('S. Nullius', CR::Ranks::SOLEMNITY_GENERAL)
107
- rescue ArgumentError
108
- end
109
- end.not_to change { s.solemnities.size }
110
- end
111
- end
112
- end
113
-
114
- describe '#replace' do
115
- it 'replaces the original celebration(s)' do
116
- s.add 1, 13, opt_memorial_2
117
- s.replace 1, 13, [solemnity]
118
-
119
- expect(s.get(1, 13)).to eq [solemnity]
120
- end
121
-
122
- it 'adds solemnity to a dedicated container' do
123
- expect do
124
- s.replace 1, 13, [solemnity]
125
- end.to change { s.solemnities.size }.by 1
126
- end
127
-
128
- it 'removes solemnity' do
129
- s.add 1, 13, solemnity
130
- expect do
131
- s.replace 1, 13, [opt_memorial_2]
132
- end.to change { s.solemnities.size }.by(-1)
133
- end
134
-
135
- it 'does not simply save the passed Array' do
136
- array = [opt_memorial]
137
- s.replace 1, 13, array
138
-
139
- array << nil
140
-
141
- expect(s.get(1, 13)).not_to include nil
142
- end
143
-
144
- describe 'duplicate symbol handling' do
145
- it 'fails when adding second celebration with the same symbol' do
146
- s.replace 1, 13, [nullus]
147
-
148
- expect do
149
- s.replace 1, 14, [nullus]
150
- end.to raise_exception ArgumentError, /duplicate symbols \[:nullus\]/
151
- end
152
-
153
- it 'failed attempts do not modify state of the internal symbol set' do
154
- s.replace 1, 14, [nullus]
155
- s.replace 1, 15, [ignotus]
156
-
157
- expect do
158
- s.replace 1, 14, [ignotus]
159
- end.to raise_exception ArgumentError, /duplicate symbols \[:ignotus\]/
160
-
161
- expect do
162
- s.replace 1, 15, [nullus]
163
- end.to raise_exception ArgumentError, /duplicate symbols \[:nullus\]/
164
- end
165
-
166
- it 'succeeds when celebration with the same symbol is being replaced' do
167
- s.replace 1, 13, [nullus]
168
-
169
- expect do
170
- s.replace 1, 13, [nullus]
171
- end.not_to raise_exception
172
- end
173
- end
174
- end
175
-
176
- describe '#update' do
177
- let(:s2) { described_class.new }
178
-
179
- it 'adds entries from the argument to receiver' do
180
- s2.add 1, 17, antonius
181
-
182
- expect(s).to be_empty
183
- s.update s2
184
- expect(s.size).to eq 1
185
- end
186
-
187
- it 'overwrites eventual previous content of the day' do
188
- s.add 1, 17, antonius
189
- s2.add 1, 17, opt_memorial
190
-
191
- s.update s2
192
- expect(s.get(1, 17)).to eq [opt_memorial]
193
- end
194
-
195
- it 'does not overwrite content of days for which it does not have any' do
196
- s.add 1, 17, antonius
197
-
198
- s.update s2
199
- expect(s.get(1, 17)).to eq [antonius]
200
- end
201
- end
202
-
203
- describe '#size' do
204
- it 'knows when the Sanctorale is empty' do
205
- expect(s.size).to eq 0
206
- end
207
-
208
- it 'knows when there is something' do
209
- s.add 1, 17, antonius
210
- expect(s.size).to eq 1
211
- end
212
- end
213
-
214
- describe '#empty?' do
215
- it 'is empty at the beginning' do
216
- expect(s).to be_empty
217
- end
218
-
219
- it 'is never more empty once a record is entered' do
220
- s.add 1, 17, antonius
221
- expect(s).not_to be_empty
222
- end
223
- end
224
-
225
- describe '#each_day' do
226
- before :each do
227
- s.add 1, 17, antonius
228
- end
229
-
230
- it 'yields each date and corresponding CR::Celebrations' do
231
- expect {|block| s.each_day(&block) }.to yield_with_args(CR::AbstractDate.new(1, 17), [antonius])
232
- end
233
-
234
- it 'can be called without a block' do
235
- expect(s.each_day).to be_an Enumerator
236
- end
237
- end
238
-
239
- describe '#freeze' do
240
- it 'makes the instance frozen' do
241
- expect(s).not_to be_frozen # make sure
242
- s.freeze
243
- expect(s).to be_frozen
244
- end
245
-
246
- it 'prevents modification' do
247
- s.freeze
248
-
249
- expect do
250
- s.add 1, 17, antonius
251
- end.to raise_exception(RuntimeError, /can't modify frozen/)
252
- end
253
- end
254
-
255
- describe '#==' do
256
- describe 'empty' do
257
- it 'is equal' do
258
- expect(described_class.new).to be == described_class.new
259
- end
260
- end
261
-
262
- describe 'with content' do
263
- let(:a) do
264
- s = described_class.new
265
- s.add 1, 17, antonius
266
- s
267
- end
268
-
269
- it 'different' do
270
- expect(a).not_to be == described_class.new
271
- end
272
-
273
- it 'same' do
274
- b = described_class.new
275
- b.add 1, 17, antonius
276
-
277
- expect(a).to be == b
278
- end
279
- end
280
- end
281
- end
@@ -1,22 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe CR::Season do
4
- CR::Seasons.each do |season|
5
- describe season do
6
- describe '#name' do
7
- it { expect(season.name).to have_translation }
8
- end
9
- end
10
- end
11
-
12
- describe 'indexing' do
13
- it 'is indexed by symbol' do
14
- expect(CR::Seasons[:lent]).to be CR::Seasons::LENT
15
- end
16
- end
17
-
18
- describe '#to_s' do
19
- it { expect(CR::Seasons::LENT.to_s)
20
- .to eq '#<CalendariumRomanum::Season lent>' }
21
- end
22
- end
@@ -1,46 +0,0 @@
1
- require 'simplecov'
2
- SimpleCov.start do
3
- add_filter 'lib/calendarium-romanum/cli.rb'
4
- end
5
-
6
- require 'aruba/rspec'
7
-
8
- # This file was generated by the `rspec --init` command. Conventionally, all
9
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
10
- # Require this file using `require "spec_helper"` to ensure that it is only
11
- # loaded once.
12
- #
13
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
14
- RSpec.configure do |config|
15
- config.run_all_when_everything_filtered = true
16
- config.filter_run :focus
17
-
18
- # Run specs in random order to surface order dependencies. If you find an
19
- # order dependency and want to debug it, you can fix the order by providing
20
- # the seed, which is printed after each run.
21
- # --seed 1234
22
- config.order = 'random'
23
- end
24
-
25
- RSpec::Matchers.define :have_translation do |expected, locale|
26
- match do |actual|
27
- locale ||= :en
28
- if expected && I18n.locale == locale
29
- actual == expected
30
- else
31
- # with locale different from the one the spec is written for
32
- # just test that the string isn't left untranslated
33
- !(actual.nil? || actual.empty? || actual.include?('translation missing'))
34
- end
35
- end
36
- end
37
-
38
- require 'calendarium-romanum'
39
- CR = CalendariumRomanum
40
-
41
- I18n.enforce_available_locales = true
42
- I18n.locale = ENV['LOCALE'] || :en
43
-
44
- # make the gem's executable(s) easily available for aruba
45
- gem_bin = File.expand_path('../../bin', __FILE__)
46
- ENV['PATH'] = "#{gem_bin}:#{ENV['PATH']}"
@@ -1,693 +0,0 @@
1
- # coding: utf-8
2
- require_relative 'spec_helper'
3
-
4
- describe CR::Temporale do
5
- let(:t12) { described_class.new 2012 }
6
- let(:t13) { described_class.new 2013 }
7
- let(:t) { t12 }
8
-
9
- let(:factory) { CR::Temporale::CelebrationFactory }
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 '.for_day' do
23
- it 'continues the previous year\'s calendar in summer' do
24
- expect(described_class.for_day(Date.new(2014, 6, 9))).to eq described_class.new(2013)
25
- end
26
-
27
- it 'provides the current year\'s calendar in December' do
28
- expect(described_class.for_day(Date.new(2014, 12, 20))).to eq described_class.new(2014)
29
- end
30
- end
31
-
32
- describe '#==' do
33
- let(:year) { 2012 }
34
- let(:b) { described_class.new year }
35
-
36
- describe 'year' do
37
- let(:a) { described_class.new year }
38
-
39
- it 'same' do
40
- expect(a).to be == described_class.new(year)
41
- end
42
-
43
- it 'different' do
44
- expect(a).not_to be == described_class.new(year + 1)
45
- end
46
- end
47
-
48
- describe 'transfers' do
49
- let(:transfers) { [:epiphany, :ascension] }
50
- let(:a) { described_class.new year, transfer_to_sunday: transfers }
51
-
52
- it 'same' do
53
- reversed_transfers = transfers.reverse # order doesn't matter
54
- expect(a)
55
- .to be == described_class.new(year, transfer_to_sunday: reversed_transfers)
56
- end
57
-
58
- it 'different' do
59
- expect(a).not_to be == b
60
- end
61
- end
62
-
63
- describe 'extensions' do
64
- let(:empty_enumerator) do
65
- o = Object.new
66
- def o.each_celebration; end
67
- o
68
- end
69
-
70
- let(:extensions) do
71
- [
72
- CR::Temporale::Extensions::ChristEternalPriest,
73
- empty_enumerator
74
- ]
75
- end
76
-
77
- let(:a) { described_class.new year, extensions: extensions }
78
-
79
- it 'same' do
80
- reversed_extensions = extensions.reverse # order doesn't matter
81
- expect(a)
82
- .to be == described_class.new(year, extensions: reversed_extensions)
83
- end
84
-
85
- it 'different' do
86
- expect(a).not_to be == b
87
- end
88
- end
89
- end
90
-
91
- describe '#first_advent_sunday determines first Sunday of Advent' do
92
- [
93
- [2004, [11, 28]],
94
- [2010, [11, 28]],
95
- [2011, [11, 27]],
96
- [2012, [12, 2]],
97
- [2013, [12, 1]]
98
- ].each do |d|
99
- year, date = d
100
- it year do
101
- temporale = described_class.new(year)
102
- expect(temporale.first_advent_sunday).to eq Date.new(year, *date)
103
- end
104
- end
105
- end
106
-
107
- describe '#easter_sunday determines Easter Sunday' do
108
- [
109
- [2003, [2004, 4, 11]],
110
- [2004, [2005, 3, 27]],
111
- [2005, [2006, 4, 16]],
112
- [2006, [2007, 4, 8]],
113
- [2014, [2015, 4, 5]]
114
- ].each do |d|
115
- year, date = d
116
- it year do
117
- temporale = described_class.new(year)
118
- expect(temporale.easter_sunday).to eq Date.new(*date)
119
- end
120
- end
121
- end
122
-
123
- describe '#date_range' do
124
- it 'includes days of the year' do
125
- expect(t.date_range).to include Date.new(2012, 12, 3)
126
- expect(t.date_range).to include Date.new(2013, 11, 5)
127
- end
128
- end
129
-
130
- describe '#season' do
131
- shared_examples 'season determination' do |year_beginning, year_end|
132
- if year_beginning
133
- it { expect { t13.season(date_beginning - 1) }.to raise_exception RangeError }
134
- else
135
- it { expect(t13.season(date_beginning - 1)).not_to be season }
136
- end
137
-
138
- it { expect(t13.season(date_beginning)).to be season }
139
- it { expect(t13.season(date_end)).to be season }
140
-
141
- if year_end
142
- it { expect { t13.season(date_end + 1) }.to raise_exception RangeError }
143
- else
144
- it { expect(t13.season(date_end + 1)).not_to be season }
145
- end
146
- end
147
-
148
- describe 'Advent' do
149
- let(:season) { CR::Seasons::ADVENT }
150
- let(:date_beginning) { Date.new(2013, 12, 1) }
151
- let(:date_end) { Date.new(2013, 12, 24) }
152
- include_examples 'season determination', true
153
- end
154
-
155
- describe 'Christmas' do
156
- let(:season) { CR::Seasons::CHRISTMAS }
157
- let(:date_beginning) { Date.new(2013, 12, 25) }
158
- let(:date_end) { Date.new(2014, 1, 12) }
159
- include_examples 'season determination'
160
- end
161
-
162
- describe 'Ordinary Time #1' do
163
- let(:season) { CR::Seasons::ORDINARY }
164
- let(:date_beginning) { Date.new(2014, 1, 13) }
165
- let(:date_end) { Date.new(2014, 3, 4) }
166
- include_examples 'season determination'
167
- end
168
-
169
- describe 'Lent' do
170
- let(:season) { CR::Seasons::LENT }
171
- let(:date_beginning) { Date.new(2014, 3, 5) }
172
- let(:date_end) { Date.new(2014, 4, 19) }
173
- include_examples 'season determination'
174
- end
175
-
176
- describe 'Easter time' do
177
- let(:season) { CR::Seasons::EASTER }
178
- let(:date_beginning) { Date.new(2014, 4, 20) }
179
- let(:date_end) { Date.new(2014, 6, 8) }
180
- include_examples 'season determination'
181
- end
182
-
183
- describe 'Ordinary Time #2' do
184
- let(:season) { CR::Seasons::ORDINARY }
185
- let(:date_beginning) { Date.new(2014, 6, 9) }
186
- let(:date_end) { Date.new(2014, 11, 29) }
187
- include_examples 'season determination', nil, true
188
- end
189
- end
190
-
191
- describe '#season_beginning' do
192
- let(:year) { 2016 }
193
- let(:options) { {} }
194
- let(:t) { described_class.new(year, **options) }
195
-
196
- describe 'unsupported season' do
197
- it 'fails' do
198
- season = CR::Season.new(:strawberry_season, CR::Colours::RED)
199
- expect do
200
- t.season_beginning season
201
- end.to raise_exception(ArgumentError, /unsupported season/)
202
- end
203
- end
204
-
205
- describe 'Ordinary Time' do
206
- describe 'Epiphany not transferred' do
207
- it do
208
- expect(t.season_beginning(CR::Seasons::ORDINARY))
209
- .to eq Date.new(2017, 1, 9)
210
- end
211
- end
212
-
213
- describe 'Epiphany transferred' do
214
- let(:t) { described_class.new(year, transfer_to_sunday: [:epiphany]) }
215
-
216
- it do
217
- expect(t.season_beginning(CR::Seasons::ORDINARY))
218
- .to eq Date.new(2017, 1, 10)
219
- end
220
- end
221
- end
222
- end
223
-
224
- describe '#get' do
225
- it 'returns a Celebration' do
226
- expect(t13.get(8, 12)).to be_a CR::Celebration
227
- end
228
-
229
- describe 'for' do
230
- describe 'ferial' do
231
- it 'in Ordinary Time' do
232
- c = t13.get(8, 12)
233
- expect(c.rank).to eq CR::Ranks::FERIAL
234
- expect(c.color).to eq CR::Colours::GREEN
235
- end
236
-
237
- it 'in Advent' do
238
- c = t13.get(12, 12)
239
- expect(c.rank).to eq CR::Ranks::FERIAL
240
- expect(c.color).to eq CR::Colours::VIOLET
241
- end
242
-
243
- it 'in the last week of Advent' do
244
- c = t13.get(12, 23)
245
- expect(c.rank).to eq CR::Ranks::FERIAL_PRIVILEGED
246
- expect(c.color).to eq CR::Colours::VIOLET
247
- end
248
-
249
- it 'in Christmas time' do
250
- c = t13.get(1, 3)
251
- expect(c.rank).to eq CR::Ranks::FERIAL
252
- expect(c.color).to eq CR::Colours::WHITE
253
- end
254
-
255
- it 'in Lent' do
256
- c = t13.get(3, 18)
257
- expect(c.rank).to eq CR::Ranks::FERIAL_PRIVILEGED
258
- expect(c.color).to eq CR::Colours::VIOLET
259
- end
260
-
261
- it 'in Easter Time' do
262
- c = t13.get(5, 5)
263
- expect(c.rank).to eq CR::Ranks::FERIAL
264
- expect(c.color).to eq CR::Colours::WHITE
265
- end
266
- end
267
-
268
- describe 'Sunday' do
269
- it 'in Ordinary Time' do
270
- c = t13.get(8, 10)
271
- expect(c.rank).to eq CR::Ranks::SUNDAY_UNPRIVILEGED
272
- expect(c.color).to eq CR::Colours::GREEN
273
- end
274
-
275
- it 'in Advent' do
276
- c = t13.get(12, 15)
277
- expect(c.rank).to eq CR::Ranks::PRIMARY
278
- expect(c.color).to eq CR::Colours::VIOLET
279
- end
280
-
281
- it 'in Christmas time' do
282
- c = t13.get(1, 5)
283
- expect(c.rank).to eq CR::Ranks::SUNDAY_UNPRIVILEGED
284
- expect(c.color).to eq CR::Colours::WHITE
285
- end
286
-
287
- it 'in Lent' do
288
- c = t13.get(3, 23)
289
- expect(c.rank).to eq CR::Ranks::PRIMARY
290
- expect(c.color).to eq CR::Colours::VIOLET
291
- end
292
-
293
- it 'in Easter Time' do
294
- c = t13.get(5, 11)
295
- expect(c.rank).to eq CR::Ranks::PRIMARY
296
- expect(c.color).to eq CR::Colours::WHITE
297
- end
298
- end
299
-
300
- describe 'solemnities and their cycles - ' do
301
- it 'end of Advent time' do
302
- c = t13.get(12, 17)
303
- expect(c.rank).to eq CR::Ranks::FERIAL_PRIVILEGED
304
- expect(c.colour).to eq CR::Colours::VIOLET
305
- end
306
-
307
- it 'Nativity' do
308
- c = t13.get(12, 25)
309
- expect(c.rank).to eq CR::Ranks::PRIMARY
310
- expect(c.title).to have_translation 'Christmas'
311
- expect(c.colour).to eq CR::Colours::WHITE
312
- expect(c.symbol).to eq :nativity
313
- expect(c.date).to eq CR::AbstractDate.new(12, 25)
314
- end
315
-
316
- it 'day in the octave of Nativity' do
317
- c = t13.get(12, 27)
318
- expect(c.rank).to eq CR::Ranks::FERIAL_PRIVILEGED
319
- expect(c.colour).to eq CR::Colours::WHITE
320
- end
321
-
322
- it 'Holy Family' do
323
- c = t13.get(12, 29)
324
- expect(c.rank).to eq CR::Ranks::FEAST_LORD_GENERAL
325
- expect(c.title).to have_translation 'The Holy Family'
326
- expect(c.colour).to eq CR::Colours::WHITE
327
- end
328
-
329
- context 'when a Sunday does not occur between Dec 25 and Jan 1' do
330
- it 'is Holy Family on Friday Dec 30' do
331
- t16 = described_class.new 2016
332
- c = t16.get(12, 30)
333
- expect(c.title).to have_translation 'The Holy Family'
334
- end
335
- end
336
-
337
- it 'Epiphany' do
338
- c = t13.get(1, 6)
339
- expect(c.rank).to eq CR::Ranks::PRIMARY
340
- expect(c.title).to have_translation 'The Epiphany'
341
- expect(c.colour).to eq CR::Colours::WHITE
342
- end
343
-
344
- it 'Baptism of the Lord' do
345
- c = t13.get(1, 12)
346
- expect(c.rank).to eq CR::Ranks::FEAST_LORD_GENERAL
347
- expect(c.title).to have_translation 'The Baptism of the Lord'
348
- expect(c.colour).to eq CR::Colours::WHITE
349
- end
350
-
351
- it 'Ash Wednesday' do
352
- c = t13.get(3, 5)
353
- expect(c.rank).to eq CR::Ranks::PRIMARY
354
- expect(c.title).to have_translation 'Ash Wednesday'
355
- expect(c.colour).to eq CR::Colours::VIOLET
356
- end
357
-
358
- it 'Palm Sunday' do
359
- c = t13.get(4, 13)
360
- expect(c.rank).to eq CR::Ranks::PRIMARY
361
- expect(c.title).to have_translation 'Passion Sunday (Palm Sunday)'
362
- expect(c.colour).to eq CR::Colours::RED
363
- end
364
-
365
- it 'Good Friday' do
366
- c = t13.get(4, 18)
367
- expect(c.rank).to eq CR::Ranks::TRIDUUM
368
- expect(c.title).to have_translation 'Good Friday'
369
- expect(c.colour).to eq CR::Colours::RED
370
- end
371
-
372
- it 'Holy Saturday' do
373
- c = t13.get(4, 19)
374
- expect(c.rank).to eq CR::Ranks::TRIDUUM
375
- expect(c.title).to have_translation 'Holy Saturday'
376
- expect(c.colour).to eq CR::Colours::VIOLET
377
- end
378
-
379
- it 'Resurrection' do
380
- c = t13.get(4, 20)
381
- expect(c.rank).to eq CR::Ranks::TRIDUUM
382
- expect(c.title).to have_translation 'Easter Sunday'
383
- expect(c.colour).to eq CR::Colours::WHITE
384
- expect(c.symbol).to eq :easter_sunday
385
- end
386
-
387
- it 'Ascension' do
388
- c = t13.get(5, 29)
389
- expect(c.rank).to eq CR::Ranks::PRIMARY
390
- expect(c.title).to have_translation 'The Ascension'
391
- expect(c.colour).to eq CR::Colours::WHITE
392
- end
393
-
394
- it 'Pentecost' do
395
- c = t13.get(6, 8)
396
- expect(c.rank).to eq CR::Ranks::PRIMARY
397
- expect(c.title).to have_translation 'Pentecost'
398
- expect(c.colour).to eq CR::Colours::RED
399
- expect(c.symbol).to eq :pentecost
400
- end
401
-
402
- it 'Trinity' do
403
- c = t13.get(6, 15)
404
- expect(c.rank).to eq CR::Ranks::SOLEMNITY_GENERAL
405
- expect(c.title).to have_translation 'Trinity Sunday'
406
- expect(c.colour).to eq CR::Colours::WHITE
407
- end
408
-
409
- it 'Body of Christ' do
410
- c = t13.get(6, 19)
411
- expect(c.rank).to eq CR::Ranks::SOLEMNITY_GENERAL
412
- expect(c.title).to have_translation 'Corpus Christi (The Body and Blood of Christ)'
413
- expect(c.colour).to eq CR::Colours::WHITE
414
- end
415
-
416
- it 'Sacred Heart' do
417
- c = t13.get(6, 27)
418
- expect(c.rank).to eq CR::Ranks::SOLEMNITY_GENERAL
419
- expect(c.title).to have_translation 'The Sacred Heart of Jesus'
420
- expect(c.colour).to eq CR::Colours::WHITE
421
- end
422
-
423
- it 'Christ the King' do
424
- c = t13.get(11, 23)
425
- expect(c.rank).to eq CR::Ranks::SOLEMNITY_GENERAL
426
- expect(c.title).to have_translation 'Christ The King'
427
- expect(c.colour).to eq CR::Colours::WHITE
428
- end
429
-
430
- describe 'other locales' do
431
- it 'Latin' do
432
- I18n.with_locale(:la) do
433
- c = t13.get(11, 23)
434
- expect(c.title).to eq 'Domini nostri Iesu Christi universorum regis'
435
- end
436
- end
437
-
438
- it 'Czech' do
439
- I18n.with_locale(:cs) do
440
- c = t13.get(11, 23)
441
- expect(c.title).to eq 'Ježíše Krista krále'
442
- end
443
- end
444
-
445
- it 'Italian' do
446
- I18n.with_locale(:it) do
447
- c = t13.get(11, 23)
448
- expect(c.title).to eq "Nostro Signore Gesù Cristo Re dell'universo"
449
- end
450
- end
451
- end
452
- end
453
-
454
- # movable sanctorale feasts don't really belong in Temporale, but ...
455
- describe 'movable sanctorale feasts' do
456
- it 'Immaculate Heart' do
457
- c = t13.get(6, 28)
458
- expect(c.title).to have_translation 'The Immaculate Heart of Mary'
459
- expect(c.rank).to eq CR::Ranks::MEMORIAL_GENERAL
460
- end
461
-
462
- it 'Mary, Mother of the Church' do
463
- # it would be an anachronism to retrieve this celebration
464
- # from t13
465
- t17 = described_class.new 2017
466
- c = t17.get(5, 21)
467
- expect(c.title).to have_translation 'Mary, Mother of the Church'
468
- expect(c.rank).to eq CR::Ranks::MEMORIAL_GENERAL
469
- end
470
- end
471
- end
472
-
473
- describe 'titles of Sundays and ferials' do
474
- def title_for(month, day)
475
- t13.get(month, day).title
476
- end
477
-
478
- describe 'Ordinary time' do
479
- it 'Sunday' do
480
- expect(title_for(1, 19)).to have_translation '2nd Sunday in Ordinary Time'
481
- end
482
-
483
- it 'ferial' do
484
- expect(title_for(1, 13)).to have_translation 'Monday, 1st week in Ordinary Time'
485
- end
486
- end
487
-
488
- describe 'Advent' do
489
- it 'Sunday' do
490
- expect(title_for(12, 1)).to have_translation '1st Sunday of Advent'
491
- end
492
-
493
- it 'ferial' do
494
- expect(title_for(12, 2)).to have_translation 'Monday, 1st week of Advent'
495
- end
496
-
497
- it 'ferial before Christmas' do
498
- expect(title_for(12, 17)).to have_translation '17th December'
499
- end
500
- end
501
-
502
- describe 'Christmas time' do
503
- describe 'Octave of Christmas' do
504
- it 'ferial' do
505
- day = t13.get(12, 30)
506
- expect(day.rank).to eq CR::Ranks::FERIAL_PRIVILEGED
507
- expect(day.title).to have_translation '6th day of Christmas Octave'
508
- end
509
- end
510
-
511
- describe 'after Octave of Christmas' do
512
- it 'ferial' do
513
- expect(title_for(1, 2)).to have_translation 'Thursday after Christmas Octave'
514
- end
515
-
516
- it 'Sunday' do
517
- expect(title_for(1, 5)).to have_translation '2nd Sunday after the Nativity of the Lord'
518
- end
519
- end
520
-
521
- describe 'after Epiphany' do
522
- it 'ferial' do
523
- expect(title_for(1, 7)).to have_translation 'Tuesday after Epiphany'
524
- end
525
- end
526
- end
527
-
528
- describe 'Lent' do
529
- describe 'before first Sunday' do
530
- it 'ferial' do
531
- expect(title_for(3, 6)).to have_translation 'Thursday after Ash Wednesday'
532
- end
533
- end
534
-
535
- it 'Sunday' do
536
- expect(title_for(3, 9)).to have_translation '1st Sunday of Lent'
537
- end
538
-
539
- it 'ferial' do
540
- expect(title_for(3, 10)).to have_translation 'Monday, 1st week of Lent'
541
- end
542
-
543
- describe 'Holy Week' do
544
- it 'ferial' do
545
- day = t13.get(4, 14)
546
- expect(day.rank).to eq CR::Ranks::PRIMARY
547
- expect(day.title).to have_translation 'Monday of Holy Week'
548
- end
549
- end
550
- end
551
-
552
- describe 'Easter' do
553
- describe 'Easter Octave' do
554
- it 'ferial' do
555
- c = t13.get(4, 22)
556
- expect(c.rank).to eq CR::Ranks::PRIMARY
557
- expect(c.title).to have_translation 'Easter Tuesday'
558
- end
559
-
560
- it 'Sunday (the octave day)' do
561
- c = t13.get(4, 27)
562
- expect(c.rank).to eq CR::Ranks::PRIMARY
563
- expect(c.title).to have_translation '2nd Sunday of Easter'
564
- end
565
- end
566
-
567
- it 'Sunday' do
568
- expect(title_for(5, 4)).to have_translation '3rd Sunday of Easter'
569
- end
570
-
571
- it 'ferial' do
572
- expect(title_for(5, 5)).to have_translation 'Monday, 3rd week of Easter'
573
- end
574
- end
575
-
576
- describe 'other locales' do
577
- it 'Latin' do
578
- I18n.with_locale(:la) do
579
- expect(title_for(5, 5)).to eq 'Feria secunda, hebdomada III temporis paschalis'
580
- end
581
- end
582
-
583
- it 'Czech' do
584
- I18n.with_locale(:cs) do
585
- expect(title_for(5, 5)).to eq 'Pondělí po 3. neděli velikonoční'
586
- end
587
- end
588
-
589
- it 'French' do
590
- I18n.with_locale(:fr) do
591
- expect(title_for(5, 5)).to eq 'Lundi, 3ème semaine de Pâques'
592
- end
593
- end
594
-
595
- it 'Italian' do
596
- I18n.with_locale(:it) do
597
- expect(title_for(5, 5)).to eq 'Lunedì, III di Pasqua'
598
- end
599
- end
600
- end
601
- end
602
- end
603
-
604
- describe 'packaged extensions' do
605
- describe 'ChristEternalPriest' do
606
- let(:t) { described_class.new(2016, extensions: [CR::Temporale::Extensions::ChristEternalPriest]) }
607
-
608
- it 'adds the feast' do
609
- I18n.with_locale(:cs) do
610
- c = t.get(6, 8)
611
- expect(c.title).to eq 'Ježíše Krista, nejvyššího a věčného kněze'
612
- expect(c.rank).to eq CR::Ranks::FEAST_PROPER
613
- expect(c.colour).to eq CR::Colours::WHITE
614
- end
615
- end
616
- end
617
- end
618
-
619
- describe 'Solemnities transferred to a Sunday' do
620
- let(:year) { 2016 }
621
- let(:transferred) { [:epiphany, :ascension, :corpus_christi] }
622
- let(:t) { described_class.new(year, transfer_to_sunday: transferred) }
623
- let(:t_notransfer) { described_class.new(year) }
624
-
625
- it 'Epiphany' do
626
- date = Date.new(2017, 1, 8)
627
- expect(date).to be_sunday # make sure
628
-
629
- expect(t.epiphany).to eq date
630
-
631
- c = t.get(date)
632
- expect(c).to eq factory.epiphany
633
- end
634
-
635
- it 'Baptism of the Lord after transferred Epiphany' do
636
- date = Date.new(2017, 1, 9)
637
- expect(date).to be_monday # make sure
638
-
639
- expect(t.baptism_of_lord).to eq date
640
-
641
- c = t.get(date)
642
- expect(c).to eq factory.baptism_of_lord
643
- end
644
-
645
- describe 'Ordinary Time numbering after transferred Epiphany' do
646
- it 'ferials correct' do
647
- first_ot_tuesday = Date.new(2017, 1, 10)
648
- expect(t.get(first_ot_tuesday)).to eq t_notransfer.get(first_ot_tuesday)
649
- end
650
-
651
- it 'Sundays correct' do
652
- second_ot_sunday = Date.new(2017, 1, 15)
653
- expect(t.get(second_ot_sunday)).to eq t_notransfer.get(second_ot_sunday)
654
- end
655
- end
656
-
657
- it 'Ascension' do
658
- date = Date.new(2017, 5, 28)
659
- expect(date).to be_sunday # make sure
660
-
661
- expect(t.ascension).to eq date
662
-
663
- c = t.get(date)
664
- expect(c).to eq factory.ascension
665
- end
666
-
667
- it 'Corpus Christi' do
668
- date = Date.new(2017, 6, 18)
669
- expect(date).to be_sunday # make sure
670
-
671
- expect(t.corpus_christi).to eq date
672
-
673
- c = t.get(date)
674
- expect(c).to eq factory.corpus_christi
675
- end
676
-
677
- it 'fails on an unsupported solemnity' do
678
- expect do
679
- described_class.new(2016, transfer_to_sunday: [:sacred_heart])
680
- end.to raise_exception(RuntimeError, /not supported/)
681
- end
682
- end
683
-
684
- describe 'properly setting cycle' do
685
- t = CR::Temporale.new(2013)
686
- t.date_range.each do |date|
687
- it date do
688
- c = t.get date
689
- expect(c.cycle).to be :temporale
690
- end
691
- end
692
- end
693
- end