Test suite for DE, ES and FR
This commit is contained in:
parent
c75146cdb5
commit
6cb7ccd148
8 changed files with 195 additions and 29 deletions
27
data/de.yaml
27
data/de.yaml
|
@ -1,14 +1,20 @@
|
|||
# German holiday definitions for the Ruby Holiday gem.
|
||||
#
|
||||
# Updated: 2008-11-23.
|
||||
# Updated: 2008-11-29.
|
||||
# Sources:
|
||||
# - http://en.wikipedia.org/wiki/Holidays_in_Germany
|
||||
# - http://www.timeanddate.com/calendar/index.html?country=8
|
||||
# - http://www.germany.info/relaunch/welcome/travel/holidays.html
|
||||
---
|
||||
months:
|
||||
0:
|
||||
- name: Karfreitag
|
||||
regions: [de]
|
||||
function: easter(year)-2
|
||||
- name: Ostern
|
||||
regions: [de]
|
||||
function: easter(year)
|
||||
type: informal
|
||||
- name: Ostermontag
|
||||
regions: [de]
|
||||
function: easter(year)+1
|
||||
|
@ -37,7 +43,7 @@ months:
|
|||
mday: 8
|
||||
8:
|
||||
- name: Mariä Himmelfahrt
|
||||
regions: [de_by]
|
||||
regions: [de_by, de_sl]
|
||||
mday: 15
|
||||
10:
|
||||
- name: Tag der Deutschen Einheit
|
||||
|
@ -50,10 +56,25 @@ months:
|
|||
- name: Allerheiligen
|
||||
regions: [de_bw, de_by, de_nw, de_rp, de_sl]
|
||||
mday: 1
|
||||
- name: Buß- und Bettag
|
||||
regions: [de_by, de_sn]
|
||||
function: de_buss_und_bettag(year)
|
||||
12:
|
||||
- name: 1. Weihnachtstag
|
||||
regions: [de]
|
||||
mday: 25
|
||||
- name: 2. Weihnachtstag
|
||||
regions: [de]
|
||||
mday: 25
|
||||
mday: 26
|
||||
methods:
|
||||
de_buss_und_bettag: |
|
||||
# Germany: Wednesday before November 23
|
||||
def self.de_buss_und_bettag(year)
|
||||
date = Date.civil(year,11,23)
|
||||
if date.wday > 3
|
||||
date -= (date.wday - 3)
|
||||
else
|
||||
date -= (date.wday + 4)
|
||||
end
|
||||
date
|
||||
end
|
|
@ -1,8 +1,12 @@
|
|||
# Spanish holiday definitions for the Ruby Holiday gem.
|
||||
#
|
||||
# Updated: 2008-11-22.
|
||||
# Including the Balearic Islands and the Canary Islands.
|
||||
#
|
||||
# Updated: 2008-11-29.
|
||||
#
|
||||
# Sources:
|
||||
# - http://en.wikipedia.org/wiki/Public_holidays_in_Spain
|
||||
# - http://www.timeanddate.com/calendar/index.html?country=16
|
||||
#
|
||||
# Notes:
|
||||
# - Valencia is encoded as both es_v and es_vc
|
||||
|
|
|
@ -1,17 +1,21 @@
|
|||
# French holiday definitions for the Ruby Holiday gem.
|
||||
#
|
||||
# Updated: 2008-11-22.
|
||||
# Updated: 2008-11-2*.
|
||||
# Sources:
|
||||
# - http://en.wikipedia.org/wiki/Holidays_in_France
|
||||
# - http://riviera.angloinfo.com/information/1/pub_hols.asp
|
||||
---
|
||||
months:
|
||||
0:
|
||||
- name: Pâques
|
||||
regions: [fr]
|
||||
function: easter(year)
|
||||
- name: Lundi de Pâques
|
||||
regions: [fr]
|
||||
function: easter(year)+1
|
||||
- name: Ascension
|
||||
regions: [fr]
|
||||
function: easter(year)+40
|
||||
function: easter(year)+39
|
||||
- name: Pentecôte
|
||||
regions: [fr]
|
||||
function: easter(year)+49
|
||||
|
|
|
@ -11,27 +11,40 @@ module Holidays
|
|||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module DE # :nodoc:
|
||||
DEFINED_REGIONS = [:de, :de_bw, :de_by, :de_nw, :de_rp, :de_sl, :de_he, :de_sn, :de_th, :de_bb, :de_mv, :de_st]
|
||||
DEFINED_REGIONS = [:de, :de_bw, :de_by, :de_nw, :de_rp, :de_sl, :de_sn, :de_he, :de_th, :de_bb, :de_mv, :de_st]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 1, :name => "Tag der Arbeit", :regions => [:de]},
|
||||
{:mday => 8, :name => "Victoire 1945", :regions => [:de]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Karfreitag", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :type => :informal, :name => "Ostern", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Ostermontag", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Christi Himmelfahrt", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pfingstmontag", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Fronleichnam", :regions => [:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn, :de_th]}],
|
||||
11 => [{:mday => 1, :name => "Allerheiligen", :regions => [:de_bw, :de_by, :de_nw, :de_rp, :de_sl]}],
|
||||
11 => [{:mday => 1, :name => "Allerheiligen", :regions => [:de_bw, :de_by, :de_nw, :de_rp, :de_sl]},
|
||||
{:function => lambda { |year| Holidays.de_buss_und_bettag(year) }, :function_id => "de_buss_und_bettag(year)", :name => "Buß- und Bettag", :regions => [:de_by, :de_sn]}],
|
||||
1 => [{:mday => 1, :name => "Neujahrstag", :regions => [:de]},
|
||||
{:mday => 6, :name => "Heilige Drei Könige", :regions => [:de_bw, :de_by]}],
|
||||
12 => [{:mday => 25, :name => "1. Weihnachtstag", :regions => [:de]},
|
||||
{:mday => 25, :name => "2. Weihnachtstag", :regions => [:de]}],
|
||||
8 => [{:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:de_by]}],
|
||||
{:mday => 26, :name => "2. Weihnachtstag", :regions => [:de]}],
|
||||
8 => [{:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:de_by, :de_sl]}],
|
||||
10 => [{:mday => 3, :name => "Tag der Deutschen Einheit", :regions => [:de]},
|
||||
{:mday => 31, :name => "Reformationstag", :regions => [:de_bb, :de_mv, :de_sn, :de_st, :de_th]}]
|
||||
}
|
||||
end
|
||||
|
||||
# Germany: Wednesday before November 23
|
||||
def self.de_buss_und_bettag(year)
|
||||
date = Date.civil(year,11,23)
|
||||
if date.wday > 3
|
||||
date -= (date.wday - 3)
|
||||
else
|
||||
date -= (date.wday + 4)
|
||||
end
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ module Holidays
|
|||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module EUROPE # :nodoc:
|
||||
DEFINED_REGIONS = [:dk, :is, :de, :fr, :de_bw, :de_by, :de_nw, :de_rp, :de_sl, :de_he, :de_sn, :de_th, :de_bb, :de_mv, :de_st, :es, :es_m, :es_cn, :es_cm, :es_pv, :es_ct, :es_na, :es_v, :es_vc, :es_mu, :es_lo, :es_ib, :es_ga, :es_an, :es_ce, :es_o, :es_ex, :es_ar, :es_cl, :gb, :ie, :je, :gb_jsy, :gg, :gb_gsy, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_sct, :im, :gb_iom, :gb_con, :it, :nl, :pt, :se]
|
||||
DEFINED_REGIONS = [:dk, :is, :de, :fr, :de_bw, :de_by, :de_nw, :de_rp, :de_sl, :de_sn, :de_he, :de_th, :de_bb, :de_mv, :de_st, :es, :es_m, :es_cn, :es_cm, :es_pv, :es_ct, :es_na, :es_v, :es_vc, :es_mu, :es_lo, :es_ib, :es_ga, :es_an, :es_ce, :es_o, :es_ex, :es_ar, :es_cl, :gb, :ie, :je, :gb_jsy, :gg, :gb_gsy, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_sct, :im, :gb_iom, :gb_con, :it, :nl, :pt, :se]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
|
||||
|
@ -44,6 +44,7 @@ module Holidays
|
|||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "2. Pinsedag", :regions => [:dk, :is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pinsedag", :regions => [:dk, :is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Karfreitag", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :type => :informal, :name => "Ostern", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Ostermontag", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Christi Himmelfahrt", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pfingstmontag", :regions => [:de]},
|
||||
|
@ -52,7 +53,8 @@ module Holidays
|
|||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Viernes Santo", :regions => [:es]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lunes de Pascua", :regions => [:es_pv, :es_ct, :es_na, :es_v, :es_vc]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pâques", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+40 }, :function_id => "easter(year)+40", :name => "Ascension", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lundi de Pâques", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Ascension", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pentecôte", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Lundi de Pentecôte", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:gb]},
|
||||
|
@ -86,6 +88,7 @@ module Holidays
|
|||
{:function => lambda { |year| Holidays.se_alla_helgons_dag(year) }, :function_id => "se_alla_helgons_dag(year)", :name => "Alla helgons dag", :regions => [:se]}],
|
||||
11 => [{:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]},
|
||||
{:mday => 1, :name => "Allerheiligen", :regions => [:de_bw, :de_by, :de_nw, :de_rp, :de_sl]},
|
||||
{:function => lambda { |year| Holidays.de_buss_und_bettag(year) }, :function_id => "de_buss_und_bettag(year)", :name => "Buß- und Bettag", :regions => [:de_by, :de_sn]},
|
||||
{:mday => 1, :name => "Todos los Santos", :regions => [:es]},
|
||||
{:mday => 1, :name => "Toussaint", :regions => [:fr]},
|
||||
{:mday => 11, :name => "Armistice 1918", :regions => [:fr]},
|
||||
|
@ -125,7 +128,7 @@ module Holidays
|
|||
{:mday => 25, :name => "1. juledag", :regions => [:dk]},
|
||||
{:mday => 26, :name => "2. juledag", :regions => [:dk]},
|
||||
{:mday => 25, :name => "1. Weihnachtstag", :regions => [:de]},
|
||||
{:mday => 25, :name => "2. Weihnachtstag", :regions => [:de]},
|
||||
{:mday => 26, :name => "2. Weihnachtstag", :regions => [:de]},
|
||||
{:mday => 6, :name => "Día de la Constitución", :regions => [:es]},
|
||||
{:mday => 8, :name => "Inmaculada Concepción", :regions => [:es]},
|
||||
{:mday => 25, :name => "Navidad del Señor", :regions => [:es]},
|
||||
|
@ -155,7 +158,7 @@ module Holidays
|
|||
{:mday => 12, :name => "Battle of the Boyne", :regions => [:gb_nir]}],
|
||||
2 => [{:mday => 28, :name => "Día de Andalucía", :regions => [:es_an]},
|
||||
{:mday => 18, :type => :informal, :name => "Konudagur", :regions => [:is]}],
|
||||
8 => [{:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:de_by]},
|
||||
8 => [{:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:de_by, :de_sl]},
|
||||
{:mday => 15, :name => "Asunción", :regions => [:es]},
|
||||
{:mday => 15, :name => "Assomption", :regions => [:fr]},
|
||||
{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:gb_sct, :ie]},
|
||||
|
@ -188,6 +191,17 @@ module Holidays
|
|||
}
|
||||
end
|
||||
|
||||
# Germany: Wednesday before November 23
|
||||
def self.de_buss_und_bettag(year)
|
||||
date = Date.civil(year,11,23)
|
||||
if date.wday > 3
|
||||
date -= (date.wday - 3)
|
||||
else
|
||||
date -= (date.wday + 4)
|
||||
end
|
||||
date
|
||||
end
|
||||
|
||||
# Iceland: first day of summer (Thursday after 18 April)
|
||||
def self.is_sumardagurinn_fyrsti(year)
|
||||
date = Date.civil(year,4,18)
|
||||
|
|
|
@ -17,7 +17,8 @@ module Holidays
|
|||
5 => [{:mday => 1, :name => "Fête du travail", :regions => [:fr]},
|
||||
{:mday => 8, :name => "Victoire 1945", :regions => [:fr]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pâques", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+40 }, :function_id => "easter(year)+40", :name => "Ascension", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lundi de Pâques", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Ascension", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pentecôte", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Lundi de Pentecôte", :regions => [:fr]}],
|
||||
11 => [{:mday => 1, :name => "Toussaint", :regions => [:fr]},
|
||||
|
|
|
@ -123,7 +123,10 @@ spec = Gem::Specification.new do |s|
|
|||
A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!
|
||||
EOF
|
||||
s.summary = 'A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!'
|
||||
s.files = FileList["{lib}/**/*"].to_a
|
||||
s.files = FileList["{lib}/**/*", "{data}/**/*", "bin/*"].to_a
|
||||
s.bindir = 'bin'
|
||||
s.executables = ["build_holiday_defs"]
|
||||
s.default_executable = %q{build_holiday_defs}
|
||||
s.test_files = Dir.glob('test/test_*.rb')
|
||||
s.has_rdoc = true
|
||||
s.extra_rdoc_files = ['README', 'lib/holidays/MANIFEST', 'CUSTOM DATES', 'REFERENCES', 'LICENSE']
|
||||
|
|
|
@ -2,22 +2,112 @@ require File.dirname(__FILE__) + '/test_helper'
|
|||
require 'holidays/europe'
|
||||
|
||||
class RegionTests < Test::Unit::TestCase
|
||||
def test_nl
|
||||
{Date.civil(2008,1,1) => 'Nieuwjaar',
|
||||
Date.civil(2008,3,21) => 'Goede Vrijdag',
|
||||
Date.civil(2008,3,23) => 'Pasen',
|
||||
Date.civil(2008,3,24) => 'Pasen',
|
||||
Date.civil(2008,4,30) => 'Koninginnedag',
|
||||
Date.civil(2008,5,1) => 'Hemelvaartsdag', # Ascension, Easter+39
|
||||
Date.civil(2008,5,5) => 'Bevrijdingsdag',
|
||||
Date.civil(2008,5,11) => 'Pinksteren', # Pentecost, Easter+49
|
||||
Date.civil(2008,5,12) => 'Pinksteren', # Pentecost, Easter+50
|
||||
Date.civil(2008,12,25) => 'Kerstmis',
|
||||
Date.civil(2008,12,26) => 'Kerstmis'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :nl)[0][:name]
|
||||
def test_de
|
||||
{Date.civil(2009,1,1) => 'Neujahrstag',
|
||||
Date.civil(2009,4,10) => 'Karfreitag',
|
||||
Date.civil(2009,4,12) => 'Ostern',
|
||||
Date.civil(2009,4,13) => 'Ostermontag',
|
||||
Date.civil(2009,5,1) => 'Tag der Arbeit',
|
||||
Date.civil(2009,5,21) => 'Christi Himmelfahrt',
|
||||
Date.civil(2009,6,1) => 'Pfingstmontag',
|
||||
Date.civil(2009,10,3) => 'Tag der Deutschen Einheit',
|
||||
Date.civil(2009,12,25) => '1. Weihnachtstag',
|
||||
Date.civil(2009,12,26) => '2. Weihnachtstag'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :de)[0][:name]
|
||||
end
|
||||
|
||||
[:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn, :de_th, :de_].each do |r|
|
||||
assert_equal 'Fronleichnam', Date.civil(2009,6,11).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:de_by, :de_sl, :de_].each do |r|
|
||||
assert_equal 'Mariä Himmelfahrt', Date.civil(2009,8,15).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:de_bb, :de_mv, :de_sn, :de_st, :de_th, :de_].each do |r|
|
||||
assert_equal 'Reformationstag', Date.civil(2009,10,31).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:de_bw, :de_by, :de_nw, :de_rp, :de_sl, :de_].each do |r|
|
||||
assert_equal 'Allerheiligen', Date.civil(2009,11,1).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
# Repentance Day
|
||||
assert_equal 'Buß- und Bettag', Date.civil(2004,11,17).holidays(:de_sn)[0][:name]
|
||||
assert_equal 'Buß- und Bettag', Date.civil(2005,11,16).holidays(:de_sn)[0][:name]
|
||||
assert_equal 'Buß- und Bettag', Date.civil(2006,11,22).holidays(:de_sn)[0][:name]
|
||||
assert_equal 'Buß- und Bettag', Date.civil(2009,11,18).holidays(:de_sn)[0][:name]
|
||||
end
|
||||
|
||||
|
||||
def test_es
|
||||
{Date.civil(2009,1,1) => 'Año Nuevo',
|
||||
Date.civil(2009,1,6) => 'Día de Reyes',
|
||||
Date.civil(2009,4,10) => 'Viernes Santo',
|
||||
Date.civil(2009,5,1) => 'Día del Trabajador',
|
||||
Date.civil(2009,8,15) => 'Asunción',
|
||||
Date.civil(2009,10,12) => 'Día de la Hispanidad',
|
||||
Date.civil(2009,11,1) => 'Todos los Santos',
|
||||
Date.civil(2009,12,6) => 'Día de la Constitución',
|
||||
Date.civil(2009,12,8) => 'Inmaculada Concepción',
|
||||
Date.civil(2009,12,25) => 'Navidad del Señor'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :es)[0][:name]
|
||||
end
|
||||
|
||||
[:es_pv, :es_ct, :es_na, :es_v, :es_vc, :es_].each do |r|
|
||||
assert_equal 'Jueves Santo', Date.civil(2009,4,9).holidays(r)[0][:name]
|
||||
assert_equal 'Lunes de Pascua', Date.civil(2009,4,13).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:es_v, :es_vc, :es_cm, :es_mu, :es_m, :es_].each do |r|
|
||||
assert_equal 'San José', Date.civil(2009,3,19).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:es_ar, :es_cl, :es_].each do |r|
|
||||
assert_equal 'San Jorge', Date.civil(2009,4,23).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:es_vc, :es_v, :es_].each do |r|
|
||||
assert_equal 'Día de Valencia', Date.civil(2009,10,9).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:es_ib, :es_ct, :es_].each do |r|
|
||||
assert_equal 'San Esteban', Date.civil(2009,12,26).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
assert_equal 'Día de Andalucía', Date.civil(2009,2,28).holidays(:es_an)[0][:name]
|
||||
assert_equal 'Día de las Islas Baleares', Date.civil(2009,3,1).holidays(:es_ib)[0][:name]
|
||||
assert_equal 'Fiesta de la Comunidad', Date.civil(2006,5,2).holidays(:es_m)[0][:name]
|
||||
assert_equal 'Día de las Canarias', Date.civil(2006,5,30).holidays(:es_cn)[0][:name]
|
||||
assert_equal 'Día de la Región Castilla-La Mancha', Date.civil(2009,5,31).holidays(:es_cm)[0][:name]
|
||||
assert_equal 'Día de la Región de Murcia', Date.civil(2009,6,9).holidays(:es_mu)[0][:name]
|
||||
assert_equal 'Día de La Rioja', Date.civil(2009,6,9).holidays(:es_lo)[0][:name]
|
||||
assert_equal 'Santiago Apostol', Date.civil(2009,7,23).holidays(:es_ga)[0][:name]
|
||||
assert_equal 'Día de Ceuta', Date.civil(2009,9,2).holidays(:es_ce)[0][:name]
|
||||
assert_equal 'Día de Asturias', Date.civil(2009,9,8).holidays(:es_o)[0][:name]
|
||||
assert_equal 'Día de Extremadura', Date.civil(2009,9,8).holidays(:es_ex)[0][:name]
|
||||
assert_equal 'Fiesta Nacional de Cataluña', Date.civil(2009,9,11).holidays(:es_ct)[0][:name]
|
||||
end
|
||||
|
||||
def test_fr
|
||||
{Date.civil(2007,1,1) => 'Jour de l\'an',
|
||||
Date.civil(2007,4,8) => 'Pâques',
|
||||
Date.civil(2007,4,9) => 'Lundi de Pâques',
|
||||
Date.civil(2007,5,1) => 'Fête du travail',
|
||||
Date.civil(2007,5,8) => 'Victoire 1945',
|
||||
Date.civil(2007,5,17) => 'Ascension',
|
||||
Date.civil(2007,5,27) => 'Pentecôte',
|
||||
Date.civil(2007,5,28) => 'Lundi de Pentecôte',
|
||||
Date.civil(2007,7,14) => 'Fête nationale',
|
||||
Date.civil(2007,8,15) => 'Assomption',
|
||||
Date.civil(2007,11,1) => 'Toussaint',
|
||||
Date.civil(2007,11,11) => 'Armistice 1918',
|
||||
Date.civil(2007,12,25) => 'Nöel'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :fr)[0][:name]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_gb
|
||||
# Holidays.between(Date.civil(2008,1,1),Date.civil(2008,12,1),:gb_).each do |h|
|
||||
# puts "#{h[:name]} on #{h[:date]}"
|
||||
|
@ -73,6 +163,22 @@ class RegionTests < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_nl
|
||||
{Date.civil(2008,1,1) => 'Nieuwjaar',
|
||||
Date.civil(2008,3,21) => 'Goede Vrijdag',
|
||||
Date.civil(2008,3,23) => 'Pasen',
|
||||
Date.civil(2008,3,24) => 'Pasen',
|
||||
Date.civil(2008,4,30) => 'Koninginnedag',
|
||||
Date.civil(2008,5,1) => 'Hemelvaartsdag', # Ascension, Easter+39
|
||||
Date.civil(2008,5,5) => 'Bevrijdingsdag',
|
||||
Date.civil(2008,5,11) => 'Pinksteren', # Pentecost, Easter+49
|
||||
Date.civil(2008,5,12) => 'Pinksteren', # Pentecost, Easter+50
|
||||
Date.civil(2008,12,25) => 'Kerstmis',
|
||||
Date.civil(2008,12,26) => 'Kerstmis'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :nl)[0][:name]
|
||||
end
|
||||
end
|
||||
|
||||
def test_pt
|
||||
{Date.civil(2008,1,1) => 'Ano Novo',
|
||||
Date.civil(2005,2,8) => 'Carnaval',
|
||||
|
|
Loading…
Reference in a new issue