bahai_date 1.4.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,59 +1,59 @@
1
1
  module BahaiDate
2
2
  describe OccasionFactory do
3
- it 'can be created given a year, month, and day' do
3
+ it "can be created given a year, month, and day" do
4
4
  occasion_factory = OccasionFactory.new(1, 1, 1)
5
5
  expect(occasion_factory).not_to be_nil
6
6
  end
7
7
 
8
- it 'provides a valid occasion for feast days' do
8
+ it "provides a valid occasion for feast days" do
9
9
  occasions = OccasionFactory.new(1, 2, 1).occasions
10
10
  expect(occasions.first.type).to eq :feast
11
11
  end
12
12
 
13
- it 'provides a valid occasion for days of fasting' do
13
+ it "provides a valid occasion for days of fasting" do
14
14
  occasions = OccasionFactory.new(1, 19, 2).occasions
15
15
  expect(occasions.first.type).to eq :fasting
16
16
  end
17
17
 
18
- it 'provides a valid occasion for days during ayyam-i-ha' do
18
+ it "provides a valid occasion for days during ayyam-i-ha" do
19
19
  occasions = OccasionFactory.new(1, -1, 1).occasions
20
20
  expect(occasions.first.type).to eq :ayyam_i_ha
21
21
  end
22
22
 
23
- it 'provides a valid occasion for days during the festival of ridvan' do
23
+ it "provides a valid occasion for days during the festival of ridvan" do
24
24
  occasions = OccasionFactory.new(1, 2, 14).occasions
25
25
  expect(occasions.first.type).to eq :ridvan
26
26
  end
27
27
 
28
- it 'provides a valid occasion for holy days' do
28
+ it "provides a valid occasion for holy days" do
29
29
  occasions = OccasionFactory.new(1, 1, 1).occasions
30
30
  expect(occasions.first.type).to eq :holy
31
31
  end
32
32
 
33
- it 'provides valid occasions when more than one occurs on the same day' do
33
+ it "provides valid occasions when more than one occurs on the same day" do
34
34
  occasions = OccasionFactory.new(1, 1, 1).occasions
35
35
  expect(occasions.size).to be 2
36
36
  expect(occasions.first.type).to eq :holy
37
37
  expect(occasions.last.type).to eq :feast
38
38
  end
39
39
 
40
- context 'for dates before 172 B.E.' do
41
- it 'provides the Declaration of the Bab on the correct day' do
40
+ context "for dates before 172 B.E." do
41
+ it "provides the Declaration of the Bab on the correct day" do
42
42
  occasions = OccasionFactory.new(1, 4, 7).occasions
43
- expect(occasions.first.short_title).to eq 'Declaration of the Bab'
43
+ expect(occasions.first.short_title).to eq "Declaration of the Bab"
44
44
 
45
45
  occasions = OccasionFactory.new(1, 4, 8).occasions
46
46
  expect(occasions.size).to be 0
47
47
  end
48
48
 
49
- it 'provides the Martyrdom of the Bab on the correct day' do
49
+ it "provides the Martyrdom of the Bab on the correct day" do
50
50
  occasions = OccasionFactory.new(1, 6, 16).occasions
51
- expect(occasions.first.short_title).to eq 'Martyrdom of the Bab'
51
+ expect(occasions.first.short_title).to eq "Martyrdom of the Bab"
52
52
  end
53
53
 
54
- it 'provides the Birth of the Bab on the correct day' do
54
+ it "provides the Birth of the Bab on the correct day" do
55
55
  occasions = OccasionFactory.new(1, 12, 5).occasions
56
- expect(occasions.first.short_title).to eq 'Birth of the Bab'
56
+ expect(occasions.first.short_title).to eq "Birth of the Bab"
57
57
  end
58
58
 
59
59
  it "provides the Birth of Baha'u'llah on the correct day" do
@@ -61,34 +61,68 @@ module BahaiDate
61
61
  expect(occasions.first.short_title).to eq "Birth of Baha'u'llah"
62
62
  end
63
63
 
64
- it 'can find the month and day for a given occasion on a given year' do
64
+ it "can find the month and day for a given occasion on a given year" do
65
65
  month_and_day = OccasionFactory.find(:birth_bab, 163)
66
- expect(month_and_day).to eq '12.5'
66
+ expect(month_and_day).to eq "12.5"
67
+ end
68
+
69
+ it "returns nil for an unknown occasion" do
70
+ expect(OccasionFactory.find(:not_an_occasion, 163)).to be_nil
71
+ end
72
+ end
73
+
74
+ context "Ayyam-i-ha date ranges" do
75
+ it "Finds the date range for Ayyam-i-ha" do
76
+ range = OccasionFactory.ayyam_i_ha_range(180)
77
+ expect(range.first).to eq(Date.parse("2024-02-26"))
78
+ expect(range.last).to eq(Date.parse("2024-02-29"))
79
+ expect(range.to_a.length).to eq(4)
80
+ end
81
+
82
+ it "Finds the date range for Ayyam-i-ha for the current year" do
83
+ range = OccasionFactory.ayyam_i_ha_range(187)
84
+ expect(range.first).to eq(Date.parse("2031-02-25"))
85
+ expect(range.last).to eq(Date.parse("2031-03-01"))
86
+ expect(range.to_a.length).to eq(5)
87
+ end
88
+ end
89
+
90
+ context "Fasting date ranges" do
91
+ it "Finds the date range for Fasting month" do
92
+ range = OccasionFactory.fasting_range(180)
93
+ expect(range.first).to eq(Date.parse("2024-03-01"))
94
+ expect(range.last).to eq(Date.parse("2024-03-19"))
95
+ end
96
+
97
+ it "Finds the date range for Fasting month leap year" do
98
+ range = OccasionFactory.fasting_range(187)
99
+ expect(range.first).to eq(Date.parse("2031-03-02"))
100
+ expect(range.last).to eq(Date.parse("2031-03-20"))
67
101
  end
68
102
  end
69
103
 
70
- context 'for dates after 172 B.E.' do
71
- it 'provides the Declaration of the Bab on the correct day' do
104
+ context "for dates after 172 B.E." do
105
+ it "provides the Declaration of the Bab on the correct day" do
72
106
  occasions = OccasionFactory.new(172, 4, 7).occasions
73
107
  expect(occasions.size).to be 0
74
108
 
75
109
  occasions = OccasionFactory.new(172, 4, 8).occasions
76
- expect(occasions.first.short_title).to eq 'Declaration of the Bab'
110
+ expect(occasions.first.short_title).to eq "Declaration of the Bab"
77
111
  end
78
112
 
79
- it 'provides the Martyrdom of the Bab on the correct day' do
113
+ it "provides the Martyrdom of the Bab on the correct day" do
80
114
  occasions = OccasionFactory.new(172, 6, 17).occasions
81
- expect(occasions.first.short_title).to eq 'Martyrdom of the Bab'
115
+ expect(occasions.first.short_title).to eq "Martyrdom of the Bab"
82
116
  end
83
117
 
84
- it 'provides the Birth of the Bab on the correct day' do
118
+ it "provides the Birth of the Bab on the correct day" do
85
119
  occasions = OccasionFactory.new(172, 13, 10).occasions
86
- expect(occasions.first.short_title).to eq 'Birth of the Bab'
120
+ expect(occasions.first.short_title).to eq "Birth of the Bab"
87
121
  end
88
122
 
89
- it 'can find the month and day for a given occasion on a given year' do
123
+ it "can find the month and day for a given occasion on a given year" do
90
124
  month_and_day = OccasionFactory.find(:birth_bab, 173)
91
- expect(month_and_day).to eq '12.18'
125
+ expect(month_and_day).to eq "12.18"
92
126
  end
93
127
  end
94
128
  end
@@ -2,18 +2,18 @@ module BahaiDate
2
2
  describe Occasion do
3
3
  subject(:occasion) do
4
4
  Occasion.new(type: :ayyam_i_ha,
5
- work_suspended: false,
6
- title: 'Test title',
7
- short_title: 'Test short title',
8
- title_html: 'Test title html',
9
- short_title_html: 'Test short title html ')
5
+ work_suspended: false,
6
+ title: "Test title",
7
+ short_title: "Test short title",
8
+ title_html: "Test title html",
9
+ short_title_html: "Test short title html ")
10
10
  end
11
11
 
12
- it 'can be created given an options hash' do
12
+ it "can be created given an options hash" do
13
13
  expect(occasion).not_to be_nil
14
14
  end
15
15
 
16
- it 'exposes a work_suspended? method' do
16
+ it "exposes a work_suspended? method" do
17
17
  expect(occasion.work_suspended?).to be false
18
18
  end
19
19
  end
@@ -0,0 +1,162 @@
1
+ require "json"
2
+
3
+ module BahaiDate
4
+ # The calendar as bahai.org renders it, ready to compare against.
5
+ module PublishedCalendar
6
+ FIXTURE = File.expand_path("../fixtures/bahai_org_calendar.json", __dir__)
7
+ DATA = JSON.parse(File.read(FIXTURE))
8
+ ERAS = DATA["eras"]
9
+
10
+ # The page's titles against the gem's occasion short titles.
11
+ OCCASIONS = {
12
+ "Naw-Rúz" => "Naw-Ruz",
13
+ "First Day of Riḍván" => "1st day of Ridvan",
14
+ "Ninth Day of Riḍván" => "9th day of Ridvan",
15
+ "Twelfth Day of Riḍván" => "12th day of Ridvan",
16
+ "Declaration of the Báb" => "Declaration of the Bab",
17
+ "Ascension of Bahá’u’lláh" => "Ascension of Baha'u'llah",
18
+ "Martyrdom of the Báb" => "Martyrdom of the Bab",
19
+ "Birth of the Báb" => "Birth of the Bab",
20
+ "Birth of Bahá’u’lláh" => "Birth of Baha'u'llah",
21
+ "Day of the Covenant" => "Day of the Covenant",
22
+ "Ascension of ‘Abdu’l-Bahá" => "Ascension of Abdu'l-Baha"
23
+ }.freeze
24
+
25
+ FAST = "Bahá’í Fast"
26
+
27
+ TWINS = ["Birth of the Báb", "Birth of Bahá’u’lláh"].freeze
28
+
29
+ def self.date(str)
30
+ Date.iso8601(str)
31
+ end
32
+
33
+ # The two days whose date depends on the new moon, not on the month layout.
34
+ def self.twin_dates(era)
35
+ TWINS.map { |title| date(era["dates"].find { |observance| observance["title"] == title }["startDate"]) }
36
+ end
37
+
38
+ # Every day of an era as [date, month number, day number], derived only from
39
+ # what the page publishes: the 19 month starts and the Ayyám-i-Há range.
40
+ def self.days(era)
41
+ starts = era["months"].map { |month| [date(month["startDate"]), month["number"]] }
42
+ ayyam_start = date(era["ayyamIHa"]["startDate"])
43
+ ayyam_end = date(era["ayyamIHa"]["endDate"])
44
+ first = starts.first.first
45
+ last = starts.last.first + 18
46
+
47
+ (first..last).map do |day|
48
+ if day.between?(ayyam_start, ayyam_end)
49
+ [day, -1, (day - ayyam_start).to_i + 1]
50
+ else
51
+ index = starts.rindex { |month_start, _| month_start <= day }
52
+ start, number = starts[index]
53
+ [day, number, (day - start).to_i + 1]
54
+ end
55
+ end
56
+ end
57
+ end
58
+
59
+ # Checks this gem against what bahai.org actually publishes.
60
+ #
61
+ # The fixture is the rendered page, collected by
62
+ # script/collect_published_calendar.js: for every year its year-selector
63
+ # offers, the start date of all 19 months, the Ayyám-i-Há range, and the holy
64
+ # days and significant dates. Re-run that script to refresh it.
65
+ describe "the published bahai.org calendar" do
66
+ it "is the page's calendar for eras 172 to 221" do
67
+ expect(PublishedCalendar::ERAS.map { |era| era["bahaiEra"] }).to eq (172..221).to_a
68
+ expect(PublishedCalendar::DATA["source"]["url"]).to eq "https://www.bahai.org/action/devotional-life/calendar"
69
+ end
70
+
71
+ it "lists 19 months and 12 dated observances for every era" do
72
+ expect(PublishedCalendar::ERAS.map { |era| era["months"].size }.uniq).to eq [19]
73
+ expect(PublishedCalendar::ERAS.map { |era| era["dates"].size }.uniq).to eq [12]
74
+ expect(PublishedCalendar::ERAS.flat_map { |era| era["dates"].map { |d| d["title"] } }.uniq.sort).to eq(
75
+ (PublishedCalendar::OCCASIONS.keys + [PublishedCalendar::FAST]).sort
76
+ )
77
+ end
78
+
79
+ it "runs the eras together, so month 19 is 19 days long throughout" do
80
+ gaps = PublishedCalendar::ERAS.each_cons(2).filter_map do |era, following|
81
+ month_19 = PublishedCalendar.date(era["months"].last["startDate"])
82
+ next_nawruz = PublishedCalendar.date(following["months"].first["startDate"])
83
+ [era["bahaiEra"], (next_nawruz - month_19).to_i] unless (next_nawruz - month_19).to_i == 19
84
+ end
85
+
86
+ expect(gaps).to be_empty, "eras whose 'Ala is not 19 days: #{gaps.inspect}"
87
+ end
88
+
89
+ PublishedCalendar::ERAS.each do |era|
90
+ era_number = era["bahaiEra"]
91
+
92
+ context "era #{era_number}" do
93
+ it "matches the published month starts, names and Ayyam-i-Ha" do
94
+ aggregate_failures do
95
+ era["months"].each do |month|
96
+ start = PublishedCalendar.date(month["startDate"])
97
+ bahai_date = BahaiDate.new(year: era_number, month: month["number"], day: 1)
98
+
99
+ expect(bahai_date.gregorian_date).to eq start
100
+ expect(BahaiDate.new(date: start).to_s).to eq "#{era_number}.#{month["number"]}.1"
101
+ expect(bahai_date.month.html.gsub(/<\/?u>/, "").unicode_normalize(:nfc)).to eq month["name"].unicode_normalize(:nfc)
102
+ end
103
+
104
+ ayyam_start = PublishedCalendar.date(era["ayyamIHa"]["startDate"])
105
+ ayyam_end = PublishedCalendar.date(era["ayyamIHa"]["endDate"])
106
+ intercalary = (ayyam_end - ayyam_start).to_i + 1
107
+
108
+ expect(Logic.leap?(era_number)).to eq(intercalary == 5)
109
+ expect(BahaiDate.new(date: ayyam_start).to_s).to eq "#{era_number}.-1.1"
110
+ expect(BahaiDate.new(date: ayyam_end).to_s).to eq "#{era_number}.-1.#{intercalary}"
111
+
112
+ twins = PublishedCalendar.twin_dates(era)
113
+ expect(Logic.twin_holy_days_date(era_number)).to eq twins.first
114
+ expect(Logic.twin_holy_days_date(era_number) + 1).to eq twins.last
115
+ end
116
+ end
117
+
118
+ it "converts every day of the era" do
119
+ wrong = PublishedCalendar.days(era).filter_map do |date, month, day|
120
+ actual = BahaiDate.new(date: date).to_s
121
+ expected = "#{era_number}.#{month}.#{day}"
122
+ [date.iso8601, expected, actual] unless actual == expected
123
+ end
124
+
125
+ expect(wrong).to be_empty, "wrong dates: #{wrong.first(5).inspect}"
126
+ end
127
+
128
+ it "converts the start of every month back to the published date" do
129
+ wrong = era["months"].filter_map do |month|
130
+ expected = PublishedCalendar.date(month["startDate"])
131
+ actual = BahaiDate.new(year: era_number, month: month["number"], day: 1).gregorian_date
132
+ ["#{era_number}.#{month["number"]}.1", expected.iso8601, actual.iso8601] unless actual == expected
133
+ end
134
+
135
+ expect(wrong).to be_empty, "wrong month starts: #{wrong.first(5).inspect}"
136
+ end
137
+ end
138
+ end
139
+
140
+ it "labels every published holy day and significant date" do
141
+ wrong = PublishedCalendar::ERAS.flat_map do |era|
142
+ era_number = era["bahaiEra"]
143
+
144
+ era["dates"].filter_map do |observance|
145
+ title = observance["title"]
146
+ start = PublishedCalendar.date(observance["startDate"])
147
+ finish = PublishedCalendar.date(observance["endDate"])
148
+
149
+ if title == PublishedCalendar::FAST
150
+ [era_number, title, start.iso8601, finish.iso8601] unless OccasionFactory.fasting_range(era_number) == (start..finish)
151
+ else
152
+ titles = BahaiDate.new(date: start).occasions.map(&:short_title)
153
+ expected = PublishedCalendar::OCCASIONS.fetch(title)
154
+ [era_number, title, start.iso8601, titles] unless titles.include?(expected)
155
+ end
156
+ end
157
+ end
158
+
159
+ expect(wrong).to be_empty, "missing observances: #{wrong.first(5).inspect}"
160
+ end
161
+ end
162
+ end
@@ -0,0 +1,23 @@
1
+ module BahaiDate
2
+ describe Sunset do
3
+ # Times from RubySunrise 0.3.3, which this module replaces.
4
+ {
5
+ Date.new(2026, 3, 20) => "14:45",
6
+ Date.new(2026, 6, 21) => "15:53",
7
+ Date.new(2026, 12, 21) => "13:24",
8
+ Date.new(2418, 3, 20) => "14:45"
9
+ }.each do |date, utc|
10
+ it "gives sunset in Tehran on #{date} at #{utc} UTC, as RubySunrise did" do
11
+ sunset = Sunset.utc(date, Logic::TEHRAN_LAT, Logic::TEHRAN_LONG)
12
+
13
+ expect(sunset.utc?).to be true
14
+ expect(sunset.to_date).to eq date
15
+ expect(sunset.strftime("%H:%M:%S")).to eq "#{utc}:00"
16
+ end
17
+ end
18
+
19
+ it "returns nil when the Sun does not set" do
20
+ expect(Sunset.utc(Date.new(2026, 6, 21), 78.2, 15.6)).to be_nil
21
+ end
22
+ end
23
+ end
@@ -1,41 +1,44 @@
1
1
  module BahaiDate
2
2
  describe Weekday do
3
- it 'can be created given a number from 1 to 7' do
3
+ it "can be created given a number from 1 to 7" do
4
4
  expect(Weekday.new(1)).to_not be_nil
5
5
  expect(Weekday.new(7)).to_not be_nil
6
6
  end
7
7
 
8
8
  it "can't be created with a number other than 1 to 7" do
9
9
  expect { Weekday.new(0) }.to raise_error(
10
- ArgumentError, "'0' is not a valid weekday. Please use 1 to 7.")
10
+ ArgumentError, "'0' is not a valid weekday. Please use 1 to 7."
11
+ )
11
12
 
12
13
  expect { Weekday.new(8) }.to raise_error(
13
- ArgumentError, "'8' is not a valid weekday. Please use 1 to 7.")
14
+ ArgumentError, "'8' is not a valid weekday. Please use 1 to 7."
15
+ )
14
16
 
15
- expect { Weekday.new('hello') }.to raise_error(
16
- ArgumentError, "'0' is not a valid weekday. Please use 1 to 7.")
17
+ expect { Weekday.new("hello") }.to raise_error(
18
+ ArgumentError, "'0' is not a valid weekday. Please use 1 to 7."
19
+ )
17
20
  end
18
21
 
19
22
  subject(:weekday) { Weekday.new(1) }
20
23
 
21
- it 'can be converted to string' do
22
- expect(weekday.to_s).to eq 'Jalal'
24
+ it "can be converted to string" do
25
+ expect(weekday.to_s).to eq "Jalal"
23
26
  end
24
27
 
25
- it 'provides access to the day number' do
28
+ it "provides access to the day number" do
26
29
  expect(weekday.number).to be 1
27
30
  end
28
31
 
29
- it 'provides access to the translated title' do
30
- expect(weekday.translation).to eq 'Glory'
32
+ it "provides access to the translated title" do
33
+ expect(weekday.translation).to eq "Glory"
31
34
  end
32
35
 
33
- it 'provides access to the title in HTML' do
34
- expect(weekday.html).to eq 'Jalál'
36
+ it "provides access to the title in HTML" do
37
+ expect(weekday.html).to eq "Jalál"
35
38
  end
36
39
 
37
- it 'provides access to the English equivalent' do
38
- expect(weekday.english_equivalent).to eq('Saturday')
40
+ it "provides access to the English equivalent" do
41
+ expect(weekday.english_equivalent).to eq("Saturday")
39
42
  end
40
43
  end
41
44
  end
@@ -2,15 +2,15 @@ module BahaiDate
2
2
  describe YearCalendar do
3
3
  subject(:year_calendar) { YearCalendar.new(1) }
4
4
 
5
- it 'can be created' do
5
+ it "can be created" do
6
6
  expect(year_calendar).not_to be_nil
7
7
  end
8
8
 
9
- it 'is an instance of year' do
9
+ it "is an instance of year" do
10
10
  expect(year_calendar).to be_a Year
11
11
  end
12
12
 
13
- it 'has months set' do
13
+ it "has months set" do
14
14
  months = year_calendar.months
15
15
  expect(months.size).to be 20
16
16
  expect(months[-1]).not_to be_nil
@@ -18,20 +18,20 @@ module BahaiDate
18
18
  expect(months[19]).not_to be_nil
19
19
  end
20
20
 
21
- it 'has days set' do
21
+ it "has days set" do
22
22
  days = year_calendar.months[1].days
23
23
  expect(days.size).to be 19
24
24
  expect(days[1]).not_to be_nil
25
25
  expect(days[19]).not_to be_nil
26
26
  end
27
27
 
28
- it 'has weekdays set' do
28
+ it "has weekdays set" do
29
29
  day = year_calendar.months[1].days[1]
30
30
  expect(day.weekday).not_to be_nil
31
31
  expect(day.weekday.number).to be 6
32
32
  end
33
33
 
34
- it 'has occasions set' do
34
+ it "has occasions set" do
35
35
  day = year_calendar.months[1].days[1]
36
36
  expect(day.occasions.size).to be 2
37
37
  end
@@ -1,49 +1,66 @@
1
1
  module BahaiDate
2
2
  describe Year do
3
- it 'can be created given a number greater than or equal to 1' do
3
+ it "can be created given a number greater than or equal to 1" do
4
4
  expect(Year.new(1)).to_not be_nil
5
5
  expect(Year.new(160)).to_not be_nil
6
6
  end
7
7
 
8
8
  it "can't be created with a number less than 1" do
9
9
  expect { Year.new(0) }.to raise_error(
10
- ArgumentError, "'0' is not a valid year. Please use a number greater than or equal to 1.")
10
+ ArgumentError, "'0' is not a valid year. Please use a number from 1 to 1157."
11
+ )
11
12
 
12
- expect { Year.new('hello') }.to raise_error(
13
- ArgumentError, "'0' is not a valid year. Please use a number greater than or equal to 1.")
13
+ expect { Year.new("hello") }.to raise_error(
14
+ ArgumentError, "'hello' is not a valid year. Please use a number from 1 to 1157."
15
+ )
16
+ end
17
+
18
+ it "can be created up to 1157, the last year that begins by the Gregorian year 3000" do
19
+ expect(Year.new(1157).bahai_era).to eq 1157
20
+ expect { Year.new(1158) }.to raise_error(ArgumentError, "'1158' is not a valid year. Please use a number from 1 to 1157.")
21
+ expect { Year.new(10**20) }.to raise_error(ArgumentError)
22
+ end
23
+
24
+ it "translates the name of every year of a Vahid" do
25
+ expect(Year::TITLES_EN.size).to eq 19
26
+ expect(Year::TITLES.size).to eq 19
27
+ expect(Year::TITLES_HTML.size).to eq 19
28
+ expect(Year.new(17).translation).to eq "Luminous"
29
+ expect(Year.new(18).translation).to eq "Most Luminous"
30
+ expect(Year.new(19).translation).to eq "Unity"
14
31
  end
15
32
 
16
33
  subject(:year) { Year.new(1) }
17
34
 
18
- it 'can be converted to string showing the B.E. number' do
19
- expect(year.to_s).to eq '1'
35
+ it "can be converted to string showing the B.E. number" do
36
+ expect(year.to_s).to eq "1"
20
37
  end
21
38
 
22
- it 'provides access to the title' do
23
- expect(year.title).to eq 'Alif'
39
+ it "provides access to the title" do
40
+ expect(year.title).to eq "Alif"
24
41
  end
25
42
 
26
- it 'provides access to the year number' do
43
+ it "provides access to the year number" do
27
44
  expect(year.number).to be 1
28
45
  end
29
46
 
30
- it 'provides access to the translated title' do
31
- expect(year.translation).to eq 'A'
47
+ it "provides access to the translated title" do
48
+ expect(year.translation).to eq "A"
32
49
  end
33
50
 
34
- it 'provides access to the title in HTML' do
35
- expect(year.html).to eq 'Alif'
51
+ it "provides access to the title in HTML" do
52
+ expect(year.html).to eq "Alif"
36
53
  end
37
54
 
38
- it 'provides access to the vahid' do
55
+ it "provides access to the vahid" do
39
56
  expect(year.vahid).to be 1
40
57
  end
41
58
 
42
- it 'provides access to the kull-i-shay' do
59
+ it "provides access to the kull-i-shay" do
43
60
  expect(year.kull_i_shay).to be 1
44
61
  end
45
62
 
46
- it 'calculates the number properly' do
63
+ it "calculates the number properly" do
47
64
  year = Year.new(1)
48
65
  expect(year.number).to eq(1)
49
66
 
@@ -60,7 +77,7 @@ module BahaiDate
60
77
  expect(year.number).to eq(1)
61
78
  end
62
79
 
63
- it 'calculates the vahid properly' do
80
+ it "calculates the vahid properly" do
64
81
  year = Year.new(1)
65
82
  expect(year.vahid).to eq(1)
66
83
 
@@ -74,7 +91,7 @@ module BahaiDate
74
91
  expect(year.vahid).to eq(1)
75
92
  end
76
93
 
77
- it 'calculates the kull-i-shay properly' do
94
+ it "calculates the kull-i-shay properly" do
78
95
  year = Year.new(1)
79
96
  expect(year.kull_i_shay).to eq(1)
80
97
 
@@ -85,13 +102,13 @@ module BahaiDate
85
102
  expect(year.kull_i_shay).to eq(2)
86
103
  end
87
104
 
88
- context 'working with a hash of months' do
89
- it 'is readable' do
105
+ context "working with a hash of months" do
106
+ it "is readable" do
90
107
  year = Year.new(1)
91
108
  expect(year.months).to eq({})
92
109
  end
93
110
 
94
- it 'can be added to' do
111
+ it "can be added to" do
95
112
  year = Year.new(1)
96
113
  year.add_month(-1)
97
114
  expect(year.months[-1].number).to be(-1)