calendarium-romanum 0.5.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +5 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +50 -0
  5. data/.travis.yml +23 -0
  6. data/.yardopts +3 -0
  7. data/Appraisals +67 -0
  8. data/CHANGELOG.md +488 -0
  9. data/Gemfile +26 -0
  10. data/Gemfile.lock +95 -0
  11. data/README.md +601 -0
  12. data/Rakefile +27 -0
  13. data/bin/calendariumrom +3 -0
  14. data/calendarium-romanum.gemspec +31 -0
  15. data/config/locales/cs.yml +4 -0
  16. data/config/locales/en.yml +20 -14
  17. data/config/locales/es.yml +94 -0
  18. data/config/locales/fr.yml +6 -0
  19. data/config/locales/it.yml +6 -0
  20. data/config/locales/la.yml +6 -0
  21. data/config/locales/pt.yml +94 -0
  22. data/data/README.md +70 -24
  23. data/data/czech-brno-cs.txt +4 -6
  24. data/data/czech-budejovice-cs.txt +4 -6
  25. data/data/czech-cechy-cs.txt +4 -5
  26. data/data/czech-cs.txt +239 -235
  27. data/data/czech-hradec-cs.txt +3 -5
  28. data/data/czech-litomerice-cs.txt +5 -7
  29. data/data/czech-morava-cs.txt +4 -5
  30. data/data/czech-olomouc-cs.txt +2 -4
  31. data/data/czech-ostrava-cs.txt +3 -5
  32. data/data/czech-plzen-cs.txt +3 -5
  33. data/data/czech-praha-cs.txt +3 -4
  34. data/data/easter_dates.txt +67 -0
  35. data/data/universal-1969-la.txt +234 -0
  36. data/data/universal-en.txt +217 -211
  37. data/data/universal-es.txt +246 -0
  38. data/data/universal-fr.txt +217 -210
  39. data/data/universal-it.txt +217 -211
  40. data/data/universal-la.txt +217 -212
  41. data/data/universal-pt.txt +248 -0
  42. data/doc/data_readme.md +2 -0
  43. data/doc/images/class_diagram.png +0 -0
  44. data/doc/images/class_diagram.puml +44 -0
  45. data/doc/yard_readme.rdoc +76 -0
  46. data/lib/calendarium-romanum.rb +16 -2
  47. data/lib/calendarium-romanum/abstract_date.rb +15 -0
  48. data/lib/calendarium-romanum/calendar.rb +150 -33
  49. data/lib/calendarium-romanum/cli.rb +80 -100
  50. data/lib/calendarium-romanum/cli/comparator.rb +83 -0
  51. data/lib/calendarium-romanum/cli/date_parser.rb +30 -0
  52. data/lib/calendarium-romanum/cli/dumper.rb +68 -0
  53. data/lib/calendarium-romanum/cli/helper.rb +23 -0
  54. data/lib/calendarium-romanum/cli/querier.rb +73 -0
  55. data/lib/calendarium-romanum/cr.rb +16 -0
  56. data/lib/calendarium-romanum/data.rb +40 -8
  57. data/lib/calendarium-romanum/day.rb +187 -32
  58. data/lib/calendarium-romanum/enum.rb +41 -24
  59. data/lib/calendarium-romanum/enums.rb +127 -43
  60. data/lib/calendarium-romanum/errors.rb +1 -1
  61. data/lib/calendarium-romanum/ordinalizer.rb +10 -1
  62. data/lib/calendarium-romanum/perpetual_calendar.rb +58 -7
  63. data/lib/calendarium-romanum/rank.rb +39 -8
  64. data/lib/calendarium-romanum/rank_predicates.rb +43 -0
  65. data/lib/calendarium-romanum/sanctorale.rb +213 -23
  66. data/lib/calendarium-romanum/sanctorale_factory.rb +74 -3
  67. data/lib/calendarium-romanum/sanctorale_loader.rb +180 -0
  68. data/lib/calendarium-romanum/sanctorale_writer.rb +124 -0
  69. data/lib/calendarium-romanum/temporale.rb +222 -42
  70. data/lib/calendarium-romanum/temporale/celebration_factory.rb +68 -9
  71. data/lib/calendarium-romanum/temporale/date_helper.rb +85 -0
  72. data/lib/calendarium-romanum/temporale/dates.rb +52 -59
  73. data/lib/calendarium-romanum/temporale/easter_table.rb +27 -0
  74. data/lib/calendarium-romanum/temporale/extensions.rb +15 -0
  75. data/lib/calendarium-romanum/temporale/extensions/christ_eternal_priest.rb +16 -3
  76. data/lib/calendarium-romanum/temporale/extensions/dedication_before_all_saints.rb +73 -0
  77. data/lib/calendarium-romanum/transfers.rb +84 -24
  78. data/lib/calendarium-romanum/util.rb +21 -23
  79. data/lib/calendarium-romanum/version.rb +3 -2
  80. data/liturgical_law/1969_normae_universales.md +568 -0
  81. data/liturgical_law/1977_decretum_de_celebratione_baptismatis_domini.md +58 -0
  82. data/liturgical_law/1990_decretum_de_variatione_inducenda.md +67 -0
  83. data/liturgical_law/1998_notificatio_de_occurrentia.md +57 -0
  84. data/liturgical_law/2002_normae_universales.md +946 -0
  85. data/liturgical_law/2006_notification.md +37 -0
  86. data/liturgical_law/2012_declarationes.md +38 -0
  87. data/liturgical_law/2020_dubia_de_calendario_2022.md +100 -0
  88. data/liturgical_law/README.md +74 -0
  89. metadata +61 -38
  90. data/lib/calendarium-romanum/sanctoraleloader.rb +0 -122
  91. data/spec/abstract_date_spec.rb +0 -62
  92. data/spec/calendar_spec.rb +0 -559
  93. data/spec/celebration_factory_spec.rb +0 -16
  94. data/spec/celebration_spec.rb +0 -43
  95. data/spec/cli_spec.rb +0 -155
  96. data/spec/colour_spec.rb +0 -17
  97. data/spec/data_spec.rb +0 -23
  98. data/spec/date_parser_spec.rb +0 -68
  99. data/spec/date_spec.rb +0 -61
  100. data/spec/dates_spec.rb +0 -45
  101. data/spec/day_spec.rb +0 -108
  102. data/spec/enum_spec.rb +0 -51
  103. data/spec/i18n_spec.rb +0 -58
  104. data/spec/ordinalizer_spec.rb +0 -36
  105. data/spec/perpetual_calendar_spec.rb +0 -91
  106. data/spec/rank_spec.rb +0 -57
  107. data/spec/readme_spec.rb +0 -56
  108. data/spec/sanctorale_factory_spec.rb +0 -42
  109. data/spec/sanctorale_spec.rb +0 -191
  110. data/spec/sanctoraleloader_spec.rb +0 -176
  111. data/spec/season_spec.rb +0 -17
  112. data/spec/spec_helper.rb +0 -46
  113. data/spec/temporale_spec.rb +0 -572
data/spec/enum_spec.rb DELETED
@@ -1,51 +0,0 @@
1
- require_relative 'spec_helper'
2
-
3
- describe CalendariumRomanum::Enum do
4
- let(:enum_values) { [:a, :b] }
5
-
6
- let(:test_class) do
7
- Class.new(described_class) { values { [:a, :b] } }
8
- end
9
-
10
- describe '.all' do
11
- it 'returns all values in the original order' do
12
- expect(test_class.all).to eq enum_values
13
- end
14
- end
15
-
16
- describe '.each' do
17
- it 'yields all values in the original order' do
18
- expect {|b| test_class.each(&b) }.to yield_successive_args(*enum_values)
19
- end
20
- end
21
-
22
- describe '[]' do
23
- describe 'default indexing' do
24
- it 'finds first element' do
25
- expect(test_class[0]).to be :a
26
- end
27
-
28
- it 'finds last element' do
29
- expect(test_class[1]).to be :b
30
- end
31
-
32
- it 'returns nil for index out of range' do
33
- expect(test_class[2]).to be nil
34
- end
35
- end
36
-
37
- describe 'indexed by a custom property' do
38
- let(:test_class) do
39
- Class.new(described_class) { values(index_by: :to_s) { [1] } }
40
- end
41
-
42
- it 'finds the element' do
43
- expect(test_class['1']).to eq 1
44
- end
45
-
46
- it 'returns nil for an unknown index' do
47
- expect(test_class[1]).to be nil
48
- end
49
- end
50
- end
51
- end
data/spec/i18n_spec.rb DELETED
@@ -1,58 +0,0 @@
1
- # coding: utf-8
2
- require_relative 'spec_helper'
3
-
4
- describe 'internationalization' do
5
- before :all do
6
- I18n.backend.load_translations
7
- end
8
-
9
- let(:temporale) { CR::Temporale.new(2016) }
10
- let(:easter_celebration) { temporale.get Date.new(2017, 4, 16) }
11
-
12
- describe 'supported locales' do
13
- before :each do
14
- @last_locale = I18n.locale
15
- I18n.locale = locale
16
- end
17
-
18
- after :each do
19
- I18n.locale = @last_locale
20
- end
21
-
22
- describe 'English' do
23
- let(:locale) { 'en' }
24
-
25
- it 'translates Temporale feast names' do
26
- expect(easter_celebration.title).to eq 'Easter Sunday of the Resurrection of the Lord'
27
- end
28
-
29
- it 'translates rank names' do
30
- rank = CR::Ranks::SUNDAY_UNPRIVILEGED
31
- expect(rank.desc).to eq 'Unprivileged Sundays'
32
- expect(rank.short_desc).to eq 'Sunday'
33
- end
34
- end
35
-
36
- describe 'Czech' do
37
- let(:locale) { 'cs' }
38
-
39
- it 'translates Temporale feast names' do
40
- expect(easter_celebration.title).to eq 'Zmrtvýchvstání Páně'
41
- end
42
-
43
- it 'translates rank names' do
44
- rank = CR::Ranks::SUNDAY_UNPRIVILEGED
45
- expect(rank.desc).to eq 'Neprivilegované neděle'
46
- expect(rank.short_desc).to eq 'neděle'
47
- end
48
- end
49
- end
50
-
51
- describe 'unsupported locale' do
52
- # I will be most happy when this locale one day moves to the 'supported' branch!
53
- let(:locale) { 'de' }
54
-
55
- it 'attemt to switch to it fails by default' do
56
- end
57
- end
58
- end
@@ -1,36 +0,0 @@
1
- require_relative 'spec_helper'
2
-
3
- describe CalendariumRomanum::Ordinalizer do
4
- describe '#ordinal' do
5
- describe 'English' do
6
- {
7
- 1 => '1st',
8
- 2 => '2nd',
9
- 3 => '3rd',
10
- 4 => '4th',
11
- 11 => '11th',
12
- 12 => '12th',
13
- 13 => '13th',
14
- 21 => '21st',
15
- 22 => '22nd',
16
- 23 => '23rd',
17
- }.each_pair do |number, ordinal|
18
- it number do
19
- expect(described_class.ordinal(number, locale: :en)).to eq ordinal
20
- end
21
- end
22
- end
23
-
24
- describe 'French' do
25
- {
26
- 1 => '1er',
27
- 2 => '2ème',
28
- 3 => '3ème',
29
- }.each_pair do |number, ordinal|
30
- it number do
31
- expect(described_class.ordinal(number, locale: :fr)).to eq ordinal
32
- end
33
- end
34
- end
35
- end
36
- end
@@ -1,91 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe CR::PerpetualCalendar do
4
- let(:pcal) { described_class.new }
5
-
6
- let(:date) { Date.new(2000, 1, 1) }
7
- let(:year) { 2000 }
8
-
9
- let(:sanctorale) { CR::Data::GENERAL_ROMAN_ENGLISH.load }
10
-
11
- describe '.new' do
12
- describe 'with sanctorale' do
13
- it 'uses the sanctorale' do
14
- pc = described_class.new(sanctorale: sanctorale)
15
-
16
- calendar = pc.calendar_for_year(year)
17
- expect(calendar.sanctorale).to be sanctorale
18
- end
19
- end
20
-
21
- describe 'with temporale options' do
22
- it 'applies the options' do
23
- pc = described_class.new(temporale_options: {transfer_to_sunday: [:epiphany]})
24
-
25
- y = 2016
26
- calendar = pc.calendar_for_year(y)
27
- epiphany_date = CR::Temporale::Dates.epiphany(y, sunday: true)
28
- expect(epiphany_date).not_to eq CR::Temporale::Dates.epiphany(y) # make sure
29
-
30
- expect(calendar.day(epiphany_date).celebrations[0].title).to have_translation 'The Epiphany of the Lord'
31
- end
32
- end
33
-
34
- describe 'with temporale factory' do
35
- it 'uses the factory' do
36
- temporale_subcls = Class.new(CR::Temporale)
37
- factory = lambda {|year| temporale_subcls.new year }
38
-
39
- pc = described_class.new(temporale_factory: factory)
40
- calendar = pc.calendar_for_year(year)
41
- expect(calendar.temporale).to be_a temporale_subcls
42
- end
43
- end
44
-
45
- describe 'with both temporale factory and options' do
46
- it 'fails' do
47
- expect do
48
- described_class.new(
49
- temporale_options: {transfer_to_sunday: [:epiphany]},
50
- temporale_factory: lambda {|year| temporale_subcls.new year }
51
- )
52
- end.to raise_exception ArgumentError
53
- end
54
- end
55
-
56
- describe 'with cache' do
57
- it 'uses the supplied object as Calendar instance cache' do
58
- cache = {}
59
- pc = described_class.new(cache: cache)
60
- calendar = pc.calendar_for_year(year)
61
- expect(cache[2000]).to be calendar
62
- end
63
- end
64
- end
65
-
66
- describe '#day' do
67
- it 'returns a Day' do
68
- expect(pcal.day(Date.today)).to be_a CR::Day
69
- end
70
- end
71
-
72
- describe '#calendar_for' do
73
- it 'returns a Calendar' do
74
- expect(pcal.calendar_for(date)).to be_a CR::Calendar
75
- end
76
- end
77
-
78
- describe '#calendar_for_year' do
79
- it 'returns a Calendar' do
80
- expect(pcal.calendar_for_year(year)).to be_a CR::Calendar
81
- end
82
- end
83
-
84
- describe 'caching' do
85
- it 'caches calendar instances' do
86
- expect(CR::Calendar).to receive(:new)
87
-
88
- 2.times { pcal.calendar_for_year(year) }
89
- end
90
- end
91
- end
data/spec/rank_spec.rb DELETED
@@ -1,57 +0,0 @@
1
- require_relative 'spec_helper'
2
-
3
- describe CR::Rank do
4
- describe 'comparison' do
5
- it 'memorial x ferial' do
6
- expect(CR::Ranks::MEMORIAL_GENERAL).to be > CR::Ranks::FERIAL
7
- end
8
- end
9
-
10
- describe '[]' do
11
- it 'has all existing instances indexed by rank number' do
12
- expect(CR::Ranks[1.1]).to eq CR::Ranks::TRIDUUM
13
- end
14
- end
15
-
16
- describe '#<' do
17
- it { expect(CR::Ranks[1.2]).to be < CR::Ranks[1.1] }
18
- it { expect(CR::Ranks[1.1]).not_to be < CR::Ranks[1.2] }
19
- end
20
-
21
- describe '#>' do
22
- it { expect(CR::Ranks[1.1]).to be > CR::Ranks[1.2] }
23
- it { expect(CR::Ranks[1.2]).not_to be > CR::Ranks[1.1] }
24
- end
25
-
26
- describe '#==' do
27
- it { expect(CR::Ranks[1.2]).to be == CR::Ranks[1.2] }
28
- it { expect(CR::Ranks[1.2]).not_to be == CR::Ranks[1.1] }
29
- end
30
-
31
- describe 'descriptions' do
32
- CR::Ranks.each do |rank|
33
- describe "#{rank.priority} #{rank.short_desc}" do
34
- it 'has #desc translated' do
35
- expect(rank.desc).to have_translation
36
- end
37
-
38
- it 'is has #short_desc translated' do
39
- if rank.short_desc # not set for some ranks
40
- expect(rank.short_desc).to have_translation
41
- end
42
- end
43
- end
44
- end
45
-
46
- describe '#short_desc' do
47
- it 'is not always set' do
48
- expect(CR::Ranks[1.1].short_desc).to be_nil
49
- end
50
- end
51
- end
52
-
53
- describe '#memorial?' do
54
- it { expect(CR::Ranks::MEMORIAL_OPTIONAL.memorial?).to be true }
55
- it { expect(CR::Ranks::FERIAL.memorial?).to be false }
56
- end
57
- end
data/spec/readme_spec.rb DELETED
@@ -1,56 +0,0 @@
1
- require 'spec_helper'
2
-
3
- class MarkdownDocument
4
- def initialize(str)
5
- @str = str
6
- end
7
-
8
- def each_ruby_example
9
- example = nil
10
- line = nil
11
- @str.each_line.with_index(1) do |l, i|
12
- if example.nil?
13
- if example_beginning?(l)
14
- example = ''
15
- line = i + 1
16
- end
17
- elsif example_end?(l)
18
- yield example, line
19
- example = nil
20
- else
21
- example += l
22
- end
23
- end
24
- end
25
-
26
- protected
27
-
28
- def example_beginning?(line)
29
- line =~ /^```ruby/
30
- end
31
-
32
- def example_end?(line)
33
- line =~ /```/
34
- end
35
- end
36
-
37
- %w(README.md data/README.md).each do |path|
38
- describe path do
39
- before :each do
40
- STDERR.stub(:puts)
41
- end
42
-
43
- readme_path = File.expand_path('../../' + path, __FILE__)
44
- readme = File.read readme_path
45
- doc = MarkdownDocument.new readme
46
-
47
- doc.each_ruby_example do |code, line|
48
- describe "example L#{line}" do
49
- it 'executes without failure' do
50
- cls = Class.new
51
- cls.class_eval(code, readme_path, line)
52
- end
53
- end
54
- end
55
- end
56
- end
@@ -1,42 +0,0 @@
1
- # coding: utf-8
2
- require 'spec_helper'
3
-
4
- describe CR::SanctoraleFactory do
5
- describe '.create_layered'
6
-
7
- describe '.load_layered_from_files' do
8
- before :each do
9
- files = %w(czech-cs.txt czech-cechy-cs.txt czech-budejovice-cs.txt).collect do |f|
10
- File.join(File.expand_path('../data', File.dirname(__FILE__)), f)
11
- end
12
- @s = described_class.load_layered_from_files(*files)
13
- end
14
-
15
- it 'has celebrations from the first file' do
16
- dd = @s.get 9, 28
17
- expect(dd.size).to eq 1
18
-
19
- d = dd.first
20
- expect(d.rank).to eq CR::Ranks::SOLEMNITY_PROPER
21
- expect(d.title).to eq 'Sv. Václava, mučedníka, hlavního patrona českého národa'
22
- end
23
-
24
- it 'has celebrations from the second file' do
25
- dd = @s.get 7, 4
26
- expect(dd.size).to eq 1
27
-
28
- d = dd.first
29
- expect(d.rank).to eq CR::Ranks::MEMORIAL_PROPER
30
- expect(d.title).to eq 'Sv. Prokopa, opata'
31
- end
32
-
33
- it 'celebrations from the last file win' do
34
- dd = @s.get 12, 22
35
- expect(dd.size).to eq 1
36
-
37
- d = dd.first
38
- expect(d.rank).to eq CR::Ranks::FEAST_PROPER
39
- expect(d.title).to eq 'Výročí posvěcení katedrály sv. Mikuláše'
40
- end
41
- end
42
- end
@@ -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