holidays 1.0.3 → 1.0.4

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.
Files changed (49) hide show
  1. data/.travis.yml +8 -0
  2. data/CHANGELOG +3 -0
  3. data/Gemfile +8 -0
  4. data/data/build_defs.rb +12 -8
  5. data/data/index.yaml +3 -1
  6. data/data/li.yaml +102 -0
  7. data/data/pl.yaml +310 -0
  8. data/data/united_nations.yaml +186 -185
  9. data/holidays.gemspec +61 -11
  10. data/lib/holidays.rb +19 -2
  11. data/lib/holidays/MANIFEST +24 -23
  12. data/lib/holidays/at.rb +17 -13
  13. data/lib/holidays/au.rb +21 -17
  14. data/lib/holidays/br.rb +18 -14
  15. data/lib/holidays/ca.rb +27 -23
  16. data/lib/holidays/cz.rb +18 -14
  17. data/lib/holidays/de.rb +18 -14
  18. data/lib/holidays/dk.rb +20 -16
  19. data/lib/holidays/el.rb +17 -13
  20. data/lib/holidays/es.rb +27 -23
  21. data/lib/holidays/europe.rb +163 -95
  22. data/lib/holidays/fi.rb +20 -16
  23. data/lib/holidays/fr.rb +18 -14
  24. data/lib/holidays/gb.rb +20 -16
  25. data/lib/holidays/ie.rb +17 -13
  26. data/lib/holidays/is.rb +21 -17
  27. data/lib/holidays/it.rb +18 -14
  28. data/lib/holidays/jp.rb +54 -50
  29. data/lib/holidays/li.rb +48 -0
  30. data/lib/holidays/mx.rb +27 -23
  31. data/lib/holidays/nl.rb +16 -12
  32. data/lib/holidays/no.rb +14 -10
  33. data/lib/holidays/north_america.rb +47 -43
  34. data/lib/holidays/nyse.rb +17 -13
  35. data/lib/holidays/nz.rb +24 -20
  36. data/lib/holidays/pl.rb +80 -0
  37. data/lib/holidays/pt.rb +19 -15
  38. data/lib/holidays/scandinavia.rb +51 -47
  39. data/lib/holidays/se.rb +21 -17
  40. data/lib/holidays/united_nations.rb +68 -8
  41. data/lib/holidays/ups.rb +15 -11
  42. data/lib/holidays/us.rb +22 -18
  43. data/lib/holidays/za.rb +19 -15
  44. data/rakefile.rb +6 -4
  45. data/test/defs/test_defs_europe.rb +161 -1
  46. data/test/defs/test_defs_li.rb +35 -0
  47. data/test/defs/test_defs_pl.rb +145 -0
  48. data/test/test_all_regions.rb +48 -0
  49. metadata +190 -42
data/lib/holidays/ups.rb CHANGED
@@ -1,32 +1,36 @@
1
1
  # encoding: utf-8
2
2
  module Holidays
3
- # This file is generated by the Ruby Holiday gem.
3
+ # This file is generated by the Ruby Holidays gem.
4
4
  #
5
5
  # Definitions loaded: data/ups.yaml
6
6
  #
7
- # To use the definitions in this file, load them right after you load the
7
+ # To use the definitions in this file, load it right after you load the
8
8
  # Holiday gem:
9
9
  #
10
10
  # require 'holidays'
11
11
  # require 'holidays/ups'
12
12
  #
13
- # More definitions are available at http://code.dunae.ca/holidays.
13
+ # All the definitions are available at https://github.com/alexdunae/holidays
14
14
  module UPS # :nodoc:
15
- DEFINED_REGIONS = [:ups]
15
+ def self.defined_regions
16
+ [:ups]
17
+ end
16
18
 
17
- HOLIDAYS_BY_MONTH = {
19
+ def self.holidays_by_month
20
+ {
21
+ 1 => [{:mday => 1, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "New Year's Day", :regions => [:ups]}],
18
22
  5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:ups]}],
23
+ 7 => [{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:ups]}],
24
+ 9 => [{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:ups]}],
19
25
  11 => [{:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:ups]},
20
26
  {:wday => 5, :week => 4, :name => "Day After Thanksgiving", :regions => [:ups]}],
21
- 1 => [{:mday => 1, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "New Year's Day", :regions => [:ups]}],
22
27
  12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Christmas Day", :regions => [:ups]},
23
- {:mday => 31, :name => "New Year's Eve", :regions => [:ups]}],
24
- 7 => [{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:ups]}],
25
- 9 => [{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:ups]}]
26
- }
28
+ {:mday => 31, :name => "New Year's Eve", :regions => [:ups]}]
29
+ }
30
+ end
27
31
  end
28
32
 
29
33
 
30
34
  end
31
35
 
32
- Holidays.merge_defs(Holidays::UPS::DEFINED_REGIONS, Holidays::UPS::HOLIDAYS_BY_MONTH)
36
+ Holidays.merge_defs(Holidays::UPS.defined_regions, Holidays::UPS.holidays_by_month)
data/lib/holidays/us.rb CHANGED
@@ -1,40 +1,44 @@
1
1
  # encoding: utf-8
2
2
  module Holidays
3
- # This file is generated by the Ruby Holiday gem.
3
+ # This file is generated by the Ruby Holidays gem.
4
4
  #
5
5
  # Definitions loaded: data/us.yaml, data/north_america_informal.yaml
6
6
  #
7
- # To use the definitions in this file, load them right after you load the
7
+ # To use the definitions in this file, load it right after you load the
8
8
  # Holiday gem:
9
9
  #
10
10
  # require 'holidays'
11
11
  # require 'holidays/us'
12
12
  #
13
- # More definitions are available at http://code.dunae.ca/holidays.
13
+ # All the definitions are available at https://github.com/alexdunae/holidays
14
14
  module US # :nodoc:
15
- DEFINED_REGIONS = [:us, :us_dc, :ca]
15
+ def self.defined_regions
16
+ [:us, :us_dc, :ca]
17
+ end
16
18
 
17
- HOLIDAYS_BY_MONTH = {
18
- 5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:us]},
19
- {:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
20
- 0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :type => :informal, :name => "Good Friday", :regions => [:us]}],
21
- 11 => [{:mday => 11, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Veterans Day", :regions => [:us]},
22
- {:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:us]}],
19
+ def self.holidays_by_month
20
+ {
21
+ 0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :type => :informal, :name => "Good Friday", :regions => [:us]}],
23
22
  1 => [{:mday => 1, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "New Year's Day", :regions => [:us]},
24
23
  {:wday => 1, :week => 3, :name => "Martin Luther King, Jr. Day", :regions => [:us]},
25
24
  {:function => lambda { |year| Holidays.us_inauguration_day(year) }, :function_id => "us_inauguration_day(year)", :name => "Inauguration Day", :regions => [:us_dc]}],
26
- 12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Christmas Day", :regions => [:us]}],
27
- 7 => [{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:us]}],
28
25
  2 => [{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:us]},
29
26
  {:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
30
27
  {:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
31
- 3 => [{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
28
+ 5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:us]},
29
+ {:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
30
+ 7 => [{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:us]}],
32
31
  9 => [{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:us]}],
33
- 4 => [{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
34
- {:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
35
32
  10 => [{:wday => 1, :week => 2, :name => "Columbus Day", :regions => [:us]},
36
- {:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}]
37
- }
33
+ {:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}],
34
+ 11 => [{:mday => 11, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Veterans Day", :regions => [:us]},
35
+ {:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:us]}],
36
+ 12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Christmas Day", :regions => [:us]}],
37
+ 3 => [{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
38
+ 4 => [{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
39
+ {:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}]
40
+ }
41
+ end
38
42
  end
39
43
 
40
44
  # January 20, every fourth year, following Presidential election
@@ -46,4 +50,4 @@ end
46
50
 
47
51
  end
48
52
 
49
- Holidays.merge_defs(Holidays::US::DEFINED_REGIONS, Holidays::US::HOLIDAYS_BY_MONTH)
53
+ Holidays.merge_defs(Holidays::US.defined_regions, Holidays::US.holidays_by_month)
data/lib/holidays/za.rb CHANGED
@@ -1,36 +1,40 @@
1
1
  # encoding: utf-8
2
2
  module Holidays
3
- # This file is generated by the Ruby Holiday gem.
3
+ # This file is generated by the Ruby Holidays gem.
4
4
  #
5
5
  # Definitions loaded: data/za.yaml
6
6
  #
7
- # To use the definitions in this file, load them right after you load the
7
+ # To use the definitions in this file, load it right after you load the
8
8
  # Holiday gem:
9
9
  #
10
10
  # require 'holidays'
11
11
  # require 'holidays/za'
12
12
  #
13
- # More definitions are available at http://code.dunae.ca/holidays.
13
+ # All the definitions are available at https://github.com/alexdunae/holidays
14
14
  module ZA # :nodoc:
15
- DEFINED_REGIONS = [:za]
15
+ def self.defined_regions
16
+ [:za]
17
+ end
16
18
 
17
- HOLIDAYS_BY_MONTH = {
18
- 5 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Workers Day", :regions => [:za]}],
19
- 0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:za]},
19
+ def self.holidays_by_month
20
+ {
21
+ 0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:za]},
20
22
  {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Family Day", :regions => [:za]}],
21
- 6 => [{:mday => 16, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Youth Day", :regions => [:za]}],
22
23
  1 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "New Year's Day", :regions => [:za]}],
23
- 12 => [{:mday => 16, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Day of Reconciliation", :regions => [:za]},
24
- {:mday => 25, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Christmas Day", :regions => [:za]},
25
- {:mday => 26, :observed => lambda { |date| Holidays.to_weekday_if_boxing_weekend(date) }, :observed_id => "to_weekday_if_boxing_weekend", :name => "Day of Goodwill", :regions => [:za]}],
26
- 8 => [{:mday => 9, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "National Women's Day", :regions => [:za]}],
27
24
  3 => [{:mday => 21, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Human Rights Day", :regions => [:za]}],
25
+ 4 => [{:mday => 27, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Freedom Day", :regions => [:za]}],
26
+ 5 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Workers Day", :regions => [:za]}],
27
+ 6 => [{:mday => 16, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Youth Day", :regions => [:za]}],
28
+ 8 => [{:mday => 9, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "National Women's Day", :regions => [:za]}],
28
29
  9 => [{:mday => 24, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Heritage Day", :regions => [:za]}],
29
- 4 => [{:mday => 27, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Freedom Day", :regions => [:za]}]
30
- }
30
+ 12 => [{:mday => 16, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Day of Reconciliation", :regions => [:za]},
31
+ {:mday => 25, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Christmas Day", :regions => [:za]},
32
+ {:mday => 26, :observed => lambda { |date| Holidays.to_weekday_if_boxing_weekend(date) }, :observed_id => "to_weekday_if_boxing_weekend", :name => "Day of Goodwill", :regions => [:za]}]
33
+ }
34
+ end
31
35
  end
32
36
 
33
37
 
34
38
  end
35
39
 
36
- Holidays.merge_defs(Holidays::ZA::DEFINED_REGIONS, Holidays::ZA::HOLIDAYS_BY_MONTH)
40
+ Holidays.merge_defs(Holidays::ZA.defined_regions, Holidays::ZA.holidays_by_month)
data/rakefile.rb CHANGED
@@ -1,13 +1,14 @@
1
1
  $:.unshift File.expand_path('../lib', __FILE__)
2
2
  require 'rake'
3
3
  require 'rake/testtask'
4
- require 'rake/rdoctask'
5
- require 'rake/gempackagetask'
4
+ require 'rdoc/task'
6
5
  require 'yaml'
7
6
  require 'fileutils'
8
7
  require 'holidays'
9
8
  require File.expand_path('data/build_defs')
10
9
 
10
+ task :default => :test
11
+
11
12
  desc 'Run all tests'
12
13
  task :test => ["test:lib", "test:defs"]
13
14
 
@@ -30,7 +31,7 @@ end
30
31
  task :doc => ["defs:manifest", :rdoc]
31
32
 
32
33
  desc 'Generate documentation.'
33
- Rake::RDocTask.new(:rdoc) do |rdoc|
34
+ RDoc::Task.new do |rdoc|
34
35
  rdoc.rdoc_dir = 'doc'
35
36
  rdoc.title = 'Ruby Holidays Gem'
36
37
  rdoc.options << '--all' << '--inline-source' << '--line-numbers'
@@ -98,7 +99,8 @@ begin
98
99
  gemspec.email = "code@dunae.ca"
99
100
  gemspec.homepage = "https://github.com/alexdunae/holidays"
100
101
  gemspec.version = Holidays::VERSION
101
- gemspec.authors = ["Alex Dunae", "Rowan Crawford"]
102
+ gemspec.authors = ["Alex Dunae"]
103
+ gemspec.add_development_dependency 'rdoc', '>= 2.4.2'
102
104
  end
103
105
  rescue LoadError
104
106
  puts "Jeweler not available. Install it with: gem install jeweler"
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
3
3
 
4
4
  # This file is generated by the Ruby Holiday gem.
5
5
  #
6
- # Definitions loaded: data/at.yaml, data/cz.yaml, data/dk.yaml, data/de.yaml, data/el.yaml, data/es.yaml, data/fr.yaml, data/gb.yaml, data/ie.yaml, data/is.yaml, data/it.yaml, data/nl.yaml, data/no.yaml, data/pt.yaml
6
+ # Definitions loaded: data/at.yaml, data/cz.yaml, data/dk.yaml, data/de.yaml, data/el.yaml, data/es.yaml, data/fr.yaml, data/gb.yaml, data/ie.yaml, data/is.yaml, data/it.yaml, data/li.yaml, data/nl.yaml, data/no.yaml, data/pl.yaml, data/pt.yaml
7
7
  class EuropeDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_europe
@@ -254,6 +254,31 @@ end
254
254
  assert_equal name, (Holidays.on(date, :it, :informal)[0] || {})[:name]
255
255
  end
256
256
 
257
+ {Date.civil(2009,1,1) => 'Neujahrstag',
258
+ Date.civil(2011,3,8) => 'Fasnachtsdienstag',
259
+ Date.civil(2009,4,10) => 'Karfreitag',
260
+ Date.civil(2009,4,12) => 'Ostern',
261
+ Date.civil(2009,4,13) => 'Ostermontag',
262
+ Date.civil(2009,5,21) => 'Auffahrt',
263
+ Date.civil(2009,6,1) => 'Pfingstmontag',
264
+ Date.civil(2009,12,25) => 'Weihnachten',
265
+ Date.civil(2009,12,26) => 'Stefanstag'}.each do |date, name|
266
+ assert_equal name, Holidays.on(date, :li, :informal)[0][:name]
267
+ end
268
+
269
+ [:li].each do |r|
270
+ assert_equal 'Fronleichnam', Date.civil(2009,6,11).holidays(r)[0][:name]
271
+ end
272
+
273
+ [:li].each do |r|
274
+ assert_equal 'Staatsfeiertag', Date.civil(2009,8,15).holidays(r)[0][:name]
275
+ end
276
+
277
+ [:li].each do |r|
278
+ assert_equal 'Allerheiligen', Date.civil(2009,11,1).holidays(r)[0][:name]
279
+ end
280
+
281
+
257
282
  {Date.civil(2008,1,1) => 'Nieuwjaar',
258
283
  Date.civil(2008,3,21) => 'Goede Vrijdag',
259
284
  Date.civil(2008,3,23) => 'Pasen',
@@ -287,6 +312,141 @@ end
287
312
  assert_equal name, (Holidays.on(date, :no, :informal)[0] || {})[:name]
288
313
  end
289
314
 
315
+ {Date.civil(2011,1,1) => 'Nowy Rok',
316
+ Date.civil(2011,5,1) => 'Święto Państwowe (Święto Pracy)',
317
+ Date.civil(2011,5,3) => 'Święto Narodowe Trzeciego Maja',
318
+ Date.civil(2011,11,1) => 'Wszystkich Świętych',
319
+ Date.civil(2011,11,11) => 'Narodowe Święto Niepodległości',
320
+ Date.civil(2011,12,25) => 'pierwszy dzień Bożego Narodzenia',
321
+ Date.civil(2011,12,26) => 'drugi dzień Bożego Narodzenia'}.each do |date, name|
322
+ assert_equal name, (Holidays.on(date, :pl)[0] || {})[:name]
323
+ end
324
+
325
+ # informal
326
+ {Date.civil(2011,1,21) => 'Dzień Babci',
327
+ Date.civil(2011,1,22) => 'Dzień Dziadka',
328
+ Date.civil(2011,2,2) => 'Ofiarowanie Pańskie (Matki Boskiej Gromnicznej)',
329
+ Date.civil(2011,2,14) => 'Dzień Zakochanych (Walentynki)',
330
+ Date.civil(2010,3,8) => 'Dzień Kobiet',
331
+ Date.civil(2011,3,10) => 'Dzień Mężczyzn',
332
+ Date.civil(2011,4,1) => 'Prima Aprilis',
333
+ Date.civil(2010,4,22) => 'Międzynarodowy Dzień Ziemi',
334
+ Date.civil(2011,5,2) => 'Dzień Flagi Rzeczpospolitej Polskiej',
335
+ Date.civil(2010,6,23) => 'Dzień Ojca',
336
+ Date.civil(2011,9,30) => 'Dzień Chłopaka',
337
+ Date.civil(2011,10,14) => 'Dzień Nauczyciela (Dzień Edukacji Narodowej)',
338
+ Date.civil(2011,11,2) => 'Dzień Zaduszny',
339
+ Date.civil(2011,11,29) => 'Andrzejki',
340
+ Date.civil(2011,12,4) => 'Barbórka (Dzień Górnika, Naftowca i Gazownika)',
341
+ Date.civil(2011,12,6) => 'Mikołajki',
342
+ Date.civil(2011,12,24) => 'Wigilia Bożego Narodzenia',
343
+ Date.civil(2011,12,31) => 'Sylwester'}.each do |date, name|
344
+ assert_equal name, (Holidays.on(date, :pl, :informal)[0] || {})[:name]
345
+ end
346
+
347
+ # informal
348
+ {Date.civil(2011,1,21) => 'Dzień Babci',
349
+ Date.civil(2011,1,22) => 'Dzień Dziadka',
350
+ Date.civil(2011,2,2) => 'Ofiarowanie Pańskie (Matki Boskiej Gromnicznej)',
351
+ Date.civil(2011,2,14) => 'Dzień Zakochanych (Walentynki)',
352
+ Date.civil(2010,3,8) => 'Dzień Kobiet',
353
+ Date.civil(2011,3,10) => 'Dzień Mężczyzn',
354
+ Date.civil(2011,4,1) => 'Prima Aprilis',
355
+ Date.civil(2010,4,22) => 'Międzynarodowy Dzień Ziemi',
356
+ Date.civil(2011,5,2) => 'Dzień Flagi Rzeczpospolitej Polskiej',
357
+ Date.civil(2010,6,23) => 'Dzień Ojca',
358
+ Date.civil(2011,9,30) => 'Dzień Chłopaka',
359
+ Date.civil(2011,10,14) => 'Dzień Nauczyciela (Dzień Edukacji Narodowej)',
360
+ Date.civil(2011,11,2) => 'Dzień Zaduszny',
361
+ Date.civil(2011,11,29) => 'Andrzejki',
362
+ Date.civil(2011,12,4) => 'Barbórka (Dzień Górnika, Naftowca i Gazownika)',
363
+ Date.civil(2011,12,6) => 'Mikołajki',
364
+ Date.civil(2011,12,24) => 'Wigilia Bożego Narodzenia',
365
+ Date.civil(2011,12,31) => 'Sylwester'}.each do |date, name|
366
+ assert_equal nil, (Holidays.on(date, :pl)[0] || {})[:name]
367
+ end
368
+
369
+ # Objawienie Pańskie (święto Trzech Króli) -- formal since 2011
370
+ [Date.civil(2008,1,6), Date.civil(2009,1,6), Date.civil(2010,1,6)].each do |date|
371
+ assert_equal nil, (Holidays.on(date, :pl)[0] || {})[:name]
372
+ end
373
+ [Date.civil(2008,1,6), Date.civil(2009,1,6), Date.civil(2010,1,6)].each do |date|
374
+ assert_equal 'Objawienie Pańskie (święto Trzech Króli)', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
375
+ end
376
+ [Date.civil(2011,1,6), Date.civil(2012,1,6), Date.civil(2013,1,6)].each do |date|
377
+ assert_equal 'Objawienie Pańskie (święto Trzech Króli)', (Holidays.on(date, :pl)[0] || {})[:name]
378
+ end
379
+
380
+ # Tłusty Czwartek
381
+ [Date.civil(2008,1,31), Date.civil(2009,2,19), Date.civil(2010,2,11),
382
+ Date.civil(2011,3,3), Date.civil(2012,2,16)].each do |date|
383
+ assert_equal 'Tłusty Czwartek', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
384
+ end
385
+
386
+ # Ostatki
387
+ [Date.civil(2008,2,5), Date.civil(2009,2,24), Date.civil(2010,2,16),
388
+ Date.civil(2011,3,8), Date.civil(2012,2,21)].each do |date|
389
+ assert_equal 'Ostatki', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
390
+ end
391
+
392
+ # Środa Popielcowa
393
+ [Date.civil(2008,2,6), Date.civil(2009,2,25), Date.civil(2010,2,17),
394
+ Date.civil(2011,3,9), Date.civil(2012,2,22)].each do |date|
395
+ assert_equal 'Środa Popielcowa', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
396
+ end
397
+
398
+ # Niedziela Palmowa
399
+ [Date.civil(2008,3,16), Date.civil(2009,4,5), Date.civil(2010,3,28),
400
+ Date.civil(2011,4,17), Date.civil(2012,4,1)].each do |date|
401
+ assert_equal 'Niedziela Palmowa', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
402
+ end
403
+
404
+ # Wielki Czwartek
405
+ [Date.civil(2008,3,20), Date.civil(2009,4,9), Date.civil(2010,4,1),
406
+ Date.civil(2011,4,21), Date.civil(2012,4,5)].each do |date|
407
+ assert_equal 'Wielki Czwartek', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
408
+ end
409
+
410
+ # Wielki Piątek
411
+ [Date.civil(2008,3,21), Date.civil(2009,4,10), Date.civil(2010,4,2),
412
+ Date.civil(2011,4,22), Date.civil(2012,4,6)].each do |date|
413
+ assert_equal 'Wielki Piątek', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
414
+ end
415
+
416
+ # Wielka Sobota
417
+ [Date.civil(2008,3,22), Date.civil(2009,4,11), Date.civil(2010,4,3),
418
+ Date.civil(2011,4,23), Date.civil(2012,4,7)].each do |date|
419
+ assert_equal 'Wielka Sobota', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
420
+ end
421
+
422
+ # Niedziela Wielkanocna
423
+ [Date.civil(2008,3,23), Date.civil(2009,4,12), Date.civil(2010,4,4),
424
+ Date.civil(2011,4,24), Date.civil(2012,4,8)].each do |date|
425
+ assert_equal 'Niedziela Wielkanocna', (Holidays.on(date, :pl)[0] || {})[:name]
426
+ end
427
+
428
+ # Poniedziałek Wielkanocny (Lany Poniedziałek)
429
+ [Date.civil(2008,3,24), Date.civil(2009,4,13), Date.civil(2010,4,5),
430
+ Date.civil(2011,4,25), Date.civil(2012,4,9)].each do |date|
431
+ assert_equal 'Poniedziałek Wielkanocny (Lany Poniedziałek)', (Holidays.on(date, :pl)[0] || {})[:name]
432
+ end
433
+
434
+ # Zesłanie Ducha Świętego (Zielone Świątki)
435
+ [Date.civil(2008,5,11), Date.civil(2009,5,31), Date.civil(2010,5,23),
436
+ Date.civil(2011,6,12), Date.civil(2012,5,27)].each do |date|
437
+ assert_equal 'Zesłanie Ducha Świętego (Zielone Świątki)', (Holidays.on(date, :pl)[0] || {})[:name]
438
+ end
439
+
440
+ # Uroczystość Najświętszego Ciała i Krwi Pańskiej (Boże Ciało)
441
+ [Date.civil(2008,5,22), Date.civil(2009,6,11), Date.civil(2010,6,3),
442
+ Date.civil(2011,6,23), Date.civil(2012,6,7)].each do |date|
443
+ assert_equal 'Uroczystość Najświętszego Ciała i Krwi Pańskiej (Boże Ciało)', (Holidays.on(date, :pl)[0] || {})[:name]
444
+ end
445
+
446
+ # Wniebowzięcie Najświętszej Maryi Panny & Święto Wojska Polskiego
447
+ assert_equal 'Wniebowzięcie Najświętszej Maryi Panny', (Holidays.on(Date.civil(2011,8,15), :pl)[0] || {})[:name]
448
+ assert_equal 'Święto Wojska Polskiego', (Holidays.on(Date.civil(2011,8,15), :pl)[1] || {})[:name]
449
+
290
450
  {Date.civil(2008,1,1) => 'Ano Novo',
291
451
  Date.civil(2005,2,8) => 'Carnaval',
292
452
  Date.civil(2006,2,28) => 'Carnaval',
@@ -0,0 +1,35 @@
1
+ # encoding: utf-8
2
+ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
3
+
4
+ # This file is generated by the Ruby Holiday gem.
5
+ #
6
+ # Definitions loaded: data/li.yaml
7
+ class LiDefinitionTests < Test::Unit::TestCase # :nodoc:
8
+
9
+ def test_li
10
+ {Date.civil(2009,1,1) => 'Neujahrstag',
11
+ Date.civil(2011,3,8) => 'Fasnachtsdienstag',
12
+ Date.civil(2009,4,10) => 'Karfreitag',
13
+ Date.civil(2009,4,12) => 'Ostern',
14
+ Date.civil(2009,4,13) => 'Ostermontag',
15
+ Date.civil(2009,5,21) => 'Auffahrt',
16
+ Date.civil(2009,6,1) => 'Pfingstmontag',
17
+ Date.civil(2009,12,25) => 'Weihnachten',
18
+ Date.civil(2009,12,26) => 'Stefanstag'}.each do |date, name|
19
+ assert_equal name, Holidays.on(date, :li, :informal)[0][:name]
20
+ end
21
+
22
+ [:li].each do |r|
23
+ assert_equal 'Fronleichnam', Date.civil(2009,6,11).holidays(r)[0][:name]
24
+ end
25
+
26
+ [:li].each do |r|
27
+ assert_equal 'Staatsfeiertag', Date.civil(2009,8,15).holidays(r)[0][:name]
28
+ end
29
+
30
+ [:li].each do |r|
31
+ assert_equal 'Allerheiligen', Date.civil(2009,11,1).holidays(r)[0][:name]
32
+ end
33
+
34
+ end
35
+ end
@@ -0,0 +1,145 @@
1
+ # encoding: utf-8
2
+ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
3
+
4
+ # This file is generated by the Ruby Holiday gem.
5
+ #
6
+ # Definitions loaded: data/pl.yaml
7
+ class PlDefinitionTests < Test::Unit::TestCase # :nodoc:
8
+
9
+ def test_pl
10
+ {Date.civil(2011,1,1) => 'Nowy Rok',
11
+ Date.civil(2011,5,1) => 'Święto Państwowe (Święto Pracy)',
12
+ Date.civil(2011,5,3) => 'Święto Narodowe Trzeciego Maja',
13
+ Date.civil(2011,11,1) => 'Wszystkich Świętych',
14
+ Date.civil(2011,11,11) => 'Narodowe Święto Niepodległości',
15
+ Date.civil(2011,12,25) => 'pierwszy dzień Bożego Narodzenia',
16
+ Date.civil(2011,12,26) => 'drugi dzień Bożego Narodzenia'}.each do |date, name|
17
+ assert_equal name, (Holidays.on(date, :pl)[0] || {})[:name]
18
+ end
19
+
20
+ # informal
21
+ {Date.civil(2011,1,21) => 'Dzień Babci',
22
+ Date.civil(2011,1,22) => 'Dzień Dziadka',
23
+ Date.civil(2011,2,2) => 'Ofiarowanie Pańskie (Matki Boskiej Gromnicznej)',
24
+ Date.civil(2011,2,14) => 'Dzień Zakochanych (Walentynki)',
25
+ Date.civil(2010,3,8) => 'Dzień Kobiet',
26
+ Date.civil(2011,3,10) => 'Dzień Mężczyzn',
27
+ Date.civil(2011,4,1) => 'Prima Aprilis',
28
+ Date.civil(2010,4,22) => 'Międzynarodowy Dzień Ziemi',
29
+ Date.civil(2011,5,2) => 'Dzień Flagi Rzeczpospolitej Polskiej',
30
+ Date.civil(2010,6,23) => 'Dzień Ojca',
31
+ Date.civil(2011,9,30) => 'Dzień Chłopaka',
32
+ Date.civil(2011,10,14) => 'Dzień Nauczyciela (Dzień Edukacji Narodowej)',
33
+ Date.civil(2011,11,2) => 'Dzień Zaduszny',
34
+ Date.civil(2011,11,29) => 'Andrzejki',
35
+ Date.civil(2011,12,4) => 'Barbórka (Dzień Górnika, Naftowca i Gazownika)',
36
+ Date.civil(2011,12,6) => 'Mikołajki',
37
+ Date.civil(2011,12,24) => 'Wigilia Bożego Narodzenia',
38
+ Date.civil(2011,12,31) => 'Sylwester'}.each do |date, name|
39
+ assert_equal name, (Holidays.on(date, :pl, :informal)[0] || {})[:name]
40
+ end
41
+
42
+ # informal
43
+ {Date.civil(2011,1,21) => 'Dzień Babci',
44
+ Date.civil(2011,1,22) => 'Dzień Dziadka',
45
+ Date.civil(2011,2,2) => 'Ofiarowanie Pańskie (Matki Boskiej Gromnicznej)',
46
+ Date.civil(2011,2,14) => 'Dzień Zakochanych (Walentynki)',
47
+ Date.civil(2010,3,8) => 'Dzień Kobiet',
48
+ Date.civil(2011,3,10) => 'Dzień Mężczyzn',
49
+ Date.civil(2011,4,1) => 'Prima Aprilis',
50
+ Date.civil(2010,4,22) => 'Międzynarodowy Dzień Ziemi',
51
+ Date.civil(2011,5,2) => 'Dzień Flagi Rzeczpospolitej Polskiej',
52
+ Date.civil(2010,6,23) => 'Dzień Ojca',
53
+ Date.civil(2011,9,30) => 'Dzień Chłopaka',
54
+ Date.civil(2011,10,14) => 'Dzień Nauczyciela (Dzień Edukacji Narodowej)',
55
+ Date.civil(2011,11,2) => 'Dzień Zaduszny',
56
+ Date.civil(2011,11,29) => 'Andrzejki',
57
+ Date.civil(2011,12,4) => 'Barbórka (Dzień Górnika, Naftowca i Gazownika)',
58
+ Date.civil(2011,12,6) => 'Mikołajki',
59
+ Date.civil(2011,12,24) => 'Wigilia Bożego Narodzenia',
60
+ Date.civil(2011,12,31) => 'Sylwester'}.each do |date, name|
61
+ assert_equal nil, (Holidays.on(date, :pl)[0] || {})[:name]
62
+ end
63
+
64
+ # Objawienie Pańskie (święto Trzech Króli) -- formal since 2011
65
+ [Date.civil(2008,1,6), Date.civil(2009,1,6), Date.civil(2010,1,6)].each do |date|
66
+ assert_equal nil, (Holidays.on(date, :pl)[0] || {})[:name]
67
+ end
68
+ [Date.civil(2008,1,6), Date.civil(2009,1,6), Date.civil(2010,1,6)].each do |date|
69
+ assert_equal 'Objawienie Pańskie (święto Trzech Króli)', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
70
+ end
71
+ [Date.civil(2011,1,6), Date.civil(2012,1,6), Date.civil(2013,1,6)].each do |date|
72
+ assert_equal 'Objawienie Pańskie (święto Trzech Króli)', (Holidays.on(date, :pl)[0] || {})[:name]
73
+ end
74
+
75
+ # Tłusty Czwartek
76
+ [Date.civil(2008,1,31), Date.civil(2009,2,19), Date.civil(2010,2,11),
77
+ Date.civil(2011,3,3), Date.civil(2012,2,16)].each do |date|
78
+ assert_equal 'Tłusty Czwartek', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
79
+ end
80
+
81
+ # Ostatki
82
+ [Date.civil(2008,2,5), Date.civil(2009,2,24), Date.civil(2010,2,16),
83
+ Date.civil(2011,3,8), Date.civil(2012,2,21)].each do |date|
84
+ assert_equal 'Ostatki', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
85
+ end
86
+
87
+ # Środa Popielcowa
88
+ [Date.civil(2008,2,6), Date.civil(2009,2,25), Date.civil(2010,2,17),
89
+ Date.civil(2011,3,9), Date.civil(2012,2,22)].each do |date|
90
+ assert_equal 'Środa Popielcowa', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
91
+ end
92
+
93
+ # Niedziela Palmowa
94
+ [Date.civil(2008,3,16), Date.civil(2009,4,5), Date.civil(2010,3,28),
95
+ Date.civil(2011,4,17), Date.civil(2012,4,1)].each do |date|
96
+ assert_equal 'Niedziela Palmowa', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
97
+ end
98
+
99
+ # Wielki Czwartek
100
+ [Date.civil(2008,3,20), Date.civil(2009,4,9), Date.civil(2010,4,1),
101
+ Date.civil(2011,4,21), Date.civil(2012,4,5)].each do |date|
102
+ assert_equal 'Wielki Czwartek', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
103
+ end
104
+
105
+ # Wielki Piątek
106
+ [Date.civil(2008,3,21), Date.civil(2009,4,10), Date.civil(2010,4,2),
107
+ Date.civil(2011,4,22), Date.civil(2012,4,6)].each do |date|
108
+ assert_equal 'Wielki Piątek', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
109
+ end
110
+
111
+ # Wielka Sobota
112
+ [Date.civil(2008,3,22), Date.civil(2009,4,11), Date.civil(2010,4,3),
113
+ Date.civil(2011,4,23), Date.civil(2012,4,7)].each do |date|
114
+ assert_equal 'Wielka Sobota', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
115
+ end
116
+
117
+ # Niedziela Wielkanocna
118
+ [Date.civil(2008,3,23), Date.civil(2009,4,12), Date.civil(2010,4,4),
119
+ Date.civil(2011,4,24), Date.civil(2012,4,8)].each do |date|
120
+ assert_equal 'Niedziela Wielkanocna', (Holidays.on(date, :pl)[0] || {})[:name]
121
+ end
122
+
123
+ # Poniedziałek Wielkanocny (Lany Poniedziałek)
124
+ [Date.civil(2008,3,24), Date.civil(2009,4,13), Date.civil(2010,4,5),
125
+ Date.civil(2011,4,25), Date.civil(2012,4,9)].each do |date|
126
+ assert_equal 'Poniedziałek Wielkanocny (Lany Poniedziałek)', (Holidays.on(date, :pl)[0] || {})[:name]
127
+ end
128
+
129
+ # Zesłanie Ducha Świętego (Zielone Świątki)
130
+ [Date.civil(2008,5,11), Date.civil(2009,5,31), Date.civil(2010,5,23),
131
+ Date.civil(2011,6,12), Date.civil(2012,5,27)].each do |date|
132
+ assert_equal 'Zesłanie Ducha Świętego (Zielone Świątki)', (Holidays.on(date, :pl)[0] || {})[:name]
133
+ end
134
+
135
+ # Uroczystość Najświętszego Ciała i Krwi Pańskiej (Boże Ciało)
136
+ [Date.civil(2008,5,22), Date.civil(2009,6,11), Date.civil(2010,6,3),
137
+ Date.civil(2011,6,23), Date.civil(2012,6,7)].each do |date|
138
+ assert_equal 'Uroczystość Najświętszego Ciała i Krwi Pańskiej (Boże Ciało)', (Holidays.on(date, :pl)[0] || {})[:name]
139
+ end
140
+
141
+ # Wniebowzięcie Najświętszej Maryi Panny & Święto Wojska Polskiego
142
+ assert_equal 'Wniebowzięcie Najświętszej Maryi Panny', (Holidays.on(Date.civil(2011,8,15), :pl)[0] || {})[:name]
143
+ assert_equal 'Święto Wojska Polskiego', (Holidays.on(Date.civil(2011,8,15), :pl)[1] || {})[:name]
144
+ end
145
+ end