diff --git a/lib/holidays/pt.rb b/lib/holidays/pt.rb index 3f3bab2..8ab57df 100644 --- a/lib/holidays/pt.rb +++ b/lib/holidays/pt.rb @@ -3,7 +3,7 @@ module Holidays # # Definitions loaded: data/pt.yaml # - # To use the definitions in this file, load them right after you load the + # To use the definitions in this file, load them right after you load the # Holiday gem: # # require 'holidays' @@ -11,23 +11,28 @@ module Holidays # # More definitions are available at http://code.dunae.ca/holidays. module PT # :nodoc: - DEFINED_REGIONS = [:pt] + DEFINED_REGIONS = [:pt, :pt_br] HOLIDAYS_BY_MONTH = { 5 => [{:mday => 1, :name => "Dia do Trabalhador", :regions => [:pt]}], - 0 => [{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :type => :informal, :name => "Carnaval", :regions => [:pt]}, - {:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Sexta-feira Santa", :regions => [:pt]}, - {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páscoa", :regions => [:pt]}, + 0 => [{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :type => :informal, :name => "Carnaval", :regions => [:pt, :pt_br]}, + {:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Sexta-feira Santa", :regions => [:pt, :pt_br]}, + {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páscoa", :regions => [:pt, :pt_br]}, {:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Corpo de Deus", :regions => [:pt]}], - 11 => [{:mday => 1, :name => "Todos os Santos", :regions => [:pt]}], + 11 => [{:mday => 1, :name => "Todos os Santos", :regions => [:pt]}, + {:mday => 2, :name => "Finados", :regions => [:pt_br]}, + {:mday => 15, :name => "Proclamação da República", :regions => [:pt_br]}], 6 => [{:mday => 10, :name => "Dia de Portugal", :regions => [:pt]}], 1 => [{:mday => 1, :name => "Ano Novo", :regions => [:pt]}], 12 => [{:mday => 1, :name => "Restauração da Independência", :regions => [:pt]}, {:mday => 8, :name => "Imaculada Conceição", :regions => [:pt]}, - {:mday => 25, :name => "Natal", :regions => [:pt]}], + {:mday => 25, :name => "Natal", :regions => [:pt, :pt_br]}], 8 => [{:mday => 15, :name => "Assunção de Nossa Senhora", :regions => [:pt]}], - 4 => [{:mday => 25, :name => "Dia da Liberdade", :regions => [:pt]}], - 10 => [{:mday => 5, :name => "Implantação da República", :regions => [:pt]}] + 4 => [{:mday => 25, :name => "Dia da Liberdade", :regions => [:pt]}, + {:mday => 21, :name => "Tiradentes", :regions => [:pt_br]}], + 10 => [{:mday => 5, :name => "Implantação da República", :regions => [:pt]}, + {:mday => 12, :name => "Nossa Senhora Aparecida", :regions => [:pt_br]}], + 9 => [{:mday => 7, :name => "Independência do Brasil", :regions => [:pt_br]}] } end @@ -35,3 +40,4 @@ module Holidays end Holidays.merge_defs(Holidays::PT::DEFINED_REGIONS, Holidays::PT::HOLIDAYS_BY_MONTH) + diff --git a/test/defs/test_defs_pt.rb b/test/defs/test_defs_pt.rb index 0a3ee20..26c4f86 100644 --- a/test/defs/test_defs_pt.rb +++ b/test/defs/test_defs_pt.rb @@ -7,12 +7,12 @@ require 'holidays/pt' class PtDefinitionTests < Test::Unit::TestCase # :nodoc: def test_pt -{Date.civil(2008,1,1) => 'Ano Novo', +{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,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', @@ -29,4 +29,28 @@ class PtDefinitionTests < Test::Unit::TestCase # :nodoc: assert_equal name, Holidays.on(date, :pt, :informal)[0][:name] end end + + def test_pt_br + { + 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,3,21) => 'Sexta-feira Santa', + Date.civil(2008,3,23) => 'Páscoa', + 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,4,21) => 'Tiradentes', + Date.civil(2008,5,1) => 'Dia do Trabalhador', + Date.civil(2008,9,7) => 'Independência do Brasil', + Date.civil(2008,10,12) => 'Nossa Senhora Aparecida', + Date.civil(2008,11,2) => 'Finados', + Date.civil(2008,11,15) => 'Proclamação da República', + Date.civil(2008,12,25) => 'Natal' + }.each do |date, name| + assert_equal name, Holidays.on(date, :pt_br, :informal)[0][:name] + end + end end +