From 18080f6eb6722b0f9915a5da76744afc3a43de4f Mon Sep 17 00:00:00 2001 From: Alex Dunae Date: Wed, 19 Dec 2007 22:25:56 +0000 Subject: [PATCH] Updated docs --- README | 4 +- lib/holidays.rb | 1 + rakefile.rb | 9 +- test/defs/test_defs_au.rb | 36 ++++ test/defs/test_defs_ca.rb | 29 ++++ test/defs/test_defs_de.rb | 46 +++++ test/defs/test_defs_dk.rb | 30 ++++ test/defs/test_defs_es.rb | 57 +++++++ test/defs/test_defs_europe.rb | 240 +++++++++++++++++++++++++++ test/defs/test_defs_fr.rb | 26 +++ test/defs/test_defs_gb.rb | 36 ++++ test/defs/test_defs_ie.rb | 21 +++ test/defs/test_defs_is.rb | 33 ++++ test/defs/test_defs_it.rb | 25 +++ test/defs/test_defs_mx.rb | 22 +++ test/defs/test_defs_nl.rb | 24 +++ test/defs/test_defs_north_america.rb | 54 ++++++ test/defs/test_defs_pt.rb | 32 ++++ test/defs/test_defs_scandinavia.rb | 75 +++++++++ test/defs/test_defs_se.rb | 32 ++++ test/defs/test_defs_us.rb | 36 ++++ test/defs/test_defs_za.rb | 25 +++ 22 files changed, 885 insertions(+), 8 deletions(-) create mode 100644 test/defs/test_defs_au.rb create mode 100644 test/defs/test_defs_ca.rb create mode 100644 test/defs/test_defs_de.rb create mode 100644 test/defs/test_defs_dk.rb create mode 100644 test/defs/test_defs_es.rb create mode 100644 test/defs/test_defs_europe.rb create mode 100644 test/defs/test_defs_fr.rb create mode 100644 test/defs/test_defs_gb.rb create mode 100644 test/defs/test_defs_ie.rb create mode 100644 test/defs/test_defs_is.rb create mode 100644 test/defs/test_defs_it.rb create mode 100644 test/defs/test_defs_mx.rb create mode 100644 test/defs/test_defs_nl.rb create mode 100644 test/defs/test_defs_north_america.rb create mode 100644 test/defs/test_defs_pt.rb create mode 100644 test/defs/test_defs_scandinavia.rb create mode 100644 test/defs/test_defs_se.rb create mode 100644 test/defs/test_defs_us.rb create mode 100644 test/defs/test_defs_za.rb diff --git a/README b/README index 8b95a19..c8d8acd 100644 --- a/README +++ b/README @@ -21,13 +21,13 @@ For more information, see the notes at the top of the Holidays module. Get all holidays on April 25, 2008 in Australia. date = Date.civil(2008,4,25) - Holidays.by_day(date, :au) + Holidays.on(date, :au) => [{:name => 'ANZAC Day',...}] Get holidays that are observed on July 2, 2007 in British Columbia, Canada. date = Date.civil(2007,7,2) - Holidays.by_day(date, :ca_bc, :observed) + Holidays.on(date, :ca_bc, :observed) => [{:name => 'Canada Day',...}] Get all holidays in July, 2008 in Canada and the US. diff --git a/lib/holidays.rb b/lib/holidays.rb index b5cdc93..7491a7c 100644 --- a/lib/holidays.rb +++ b/lib/holidays.rb @@ -1,6 +1,7 @@ $:.unshift File.dirname(__FILE__) require 'digest/md5' +require 'date' # == Region options # Holidays can be defined as belonging to one or more regions and sub regions. diff --git a/rakefile.rb b/rakefile.rb index 498cea7..026f622 100644 --- a/rakefile.rb +++ b/rakefile.rb @@ -53,13 +53,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}/**/*", "{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.files = FileList["{lib}/**/*", "{data}/**/*"].to_a + s.test_files = FileList['test/defs/test*.rb'].exclude('test_helper.rb') s.has_rdoc = true - s.extra_rdoc_files = ['README', 'lib/holidays/MANIFEST', 'CUSTOM DATES', 'REFERENCES', 'LICENSE'] + s.extra_rdoc_files = ['README', 'data/SYNTAX', 'lib/holidays/MANIFEST', 'REFERENCES', 'LICENSE'] s.rdoc_options << '--all' << '--inline-source' << '--line-numbers' << '--charset' << 'utf-8' end diff --git a/test/defs/test_defs_au.rb b/test/defs/test_defs_au.rb new file mode 100644 index 0000000..3152724 --- /dev/null +++ b/test/defs/test_defs_au.rb @@ -0,0 +1,36 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'holidays/au' + +# This file is generated by the Ruby Holiday gem. +# +# Definitions loaded: data/au.yaml +class AuDefinitionTests < Test::Unit::TestCase # :nodoc: + + def test_au +{Date.civil(2007,1,1) => 'New Year\'s Day', + Date.civil(2007,1,26) => 'Australia Day', + Date.civil(2007,4,6) => 'Good Friday', + Date.civil(2007,4,9) => 'Easter Monday', + Date.civil(2007,4,25) => 'ANZAC Day', + Date.civil(2007,12,25) => 'Christmas Day', + Date.civil(2007,12,26) => 'Boxing Day'}.each do |date, name| + assert_equal name, Holidays.on(date, :au, :informal)[0][:name] +end + +[:au_sa, :au_act, :au_nsw, :au_].each do |r| + assert_equal 'Labour Day', Date.civil(2007,10,1).holidays(r)[0][:name] +end + +[:au_sa, :au_act, :au_nsw, :au_vic, :au_tas, :au_qld, :au_nt, :au_].each do |r| + assert_equal 'Queen\'s Birthday', Date.civil(2007,6,11).holidays(r)[0][:name] +end + +assert_equal 'Labour Day', Date.civil(2007,3,5).holidays(:au_wa)[0][:name] +assert_equal 'Labour Day', Date.civil(2007,3,12).holidays(:au_vic)[0][:name] +assert_equal 'Labour Day', Date.civil(2007,5,7).holidays(:au_qld)[0][:name] + +assert_equal 'May Day', Date.civil(2007,5,7).holidays(:au_nt)[0][:name] + +assert_equal 'Eight Hours Day', Date.civil(2007,3,12).holidays(:au_tas)[0][:name] + end +end diff --git a/test/defs/test_defs_ca.rb b/test/defs/test_defs_ca.rb new file mode 100644 index 0000000..050bee0 --- /dev/null +++ b/test/defs/test_defs_ca.rb @@ -0,0 +1,29 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'holidays/ca' + +# This file is generated by the Ruby Holiday gem. +# +# Definitions loaded: data/ca.yaml, data/north_america_informal.yaml +class CaDefinitionTests < Test::Unit::TestCase # :nodoc: + + def test_ca +{Date.civil(2008,1,1) => 'New Year\'s Day', + Date.civil(2008,3,21) => 'Good Friday', + Date.civil(2008,3,24) => 'Easter Monday', + Date.civil(2008,5,19) => 'Victoria Day', + Date.civil(2008,7,1) => 'Canada Day', + Date.civil(2008,9,1) => 'Labour Day', + Date.civil(2008,10,13) => 'Thanksgiving', + Date.civil(2008,11,11) => 'Rememberance Day', + Date.civil(2008,12,25) => 'Christmas Day', + Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name| + assert_equal name, Holidays.on(date, :ca, :informal)[0][:name] +end + +# Victoria Day +[Date.civil(2004,5,24), Date.civil(2005,5,23), Date.civil(2006,5,22), + Date.civil(2007,5,21), Date.civil(2008,5,19)].each do |date| + assert_equal 'Victoria Day', Holidays.on(date, :ca)[0][:name] +end + end +end diff --git a/test/defs/test_defs_de.rb b/test/defs/test_defs_de.rb new file mode 100644 index 0000000..cf7ce4e --- /dev/null +++ b/test/defs/test_defs_de.rb @@ -0,0 +1,46 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'holidays/de' + +# This file is generated by the Ruby Holiday gem. +# +# Definitions loaded: data/de.yaml +class DeDefinitionTests < Test::Unit::TestCase # :nodoc: + + 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, :informal)[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 +end diff --git a/test/defs/test_defs_dk.rb b/test/defs/test_defs_dk.rb new file mode 100644 index 0000000..843205d --- /dev/null +++ b/test/defs/test_defs_dk.rb @@ -0,0 +1,30 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'holidays/dk' + +# This file is generated by the Ruby Holiday gem. +# +# Definitions loaded: data/dk.yaml +class DkDefinitionTests < Test::Unit::TestCase # :nodoc: + + def test_dk +{Date.civil(2007,1,1) => 'Nytårsdag', + Date.civil(2007,2,18) => 'Fastelavn', + Date.civil(2007,4,9) => 'Danmarks besættelse', + Date.civil(2007,4,16) => 'Dronningens fødselsdag', + Date.civil(2007,4,5) => 'Skærtorsdag', + Date.civil(2007,4,6) => 'Langfredag', + Date.civil(2007,4,8) => 'Påskedag', + Date.civil(2007,4,9) => '2. påskedag', + Date.civil(2007,5,1) => 'Arbejdernes kampdag', + Date.civil(2007,5,4) => 'Store Bededag', + Date.civil(2007,5,17) => 'Kristi Himmelfartsdag', + Date.civil(2007,5,27) => 'Pinsedag', + Date.civil(2007,5,28) => '2. Pinsedag', + Date.civil(2007,6,5) => 'Grundlovsdag', + Date.civil(2007,12,24) => 'Juleaftensdag', + Date.civil(2007,12,25) => '1. juledag', + Date.civil(2007,12,26) => '2. juledag'}.each do |date, name| + assert_equal name, Holidays.on(date, :dk, :informal)[0][:name] +end + end +end diff --git a/test/defs/test_defs_es.rb b/test/defs/test_defs_es.rb new file mode 100644 index 0000000..0f7c658 --- /dev/null +++ b/test/defs/test_defs_es.rb @@ -0,0 +1,57 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'holidays/es' + +# This file is generated by the Ruby Holiday gem. +# +# Definitions loaded: data/es.yaml +class EsDefinitionTests < Test::Unit::TestCase # :nodoc: + + 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, :informal)[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 +end diff --git a/test/defs/test_defs_europe.rb b/test/defs/test_defs_europe.rb new file mode 100644 index 0000000..ebd960b --- /dev/null +++ b/test/defs/test_defs_europe.rb @@ -0,0 +1,240 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'holidays/europe' + +# This file is generated by the Ruby Holiday gem. +# +# Definitions loaded: data/dk.yaml, data/de.yaml, data/es.yaml, data/fr.yaml, data/gb.yaml, data/ie.yaml, data/is.yaml, data/it.yaml, data/nl.yaml, data/pt.yaml +class EuropeDefinitionTests < Test::Unit::TestCase # :nodoc: + + def test_europe +{Date.civil(2007,1,1) => 'Nytårsdag', + Date.civil(2007,2,18) => 'Fastelavn', + Date.civil(2007,4,9) => 'Danmarks besættelse', + Date.civil(2007,4,16) => 'Dronningens fødselsdag', + Date.civil(2007,4,5) => 'Skærtorsdag', + Date.civil(2007,4,6) => 'Langfredag', + Date.civil(2007,4,8) => 'Påskedag', + Date.civil(2007,4,9) => '2. påskedag', + Date.civil(2007,5,1) => 'Arbejdernes kampdag', + Date.civil(2007,5,4) => 'Store Bededag', + Date.civil(2007,5,17) => 'Kristi Himmelfartsdag', + Date.civil(2007,5,27) => 'Pinsedag', + Date.civil(2007,5,28) => '2. Pinsedag', + Date.civil(2007,6,5) => 'Grundlovsdag', + Date.civil(2007,12,24) => 'Juleaftensdag', + Date.civil(2007,12,25) => '1. juledag', + Date.civil(2007,12,26) => '2. juledag'}.each do |date, name| + assert_equal name, Holidays.on(date, :dk, :informal)[0][:name] +end + +{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, :informal)[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] + + +{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, :informal)[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] + +{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, :informal)[0][:name] +end + +{Date.civil(2008,1,1) => 'New Year\'s Day', + Date.civil(2008,3,21) => 'Good Friday', + Date.civil(2008,3,23) => 'Easter Sunday', + Date.civil(2008,5,5) => 'May Day', + Date.civil(2008,5,26) => 'Bank Holiday', + Date.civil(2008,11,5) => 'Guy Fawkes Day', + Date.civil(2008,12,25) => 'Christmas Day', + Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name| + assert_equal name, Holidays.on(date, :gb, :informal)[0][:name] +end + +assert_equal 'St. Patrick\'s Day', Date.civil(2008,3,17).holidays(:gb_nir, :informal)[0][:name] + +assert_equal 'Christmas Day', Date.civil(2008,12,25).holidays(:gb_, :observed)[0][:name] +assert_equal 'Christmas Day', Date.civil(2009,12,25).holidays(:gb_, :observed)[0][:name] +assert_equal 'Christmas Day', Date.civil(2010,12,27).holidays(:gb_, :observed)[0][:name] + +assert_equal 'Boxing Day', Date.civil(2008,12,26).holidays(:gb_, :observed)[0][:name] +assert_equal 'Boxing Day', Date.civil(2009,12,28).holidays(:gb_, :observed)[0][:name] +assert_equal 'Boxing Day', Date.civil(2010,12,28).holidays(:gb_, :observed)[0][:name] + +[:gb_wls, :gb_eng, :gb_nir, :gb_eaw, :gb_].each do |r| + assert_equal 'Easter Monday', Date.civil(2008,3,24).holidays(r)[0][:name] + assert_equal 'Bank Holiday', Date.civil(2008,8,25).holidays(r)[0][:name] +end + +{Date.civil(2008,1,1) => 'New Year\'s Day', + Date.civil(2008,3,17) => 'St. Patrick\'s Day', + Date.civil(2008,3,24) => 'Easter Monday', + Date.civil(2008,5,5) => 'May Day', + Date.civil(2008,6,2) => 'Bank Holiday', + Date.civil(2008,8,4) => 'Bank Holiday', + Date.civil(2008,12,25) => 'Christmas Day', + Date.civil(2008,12,26) => 'St. Stephen\'s Day'}.each do |date, name| + assert_equal name, Holidays.on(date, :ie, :informal)[0][:name] +end + +{Date.civil(2007,1,1) => 'Nýársdagur', + Date.civil(2007,1,6) => 'Þrettándinn', + Date.civil(2007,1,19) => 'Bóndadagur', + Date.civil(2007,2,18) => 'Konudagur', + Date.civil(2007,4,5) => 'Skírdagur', + Date.civil(2007,4,6) => 'Föstudaginn langi', + Date.civil(2007,4,8) => 'Páskadagur', + Date.civil(2007,4,9) => 'Annar í páskum', + Date.civil(2007,4,19) => 'Sumardagurinn fyrsti', + Date.civil(2007,5,1) => 'Verkalýðsdagurinn', + Date.civil(2007,5,17) => 'Uppstigningardagur', + Date.civil(2007,5,27) => 'Hvítasunnudagur', + Date.civil(2007,5,28) => 'Annar í hvítasunnu', + Date.civil(2007,6,3) => 'Sjómannadagurinn', + Date.civil(2007,6,17) => 'Lýðveldisdagurinn', + Date.civil(2007,8,6) => 'Frídagur verslunarmanna', + Date.civil(2007,12,24) => 'Jól', + Date.civil(2007,12,25) => 'Jól', + Date.civil(2007,12,26) => 'Jól', + Date.civil(2007,12,31) => 'Gamlárskvöld'}.each do |date, name| + assert_equal name, Holidays.on(date, :is, :informal)[0][:name] +end + +{Date.civil(2007,1,1) => 'Capodanno', + Date.civil(2007,1,6) => 'Epifania', + Date.civil(2007,4,8) => 'Pasqua', + Date.civil(2007,4,9) => 'Lunedì dell\'Angelo', + Date.civil(2007,4,25) => 'Festa della Liberazione', + Date.civil(2007,5,1) => 'Festa dei Lavoratori', + Date.civil(2007,6,2) => 'Festa della Repubblica', + Date.civil(2007,8,15) => 'Assunzione', + Date.civil(2007,11,1) => 'Ognissanti', + Date.civil(2007,12,8) => 'Immacolata Concezione', + Date.civil(2007,12,25) => 'Natale', + Date.civil(2007,12,26) => 'Santo Stefano'}.each do |date, name| + assert_equal name, Holidays.on(date, :it, :informal)[0][:name] +end + +{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, :informal)[0][:name] +end + +{Date.civil(2008,1,1) => 'Ano Novo', + Date.civil(2005,2,8) => 'Carnaval', + Date.civil(2006,2,28) => 'Carnaval', + Date.civil(2007,2,20) => 'Carnaval', + Date.civil(2008,2,5) => 'Carnaval', + Date.civil(2008,3,21) => 'Sexta-feira Santa', + Date.civil(2008,3,23) => 'Páscoa', + Date.civil(2008,4,25) => 'Dia da Liberdade', + Date.civil(2008,5,1) => 'Dia do Trabalhador', + Date.civil(2005,5,26) => 'Corpo de Deus', + Date.civil(2007,6,7) => 'Corpo de Deus', + Date.civil(2008,5,22) => 'Corpo de Deus', + Date.civil(2008,6,10) => 'Dia de Portugal', + Date.civil(2008,8,15) => 'Assunção de Nossa Senhora', + Date.civil(2008,10,5) => 'Implantação da República', + Date.civil(2008,11,1) => 'Todos os Santos', + Date.civil(2008,12,1) => 'Restauração da Independência', + Date.civil(2008,12,8) => 'Imaculada Conceição', + Date.civil(2008,12,25) => 'Natal'}.each do |date, name| + assert_equal name, Holidays.on(date, :pt, :informal)[0][:name] +end + end +end diff --git a/test/defs/test_defs_fr.rb b/test/defs/test_defs_fr.rb new file mode 100644 index 0000000..9b7d4e9 --- /dev/null +++ b/test/defs/test_defs_fr.rb @@ -0,0 +1,26 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'holidays/fr' + +# This file is generated by the Ruby Holiday gem. +# +# Definitions loaded: data/fr.yaml +class FrDefinitionTests < Test::Unit::TestCase # :nodoc: + + 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, :informal)[0][:name] +end + end +end diff --git a/test/defs/test_defs_gb.rb b/test/defs/test_defs_gb.rb new file mode 100644 index 0000000..a1664d7 --- /dev/null +++ b/test/defs/test_defs_gb.rb @@ -0,0 +1,36 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'holidays/gb' + +# This file is generated by the Ruby Holiday gem. +# +# Definitions loaded: data/gb.yaml +class GbDefinitionTests < Test::Unit::TestCase # :nodoc: + + def test_gb +{Date.civil(2008,1,1) => 'New Year\'s Day', + Date.civil(2008,3,21) => 'Good Friday', + Date.civil(2008,3,23) => 'Easter Sunday', + Date.civil(2008,5,5) => 'May Day', + Date.civil(2008,5,26) => 'Bank Holiday', + Date.civil(2008,11,5) => 'Guy Fawkes Day', + Date.civil(2008,12,25) => 'Christmas Day', + Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name| + assert_equal name, Holidays.on(date, :gb, :informal)[0][:name] +end + +assert_equal 'St. Patrick\'s Day', Date.civil(2008,3,17).holidays(:gb_nir, :informal)[0][:name] + +assert_equal 'Christmas Day', Date.civil(2008,12,25).holidays(:gb_, :observed)[0][:name] +assert_equal 'Christmas Day', Date.civil(2009,12,25).holidays(:gb_, :observed)[0][:name] +assert_equal 'Christmas Day', Date.civil(2010,12,27).holidays(:gb_, :observed)[0][:name] + +assert_equal 'Boxing Day', Date.civil(2008,12,26).holidays(:gb_, :observed)[0][:name] +assert_equal 'Boxing Day', Date.civil(2009,12,28).holidays(:gb_, :observed)[0][:name] +assert_equal 'Boxing Day', Date.civil(2010,12,28).holidays(:gb_, :observed)[0][:name] + +[:gb_wls, :gb_eng, :gb_nir, :gb_eaw, :gb_].each do |r| + assert_equal 'Easter Monday', Date.civil(2008,3,24).holidays(r)[0][:name] + assert_equal 'Bank Holiday', Date.civil(2008,8,25).holidays(r)[0][:name] +end + end +end diff --git a/test/defs/test_defs_ie.rb b/test/defs/test_defs_ie.rb new file mode 100644 index 0000000..2f4ce73 --- /dev/null +++ b/test/defs/test_defs_ie.rb @@ -0,0 +1,21 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'holidays/ie' + +# This file is generated by the Ruby Holiday gem. +# +# Definitions loaded: data/ie.yaml +class IeDefinitionTests < Test::Unit::TestCase # :nodoc: + + def test_ie +{Date.civil(2008,1,1) => 'New Year\'s Day', + Date.civil(2008,3,17) => 'St. Patrick\'s Day', + Date.civil(2008,3,24) => 'Easter Monday', + Date.civil(2008,5,5) => 'May Day', + Date.civil(2008,6,2) => 'Bank Holiday', + Date.civil(2008,8,4) => 'Bank Holiday', + Date.civil(2008,12,25) => 'Christmas Day', + Date.civil(2008,12,26) => 'St. Stephen\'s Day'}.each do |date, name| + assert_equal name, Holidays.on(date, :ie, :informal)[0][:name] +end + end +end diff --git a/test/defs/test_defs_is.rb b/test/defs/test_defs_is.rb new file mode 100644 index 0000000..854ba05 --- /dev/null +++ b/test/defs/test_defs_is.rb @@ -0,0 +1,33 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'holidays/is' + +# This file is generated by the Ruby Holiday gem. +# +# Definitions loaded: data/is.yaml +class IsDefinitionTests < Test::Unit::TestCase # :nodoc: + + def test_is +{Date.civil(2007,1,1) => 'Nýársdagur', + Date.civil(2007,1,6) => 'Þrettándinn', + Date.civil(2007,1,19) => 'Bóndadagur', + Date.civil(2007,2,18) => 'Konudagur', + Date.civil(2007,4,5) => 'Skírdagur', + Date.civil(2007,4,6) => 'Föstudaginn langi', + Date.civil(2007,4,8) => 'Páskadagur', + Date.civil(2007,4,9) => 'Annar í páskum', + Date.civil(2007,4,19) => 'Sumardagurinn fyrsti', + Date.civil(2007,5,1) => 'Verkalýðsdagurinn', + Date.civil(2007,5,17) => 'Uppstigningardagur', + Date.civil(2007,5,27) => 'Hvítasunnudagur', + Date.civil(2007,5,28) => 'Annar í hvítasunnu', + Date.civil(2007,6,3) => 'Sjómannadagurinn', + Date.civil(2007,6,17) => 'Lýðveldisdagurinn', + Date.civil(2007,8,6) => 'Frídagur verslunarmanna', + Date.civil(2007,12,24) => 'Jól', + Date.civil(2007,12,25) => 'Jól', + Date.civil(2007,12,26) => 'Jól', + Date.civil(2007,12,31) => 'Gamlárskvöld'}.each do |date, name| + assert_equal name, Holidays.on(date, :is, :informal)[0][:name] +end + end +end diff --git a/test/defs/test_defs_it.rb b/test/defs/test_defs_it.rb new file mode 100644 index 0000000..4956412 --- /dev/null +++ b/test/defs/test_defs_it.rb @@ -0,0 +1,25 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'holidays/it' + +# This file is generated by the Ruby Holiday gem. +# +# Definitions loaded: data/it.yaml +class ItDefinitionTests < Test::Unit::TestCase # :nodoc: + + def test_it +{Date.civil(2007,1,1) => 'Capodanno', + Date.civil(2007,1,6) => 'Epifania', + Date.civil(2007,4,8) => 'Pasqua', + Date.civil(2007,4,9) => 'Lunedì dell\'Angelo', + Date.civil(2007,4,25) => 'Festa della Liberazione', + Date.civil(2007,5,1) => 'Festa dei Lavoratori', + Date.civil(2007,6,2) => 'Festa della Repubblica', + Date.civil(2007,8,15) => 'Assunzione', + Date.civil(2007,11,1) => 'Ognissanti', + Date.civil(2007,12,8) => 'Immacolata Concezione', + Date.civil(2007,12,25) => 'Natale', + Date.civil(2007,12,26) => 'Santo Stefano'}.each do |date, name| + assert_equal name, Holidays.on(date, :it, :informal)[0][:name] +end + end +end diff --git a/test/defs/test_defs_mx.rb b/test/defs/test_defs_mx.rb new file mode 100644 index 0000000..262d13b --- /dev/null +++ b/test/defs/test_defs_mx.rb @@ -0,0 +1,22 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'holidays/mx' + +# This file is generated by the Ruby Holiday gem. +# +# Definitions loaded: data/mx.yaml, data/north_america_informal.yaml +class MxDefinitionTests < Test::Unit::TestCase # :nodoc: + + def test_mx +{Date.civil(2007,1,1) => 'Año nuevo', + Date.civil(2007,2,5) => 'Día de la Constitución', + Date.civil(2007,5,1) => 'Día del Trabajo', + Date.civil(2007,5,5) => 'Cinco de Mayo', + Date.civil(2007,9,16) => 'Día de la Independencia', + Date.civil(2007,11,1) => 'Todos los Santos', + Date.civil(2007,11,2) => 'Los Fieles Difuntos', + Date.civil(2007,11,19) => 'Día de la Revolución', + Date.civil(2007,12,25) => 'Navidad'}.each do |date, name| + assert_equal name, Holidays.on(date, :mx, :informal)[0][:name] +end + end +end diff --git a/test/defs/test_defs_nl.rb b/test/defs/test_defs_nl.rb new file mode 100644 index 0000000..f828fa9 --- /dev/null +++ b/test/defs/test_defs_nl.rb @@ -0,0 +1,24 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'holidays/nl' + +# This file is generated by the Ruby Holiday gem. +# +# Definitions loaded: data/nl.yaml +class NlDefinitionTests < Test::Unit::TestCase # :nodoc: + + 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, :informal)[0][:name] +end + end +end diff --git a/test/defs/test_defs_north_america.rb b/test/defs/test_defs_north_america.rb new file mode 100644 index 0000000..6ae27f8 --- /dev/null +++ b/test/defs/test_defs_north_america.rb @@ -0,0 +1,54 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'holidays/north_america' + +# This file is generated by the Ruby Holiday gem. +# +# Definitions loaded: data/ca.yaml, data/mx.yaml, data/us.yaml, data/north_america_informal.yaml +class North_americaDefinitionTests < Test::Unit::TestCase # :nodoc: + + def test_north_america +{Date.civil(2008,1,1) => 'New Year\'s Day', + Date.civil(2008,3,21) => 'Good Friday', + Date.civil(2008,3,24) => 'Easter Monday', + Date.civil(2008,5,19) => 'Victoria Day', + Date.civil(2008,7,1) => 'Canada Day', + Date.civil(2008,9,1) => 'Labour Day', + Date.civil(2008,10,13) => 'Thanksgiving', + Date.civil(2008,11,11) => 'Rememberance Day', + Date.civil(2008,12,25) => 'Christmas Day', + Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name| + assert_equal name, Holidays.on(date, :ca, :informal)[0][:name] +end + +# Victoria Day +[Date.civil(2004,5,24), Date.civil(2005,5,23), Date.civil(2006,5,22), + Date.civil(2007,5,21), Date.civil(2008,5,19)].each do |date| + assert_equal 'Victoria Day', Holidays.on(date, :ca)[0][:name] +end + +{Date.civil(2007,1,1) => 'Año nuevo', + Date.civil(2007,2,5) => 'Día de la Constitución', + Date.civil(2007,5,1) => 'Día del Trabajo', + Date.civil(2007,5,5) => 'Cinco de Mayo', + Date.civil(2007,9,16) => 'Día de la Independencia', + Date.civil(2007,11,1) => 'Todos los Santos', + Date.civil(2007,11,2) => 'Los Fieles Difuntos', + Date.civil(2007,11,19) => 'Día de la Revolución', + Date.civil(2007,12,25) => 'Navidad'}.each do |date, name| + assert_equal name, Holidays.on(date, :mx, :informal)[0][:name] +end + +{Date.civil(2008,1,1) => 'New Year\'s Day', + Date.civil(2008,1,21) => 'Martin Luther King, Jr. Day', + Date.civil(2008,2,18) => 'Presidents\' Day', + Date.civil(2008,5,26) => 'Memorial Day', + Date.civil(2008,7,4) => 'Independence Day', + Date.civil(2008,9,1) => 'Labor Day', + Date.civil(2008,10,13) => 'Columbus Day', + Date.civil(2008,11,11) => 'Veterans Day', + Date.civil(2008,11,27) => 'Thanksgiving', + Date.civil(2008,12,25) => 'Christmas Day'}.each do |date, name| + assert_equal name, Holidays.on(date, :us)[0][:name] +end + end +end diff --git a/test/defs/test_defs_pt.rb b/test/defs/test_defs_pt.rb new file mode 100644 index 0000000..a248e5b --- /dev/null +++ b/test/defs/test_defs_pt.rb @@ -0,0 +1,32 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'holidays/pt' + +# This file is generated by the Ruby Holiday gem. +# +# Definitions loaded: data/se.yaml +class PtDefinitionTests < Test::Unit::TestCase # :nodoc: + + def test_pt +{Date.civil(2008,1,1) => 'Nyårsdagen', + Date.civil(2008,1,6) => 'Trettondedag jul', + Date.civil(2008,3,21) => 'Långfredagen', + Date.civil(2008,3,23) => 'Påskdagen', + Date.civil(2008,3,24) => 'Annandag påsk', + Date.civil(2008,5,1) => 'Första maj', + Date.civil(2008,5,1) => 'Kristi himmelsfärdsdag', + Date.civil(2008,5,11) => 'Pingstdagen', + Date.civil(2008,6,6) => 'Nationaldagen', + Date.civil(2005,6,25) => 'Midsommardagen', + Date.civil(2006,6,24) => 'Midsommardagen', + Date.civil(2007,6,23) => 'Midsommardagen', + Date.civil(2008,6,21) => 'Midsommardagen', + Date.civil(2005,11,5) => 'Alla helgons dag', + Date.civil(2006,11,4) => 'Alla helgons dag', + Date.civil(2007,11,3) => 'Alla helgons dag', + Date.civil(2008,11,1) => 'Alla helgons dag', + Date.civil(2008,12,25) => 'Juldagen', + Date.civil(2008,12,26) => 'Annandag jul'}.each do |date, name| + assert_equal name, Holidays.on(date, :se, :informal)[0][:name] +end + end +end diff --git a/test/defs/test_defs_scandinavia.rb b/test/defs/test_defs_scandinavia.rb new file mode 100644 index 0000000..68512a2 --- /dev/null +++ b/test/defs/test_defs_scandinavia.rb @@ -0,0 +1,75 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'holidays/scandinavia' + +# This file is generated by the Ruby Holiday gem. +# +# Definitions loaded: data/dk.yaml, data/is.yaml, data/se.yaml +class ScandinaviaDefinitionTests < Test::Unit::TestCase # :nodoc: + + def test_scandinavia +{Date.civil(2007,1,1) => 'Nytårsdag', + Date.civil(2007,2,18) => 'Fastelavn', + Date.civil(2007,4,9) => 'Danmarks besættelse', + Date.civil(2007,4,16) => 'Dronningens fødselsdag', + Date.civil(2007,4,5) => 'Skærtorsdag', + Date.civil(2007,4,6) => 'Langfredag', + Date.civil(2007,4,8) => 'Påskedag', + Date.civil(2007,4,9) => '2. påskedag', + Date.civil(2007,5,1) => 'Arbejdernes kampdag', + Date.civil(2007,5,4) => 'Store Bededag', + Date.civil(2007,5,17) => 'Kristi Himmelfartsdag', + Date.civil(2007,5,27) => 'Pinsedag', + Date.civil(2007,5,28) => '2. Pinsedag', + Date.civil(2007,6,5) => 'Grundlovsdag', + Date.civil(2007,12,24) => 'Juleaftensdag', + Date.civil(2007,12,25) => '1. juledag', + Date.civil(2007,12,26) => '2. juledag'}.each do |date, name| + assert_equal name, Holidays.on(date, :dk, :informal)[0][:name] +end + +{Date.civil(2007,1,1) => 'Nýársdagur', + Date.civil(2007,1,6) => 'Þrettándinn', + Date.civil(2007,1,19) => 'Bóndadagur', + Date.civil(2007,2,18) => 'Konudagur', + Date.civil(2007,4,5) => 'Skírdagur', + Date.civil(2007,4,6) => 'Föstudaginn langi', + Date.civil(2007,4,8) => 'Páskadagur', + Date.civil(2007,4,9) => 'Annar í páskum', + Date.civil(2007,4,19) => 'Sumardagurinn fyrsti', + Date.civil(2007,5,1) => 'Verkalýðsdagurinn', + Date.civil(2007,5,17) => 'Uppstigningardagur', + Date.civil(2007,5,27) => 'Hvítasunnudagur', + Date.civil(2007,5,28) => 'Annar í hvítasunnu', + Date.civil(2007,6,3) => 'Sjómannadagurinn', + Date.civil(2007,6,17) => 'Lýðveldisdagurinn', + Date.civil(2007,8,6) => 'Frídagur verslunarmanna', + Date.civil(2007,12,24) => 'Jól', + Date.civil(2007,12,25) => 'Jól', + Date.civil(2007,12,26) => 'Jól', + Date.civil(2007,12,31) => 'Gamlárskvöld'}.each do |date, name| + assert_equal name, Holidays.on(date, :is, :informal)[0][:name] +end + +{Date.civil(2008,1,1) => 'Nyårsdagen', + Date.civil(2008,1,6) => 'Trettondedag jul', + Date.civil(2008,3,21) => 'Långfredagen', + Date.civil(2008,3,23) => 'Påskdagen', + Date.civil(2008,3,24) => 'Annandag påsk', + Date.civil(2008,5,1) => 'Första maj', + Date.civil(2008,5,1) => 'Kristi himmelsfärdsdag', + Date.civil(2008,5,11) => 'Pingstdagen', + Date.civil(2008,6,6) => 'Nationaldagen', + Date.civil(2005,6,25) => 'Midsommardagen', + Date.civil(2006,6,24) => 'Midsommardagen', + Date.civil(2007,6,23) => 'Midsommardagen', + Date.civil(2008,6,21) => 'Midsommardagen', + Date.civil(2005,11,5) => 'Alla helgons dag', + Date.civil(2006,11,4) => 'Alla helgons dag', + Date.civil(2007,11,3) => 'Alla helgons dag', + Date.civil(2008,11,1) => 'Alla helgons dag', + Date.civil(2008,12,25) => 'Juldagen', + Date.civil(2008,12,26) => 'Annandag jul'}.each do |date, name| + assert_equal name, Holidays.on(date, :se, :informal)[0][:name] +end + end +end diff --git a/test/defs/test_defs_se.rb b/test/defs/test_defs_se.rb new file mode 100644 index 0000000..9beb260 --- /dev/null +++ b/test/defs/test_defs_se.rb @@ -0,0 +1,32 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'holidays/se' + +# This file is generated by the Ruby Holiday gem. +# +# Definitions loaded: data/se.yaml +class SeDefinitionTests < Test::Unit::TestCase # :nodoc: + + def test_se +{Date.civil(2008,1,1) => 'Nyårsdagen', + Date.civil(2008,1,6) => 'Trettondedag jul', + Date.civil(2008,3,21) => 'Långfredagen', + Date.civil(2008,3,23) => 'Påskdagen', + Date.civil(2008,3,24) => 'Annandag påsk', + Date.civil(2008,5,1) => 'Första maj', + Date.civil(2008,5,1) => 'Kristi himmelsfärdsdag', + Date.civil(2008,5,11) => 'Pingstdagen', + Date.civil(2008,6,6) => 'Nationaldagen', + Date.civil(2005,6,25) => 'Midsommardagen', + Date.civil(2006,6,24) => 'Midsommardagen', + Date.civil(2007,6,23) => 'Midsommardagen', + Date.civil(2008,6,21) => 'Midsommardagen', + Date.civil(2005,11,5) => 'Alla helgons dag', + Date.civil(2006,11,4) => 'Alla helgons dag', + Date.civil(2007,11,3) => 'Alla helgons dag', + Date.civil(2008,11,1) => 'Alla helgons dag', + Date.civil(2008,12,25) => 'Juldagen', + Date.civil(2008,12,26) => 'Annandag jul'}.each do |date, name| + assert_equal name, Holidays.on(date, :se, :informal)[0][:name] +end + end +end diff --git a/test/defs/test_defs_us.rb b/test/defs/test_defs_us.rb new file mode 100644 index 0000000..190b5bd --- /dev/null +++ b/test/defs/test_defs_us.rb @@ -0,0 +1,36 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'holidays/us' + +# This file is generated by the Ruby Holiday gem. +# +# Definitions loaded: data/au.yaml, data/north_america_informal.yaml +class UsDefinitionTests < Test::Unit::TestCase # :nodoc: + + def test_us +{Date.civil(2007,1,1) => 'New Year\'s Day', + Date.civil(2007,1,26) => 'Australia Day', + Date.civil(2007,4,6) => 'Good Friday', + Date.civil(2007,4,9) => 'Easter Monday', + Date.civil(2007,4,25) => 'ANZAC Day', + Date.civil(2007,12,25) => 'Christmas Day', + Date.civil(2007,12,26) => 'Boxing Day'}.each do |date, name| + assert_equal name, Holidays.on(date, :au, :informal)[0][:name] +end + +[:au_sa, :au_act, :au_nsw, :au_].each do |r| + assert_equal 'Labour Day', Date.civil(2007,10,1).holidays(r)[0][:name] +end + +[:au_sa, :au_act, :au_nsw, :au_vic, :au_tas, :au_qld, :au_nt, :au_].each do |r| + assert_equal 'Queen\'s Birthday', Date.civil(2007,6,11).holidays(r)[0][:name] +end + +assert_equal 'Labour Day', Date.civil(2007,3,5).holidays(:au_wa)[0][:name] +assert_equal 'Labour Day', Date.civil(2007,3,12).holidays(:au_vic)[0][:name] +assert_equal 'Labour Day', Date.civil(2007,5,7).holidays(:au_qld)[0][:name] + +assert_equal 'May Day', Date.civil(2007,5,7).holidays(:au_nt)[0][:name] + +assert_equal 'Eight Hours Day', Date.civil(2007,3,12).holidays(:au_tas)[0][:name] + end +end diff --git a/test/defs/test_defs_za.rb b/test/defs/test_defs_za.rb new file mode 100644 index 0000000..4cc3aa0 --- /dev/null +++ b/test/defs/test_defs_za.rb @@ -0,0 +1,25 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'holidays/za' + +# This file is generated by the Ruby Holiday gem. +# +# Definitions loaded: data/za.yaml +class ZaDefinitionTests < Test::Unit::TestCase # :nodoc: + + def test_za +{Date.civil(2007,1,1) => 'New Year\'s Day', + Date.civil(2007,3,21) => 'Human Rights Day', + Date.civil(2007,4,6) => 'Good Friday', + Date.civil(2007,4,9) => 'Family Day', + Date.civil(2007,4,27) => 'Freedom Day', + Date.civil(2007,5,1) => 'Workers Day', + Date.civil(2007,6,16) => 'Youth Day', + Date.civil(2007,8,9) => 'National Women\'s Day', + Date.civil(2007,9,24) => 'Heritage Day', + Date.civil(2007,12,16) => 'Day of Reconciliation', + Date.civil(2007,12,25) => 'Christmas Day', + Date.civil(2007,12,26) => 'Day of Goodwill'}.each do |date, name| + assert_equal name, Holidays.on(date, :za, :informal)[0][:name] +end + end +end