calendarium-romanum 0.4.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) 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 +22 -0
  6. data/.yardopts +3 -0
  7. data/CHANGELOG.md +431 -0
  8. data/Gemfile +25 -0
  9. data/Gemfile.lock +86 -0
  10. data/README.md +598 -0
  11. data/Rakefile +16 -0
  12. data/bin/calendariumrom +4 -1
  13. data/calendarium-romanum.gemspec +31 -0
  14. data/config/locales/cs.yml +5 -0
  15. data/config/locales/en.yml +21 -14
  16. data/config/locales/es.yml +94 -0
  17. data/config/locales/fr.yml +7 -0
  18. data/config/locales/it.yml +7 -0
  19. data/config/locales/la.yml +7 -0
  20. data/data/README.md +70 -24
  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 +236 -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/easter_dates.txt +67 -0
  33. data/data/universal-1969-la.txt +234 -0
  34. data/data/universal-en.txt +214 -211
  35. data/data/universal-es.txt +243 -0
  36. data/data/universal-fr.txt +214 -210
  37. data/data/universal-it.txt +214 -211
  38. data/data/universal-la.txt +214 -210
  39. data/doc/data_readme.md +2 -0
  40. data/doc/images/class_diagram.png +0 -0
  41. data/doc/images/class_diagram.puml +44 -0
  42. data/doc/yard_readme.rdoc +76 -0
  43. data/lib/calendarium-romanum.rb +35 -22
  44. data/lib/calendarium-romanum/abstract_date.rb +15 -0
  45. data/lib/calendarium-romanum/calendar.rb +207 -42
  46. data/lib/calendarium-romanum/cli.rb +63 -80
  47. data/lib/calendarium-romanum/cli/comparator.rb +63 -0
  48. data/lib/calendarium-romanum/cli/date_parser.rb +30 -0
  49. data/lib/calendarium-romanum/cli/dumper.rb +68 -0
  50. data/lib/calendarium-romanum/cli/helper.rb +23 -0
  51. data/lib/calendarium-romanum/cli/querier.rb +73 -0
  52. data/lib/calendarium-romanum/cr.rb +16 -0
  53. data/lib/calendarium-romanum/data.rb +50 -20
  54. data/lib/calendarium-romanum/day.rb +208 -32
  55. data/lib/calendarium-romanum/enum.rb +42 -25
  56. data/lib/calendarium-romanum/enums.rb +124 -44
  57. data/lib/calendarium-romanum/errors.rb +4 -0
  58. data/lib/calendarium-romanum/ordinalizer.rb +23 -2
  59. data/lib/calendarium-romanum/perpetual_calendar.rb +58 -7
  60. data/lib/calendarium-romanum/rank.rb +43 -12
  61. data/lib/calendarium-romanum/rank_predicates.rb +43 -0
  62. data/lib/calendarium-romanum/sanctorale.rb +164 -24
  63. data/lib/calendarium-romanum/sanctorale_factory.rb +74 -3
  64. data/lib/calendarium-romanum/sanctorale_loader.rb +180 -0
  65. data/lib/calendarium-romanum/sanctorale_writer.rb +119 -0
  66. data/lib/calendarium-romanum/temporale.rb +226 -94
  67. data/lib/calendarium-romanum/temporale/celebration_factory.rb +107 -0
  68. data/lib/calendarium-romanum/temporale/dates.rb +84 -16
  69. data/lib/calendarium-romanum/temporale/easter_table.rb +27 -0
  70. data/lib/calendarium-romanum/temporale/extensions.rb +15 -0
  71. data/lib/calendarium-romanum/temporale/extensions/christ_eternal_priest.rb +16 -3
  72. data/lib/calendarium-romanum/temporale/extensions/dedication_before_all_saints.rb +73 -0
  73. data/lib/calendarium-romanum/transfers.rb +60 -15
  74. data/lib/calendarium-romanum/util.rb +22 -3
  75. data/lib/calendarium-romanum/version.rb +5 -1
  76. data/liturgical_law/1969_normae_universales.md +568 -0
  77. data/liturgical_law/1977_decretum_de_celebratione_baptismatis_domini.md +58 -0
  78. data/liturgical_law/1990_decretum_de_variatione_inducenda.md +67 -0
  79. data/liturgical_law/1998_notificatio_de_occurrentia.md +57 -0
  80. data/liturgical_law/2002_normae_universales.md +946 -0
  81. data/liturgical_law/2006_notification.md +37 -0
  82. data/liturgical_law/2012_declarationes.md +38 -0
  83. data/liturgical_law/README.md +74 -0
  84. metadata +50 -28
  85. data/lib/calendarium-romanum/sanctoraleloader.rb +0 -115
  86. data/spec/abstract_date_spec.rb +0 -62
  87. data/spec/calendar_spec.rb +0 -330
  88. data/spec/celebration_spec.rb +0 -23
  89. data/spec/cli_spec.rb +0 -26
  90. data/spec/colour_spec.rb +0 -17
  91. data/spec/data_spec.rb +0 -23
  92. data/spec/date_spec.rb +0 -61
  93. data/spec/dates_spec.rb +0 -45
  94. data/spec/day_spec.rb +0 -59
  95. data/spec/enum_spec.rb +0 -51
  96. data/spec/i18n_spec.rb +0 -59
  97. data/spec/ordinalizer_spec.rb +0 -22
  98. data/spec/perpetual_calendar_spec.rb +0 -91
  99. data/spec/rank_spec.rb +0 -57
  100. data/spec/readme_spec.rb +0 -52
  101. data/spec/sanctorale_factory_spec.rb +0 -42
  102. data/spec/sanctorale_spec.rb +0 -191
  103. data/spec/sanctoraleloader_spec.rb +0 -171
  104. data/spec/season_spec.rb +0 -17
  105. data/spec/spec_helper.rb +0 -35
  106. data/spec/temporale_spec.rb +0 -519
@@ -1,191 +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) }
8
- let(:opt_memorial) { CR::Celebration.new('S. Nullius', CR::Ranks::MEMORIAL_OPTIONAL) }
9
- let(:opt_memorial_2) { CR::Celebration.new('S. Ignoti', CR::Ranks::MEMORIAL_OPTIONAL) }
10
- let(:solemnity) { CR::Celebration.new('S. Nullius', CR::Ranks::SOLEMNITY_PROPER) }
11
-
12
- describe '#get' do
13
- describe 'for an empty day' do
14
- it 'returns an Array' do
15
- expect(s.get(1,3)).to be_an Array
16
- end
17
- end
18
-
19
- describe 'for an unempty day' do
20
- before :each do
21
- s.add 1, 17, antonius
22
- end
23
-
24
- it 'get by month, day' do
25
- expect(s.get(1, 17)).to eq [antonius]
26
- end
27
-
28
- it 'get by Date' do
29
- expect(s.get(Date.new(2014, 1, 17))).to eq [antonius]
30
- end
31
-
32
- it 'may have more CR::Celebrations for a day' do
33
- [
34
- 'S. Fabiani, papae et martyris',
35
- 'S. Sebastiani, martyris'
36
- ].each {|t| s.add 1, 20, CR::Celebration.new(t, CR::Ranks::MEMORIAL_OPTIONAL) }
37
- expect(s.get(1, 20).size).to eq 2
38
- end
39
- end
40
- end
41
-
42
- describe '#add' do
43
- it 'adds a CR::Celebration to one month only' do
44
- s.add 1, 17, antonius
45
- expect(s.get(2, 17)).to be_empty
46
- end
47
-
48
- it 'does not allow month 0' do
49
- expect { s.add 0, 1, opt_memorial }.to raise_exception RangeError
50
- end
51
-
52
- it 'does not allow month higher than 12' do
53
- expect { s.add 13, 1, opt_memorial }.to raise_exception RangeError
54
- end
55
-
56
- it 'adds solemnity to a dedicated container' do
57
- expect { s.add 1, 13, solemnity }.to change { s.solemnities.size }.by 1
58
- end
59
-
60
- it 'does not add non-solemnity to solemnities' do
61
- expect { s.add 1, 13, opt_memorial }.not_to change { s.solemnities.size }
62
- end
63
-
64
- describe 'multiple celebrations on a single day' do
65
- it 'succeeds for any number of optional memorials' do
66
- expect do
67
- s.add 1, 13, opt_memorial
68
- s.add 1, 13, opt_memorial_2
69
- end.not_to raise_exception
70
- end
71
-
72
- it 'fails when adding a non-optional memorial' do
73
- expect do
74
- s.add 1, 13, opt_memorial
75
- s.add 1, 13, CR::Celebration.new('S. Ignoti', CR::Ranks::MEMORIAL_GENERAL)
76
- end.to raise_exception ArgumentError
77
- end
78
-
79
- it 'fails when adding to a non-optional memorial' do
80
- expect do
81
- s.add 1, 13, CR::Celebration.new('S. Nullius', CR::Ranks::MEMORIAL_GENERAL)
82
- s.add 1, 13, opt_memorial_2
83
- end.to raise_exception ArgumentError
84
- end
85
- end
86
- end
87
-
88
- describe '#replace' do
89
- it 'replaces the original celebration(s)' do
90
- s.add 1, 13, opt_memorial_2
91
- s.replace 1, 13, [solemnity]
92
-
93
- expect(s.get(1, 13)).to eq [solemnity]
94
- end
95
-
96
- it 'adds solemnity to a dedicated container' do
97
- expect do
98
- s.replace 1, 13, [solemnity]
99
- end.to change { s.solemnities.size }.by 1
100
- end
101
-
102
- it 'removes solemnity' do
103
- s.add 1, 13, solemnity
104
- expect do
105
- s.replace 1, 13, [opt_memorial_2]
106
- end.to change { s.solemnities.size }.by -1
107
- end
108
-
109
- it 'does not simply save the passed Array' do
110
- array = [opt_memorial]
111
- s.replace 1, 13, array
112
-
113
- array << nil
114
-
115
- expect(s.get(1, 13)).not_to include nil
116
- end
117
- end
118
-
119
- describe '#update' do
120
- let(:s2) { described_class.new }
121
-
122
- it 'adds entries from the argument to receiver' do
123
- s2.add 1, 17, antonius
124
-
125
- expect(s).to be_empty
126
- s.update s2
127
- expect(s.size).to eq 1
128
- end
129
-
130
- it 'overwrites eventual previous content of the day' do
131
- s.add 1, 17, antonius
132
- s2.add 1, 17, opt_memorial
133
-
134
- s.update s2
135
- expect(s.get(1, 17)).to eq [opt_memorial]
136
- end
137
-
138
- it 'does not overwrite content of days for which it does not have any' do
139
- s.add 1, 17, antonius
140
-
141
- s.update s2
142
- expect(s.get(1, 17)).to eq [antonius]
143
- end
144
- end
145
-
146
- describe '#size' do
147
- it 'knows when the Sanctorale is empty' do
148
- expect(s.size).to eq 0
149
- end
150
-
151
- it 'knows when there is something' do
152
- s.add 1, 17, antonius
153
- expect(s.size).to eq 1
154
- end
155
- end
156
-
157
- describe '#empty?' do
158
- it 'is empty at the beginning' do
159
- expect(s).to be_empty
160
- end
161
-
162
- it 'is never more empty once a record is entered' do
163
- s.add 1, 17, antonius
164
- expect(s).not_to be_empty
165
- end
166
- end
167
-
168
- describe '#each_day' do
169
- it 'yields each date and corresponding CR::Celebrations' do
170
- s.add 1, 17, antonius
171
-
172
- expect {|block| s.each_day(&block) }.to yield_with_args(CR::AbstractDate.new(1, 17), [antonius])
173
- end
174
- end
175
-
176
- describe '#freeze' do
177
- it 'makes the instance frozen' do
178
- expect(s).not_to be_frozen # make sure
179
- s.freeze
180
- expect(s).to be_frozen
181
- end
182
-
183
- it 'prevents modification' do
184
- s.freeze
185
-
186
- expect do
187
- s.add 1, 17, antonius
188
- end.to raise_exception(RuntimeError, /can't modify frozen/)
189
- end
190
- end
191
- end
@@ -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,17 +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
- 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 expected && 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.nil? || 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,519 +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 'French' do
436
- I18n.with_locale(:fr) do
437
- expect(title_for(5, 5)).to eq 'Lundi, 3 semaine de Pâques'
438
- end
439
- end
440
-
441
- it 'Italian' do
442
- I18n.with_locale(:it) do
443
- expect(title_for(5, 5)).to eq 'Lunedì, III di Pasqua'
444
- end
445
- end
446
- end
447
- end
448
- end
449
-
450
- describe 'packaged extensions' do
451
- describe 'ChristEternalPriest' do
452
- let(:t) { described_class.new(2016, extensions: [CR::Temporale::Extensions::ChristEternalPriest]) }
453
-
454
- it 'adds the feast' do
455
- I18n.with_locale(:cs) do
456
- c = t.get(6, 8)
457
- expect(c.title).to eq 'Ježíše Krista, nejvyššího a věčného kněze'
458
- expect(c.rank).to eq CR::Ranks::FEAST_PROPER
459
- expect(c.colour).to eq CR::Colours::WHITE
460
- end
461
- end
462
- end
463
- end
464
-
465
- describe 'Solemnities transferred to a Sunday' do
466
- let(:transferred) { [:epiphany, :ascension, :corpus_christi] }
467
- let(:t) { described_class.new(2016, transfer_to_sunday: transferred) }
468
-
469
- it 'Epiphany' do
470
- date = Date.new(2017, 1, 8)
471
- expect(date).to be_sunday # make sure
472
-
473
- expect(t.epiphany).to eq date
474
-
475
- c = t.get(date)
476
- expect(c.rank).to eq CR::Ranks::PRIMARY
477
- expect(c.title).to have_translation 'The Epiphany of the Lord'
478
- end
479
-
480
- it 'Baptism of the Lord after transferred Epiphany' do
481
- date = Date.new(2017, 1, 9)
482
- expect(date).to be_monday # make sure
483
-
484
- expect(t.baptism_of_lord).to eq date
485
-
486
- c = t.get(date)
487
- expect(c.rank).to eq CR::Ranks::FEAST_LORD_GENERAL
488
- expect(c.title).to have_translation 'The Baptism of the Lord'
489
- end
490
-
491
- it 'Ascension' do
492
- date = Date.new(2017, 5, 28)
493
- expect(date).to be_sunday # make sure
494
-
495
- expect(t.ascension).to eq date
496
-
497
- c = t.get(date)
498
- expect(c.rank).to eq CR::Ranks::PRIMARY
499
- expect(c.title).to have_translation 'Ascension of the Lord'
500
- end
501
-
502
- it 'Corpus Christi' do
503
- date = Date.new(2017, 6, 18)
504
- expect(date).to be_sunday # make sure
505
-
506
- expect(t.corpus_christi).to eq date
507
-
508
- c = t.get(date)
509
- expect(c.rank).to eq CR::Ranks::SOLEMNITY_GENERAL
510
- expect(c.title).to have_translation 'The Most Holy Body and Blood of Christ'
511
- end
512
-
513
- it 'fails on an unsupported solemnity' do
514
- expect do
515
- described_class.new(2016, transfer_to_sunday: [:sacred_heart])
516
- end.to raise_exception(RuntimeError, /not supported/)
517
- end
518
- end
519
- end