|
21 | 21 |
|
22 | 22 | it 'Google calendar result should have date of holidays_detailed.yml' do |
23 | 23 | @span.each do |date| |
| 24 | + next if date[0] == Date.new(2019, 10, 22) |
24 | 25 | expect(@google_calendar.holiday?(date[0])).to eq true |
25 | 26 | end |
26 | 27 | end |
27 | 28 |
|
28 | 29 | it 'holidays_detailed.yml shoud have date of Google calendar' do |
29 | 30 | @gholidays.each do |date, name| |
30 | 31 | expect(@holidays_detailed.key?(date)).to eq true |
31 | | - expect(@holidays_detailed[date]['name']).to eq name |
| 32 | + expect(@holidays_detailed[date]['name']).to eq(name).or eq('休日').or eq('休日(祝日扱い)') |
32 | 33 | end |
33 | 34 | end |
34 | 35 |
|
|
39 | 40 | expect(@holidays_detailed.key?(Date::parse('2041-08-12'))).to eq true |
40 | 41 | expect(@holidays_detailed.key?(Date::parse('2047-08-12'))).to eq true |
41 | 42 | end |
| 43 | +end |
| 44 | + |
| 45 | +context 'Emperor\'s Birthday' do |
| 46 | + before do |
| 47 | + @holidays_detailed = YAML.load_file(File.expand_path('../../holidays_detailed.yml', __FILE__)) |
| 48 | + end |
| 49 | + |
| 50 | + it 'holidays_detail.yml should have holiday in Showa Emperor\'s Birthday' do |
| 51 | + 1970.upto(1988) do |year| |
| 52 | + expect(@holidays_detailed.key?(Date.new(year, 4, 29))).to eq true |
| 53 | + end |
| 54 | + end |
| 55 | + |
| 56 | + it 'holidays_detail.yml should have holiday in Heisei Emperor\'s Birthday' do |
| 57 | + 1989.upto(2018) do |year| |
| 58 | + expect(@holidays_detailed.key?(Date.new(year, 12, 23))).to eq true |
| 59 | + end |
| 60 | + end |
| 61 | + |
| 62 | + it 'holidays_detail.yml should have no holiday in 2019 Emperor\'s Birthday' do |
| 63 | + expect(@holidays_detailed.key?(Date.new(2019, 2, 23))).to eq false |
| 64 | + expect(@holidays_detailed.key?(Date.new(2019, 12, 23))).to eq false |
| 65 | + end |
| 66 | + |
| 67 | + it 'holidays_detail.yml should have holiday in New Emperor\'s Birthday' do |
| 68 | + 2020.upto(2050) do |year| |
| 69 | + expect(@holidays_detailed.key?(Date.new(year, 2, 23))).to eq true |
| 70 | + end |
| 71 | + end |
| 72 | +end |
| 73 | + |
| 74 | +context 'Holiday in lieu' do |
| 75 | + before do |
| 76 | + @holidays_detailed = YAML.load_file(File.expand_path('../../holidays_detailed.yml', __FILE__)) |
| 77 | + end |
| 78 | + |
| 79 | + it 'If holiday is Sunday, Holiday in lieu should exist. (>= 1973.4.30)' do |
| 80 | + @holidays_detailed.each do |date, detail| |
| 81 | + if date >= Date.new(1973, 4, 30) && date.wday == 0 && !detail['name'].match(/振替休日/) |
| 82 | + expect(@holidays_detailed.key?(date + 1)).to eq true |
| 83 | + end |
| 84 | + end |
| 85 | + end |
| 86 | +end |
| 87 | + |
| 88 | +context 'Tokyo Olympic' do |
| 89 | + before do |
| 90 | + @holidays_detailed = YAML.load_file(File.expand_path('../../holidays_detailed.yml', __FILE__)) |
| 91 | + end |
| 92 | + |
| 93 | + it 'If tokyo olympic year, 海の日 should be moved' do |
| 94 | + expect(@holidays_detailed.key?(Date::parse('2020-07-20'))).to eq false |
| 95 | + expect(@holidays_detailed.key?(Date::parse('2020-07-23'))).to eq true |
| 96 | + end |
| 97 | + |
| 98 | + it 'If tokyo olympic year, 山の日 should be moved' do |
| 99 | + expect(@holidays_detailed.key?(Date::parse('2020-08-11'))).to eq false |
| 100 | + expect(@holidays_detailed.key?(Date::parse('2020-08-10'))).to eq true |
| 101 | + end |
| 102 | + |
| 103 | + it 'If tokyo olympic year, 体育の日 should be moved' do |
| 104 | + expect(@holidays_detailed.key?(Date::parse('2020-10-12'))).to eq false |
| 105 | + expect(@holidays_detailed.key?(Date::parse('2020-07-24'))).to eq true |
| 106 | + end |
| 107 | +end |
| 108 | + |
| 109 | +context 'Coronation Day / 天皇の即位の日及び即位礼正殿の儀の行われる日を休日とする法律' do |
| 110 | + before do |
| 111 | + @holidays_detailed = YAML.load_file(File.expand_path('../../holidays_detailed.yml', __FILE__)) |
| 112 | + end |
| 113 | + it '天皇の即位の日の平成31年(2019年)5月1日及び即位礼正殿の儀が行われる日の平成31年(2019年)10月22日は、休日となります' do |
| 114 | + expect(@holidays_detailed.key?(Date::parse('2019-05-01'))).to eq true |
| 115 | + expect(@holidays_detailed.key?(Date::parse('2019-10-22'))).to eq true |
| 116 | + end |
| 117 | + it 'また、これらの休日は国民の祝日扱いとなるため、平成31年(2019年)4月30日と5月2日も休日となります' do |
| 118 | + expect(@holidays_detailed.key?(Date::parse('2019-04-30'))).to eq true |
| 119 | + expect(@holidays_detailed.key?(Date::parse('2019-05-02'))).to eq true |
| 120 | + end |
| 121 | +end |
| 122 | + |
| 123 | +context 'holiday.yml' do |
| 124 | + before do |
| 125 | + @holidays_detailed = YAML.load_file(File.expand_path('../../holidays_detailed.yml', __FILE__)) |
| 126 | + end |
42 | 127 |
|
43 | | - it 'holidays_detailed.yml should have date of holiday.yml' do |
| 128 | + it 'holidays_detailed.yml should have date of holiday.yml and holiday.yml should have of holiday_detail.yml' do |
44 | 129 | holidays = YAML.load_file(File.expand_path('../../holidays.yml', __FILE__)) |
45 | 130 | holidays.each do |date, name| |
46 | 131 | expect(@holidays_detailed.key?(date)).to eq true |
|
0 commit comments