calendarium-romanum 0.2.0 → 0.2.1
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.
- checksums.yaml +4 -4
- data/lib/calendarium-romanum/abstract_date.rb +5 -1
- data/lib/calendarium-romanum/version.rb +1 -1
- data/spec/abstract_date_spec.rb +17 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b9480b0f651cac34e75c9b46bcf5d1be6cd6cd82
|
|
4
|
+
data.tar.gz: 6bc42d50fd376ab9ad14a75e9396f9b84a87c6a5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 273cfd23765b4c7c36b41350cf0fa6330b97cd7e40ca5b8d07698afa6ae10577e1a87724e481473d5bd50a13235217183c5d53df7afb01d357046d6cb6182775
|
|
7
|
+
data.tar.gz: f3d83d90c16d03a210d006385cf30472cb981b8c3bdf5b466f2492085357d82efb47ef560625a34f2e5ab63f72eb775ba6ee71fda182d5d3ec57c66df2dc8782
|
|
@@ -10,6 +10,10 @@ module CalendariumRomanum
|
|
|
10
10
|
@day = day
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
+
def self.from_date(date)
|
|
14
|
+
new(date.month, date.day)
|
|
15
|
+
end
|
|
16
|
+
|
|
13
17
|
attr_reader :month, :day
|
|
14
18
|
|
|
15
19
|
def <=>(other)
|
|
@@ -41,7 +45,7 @@ module CalendariumRomanum
|
|
|
41
45
|
|
|
42
46
|
day_lte = case month
|
|
43
47
|
when 2
|
|
44
|
-
|
|
48
|
+
29
|
|
45
49
|
when 1, 3, 5, 7, 8, 10, 12
|
|
46
50
|
31
|
|
47
51
|
else
|
data/spec/abstract_date_spec.rb
CHANGED
|
@@ -25,6 +25,23 @@ describe CR::AbstractDate do
|
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
+
# test .new through .from_date on a complete leap year
|
|
29
|
+
describe '.from_date' do
|
|
30
|
+
YEAR = 2000
|
|
31
|
+
|
|
32
|
+
it 'the test year is leap' do
|
|
33
|
+
expect(Date.new(YEAR)).to be_leap
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
CR::Util::Year.new(YEAR).each do |date|
|
|
37
|
+
it date.to_s do
|
|
38
|
+
expect do
|
|
39
|
+
AD.from_date date
|
|
40
|
+
end.not_to raise_exception
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
28
45
|
describe '#<' do
|
|
29
46
|
it { expect(AD.new(1, 1)).to be < AD.new(1, 2) }
|
|
30
47
|
it { expect(AD.new(1, 1)).to be < AD.new(2, 1) }
|