diff options
author | Louise Crow <louise.crow@gmail.com> | 2015-04-30 10:15:54 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2015-04-30 10:15:54 +0100 |
commit | c11fd63b39fdb4030a3714a0fb4fd11db31eac7d (patch) | |
tree | 5b0f409ebb4581a64532b0b10217e9a451d4e344 /spec/models | |
parent | a48e18ac9ee891e04d6082d8efb126017e69ea87 (diff) | |
parent | cad1d485718b3c08a31f6063c0a799ed8c1e8225 (diff) |
Merge branch 'rails-3-develop' of ssh://git.mysociety.org/data/git/public/alaveteli into rails-3-develop
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/holiday_import_spec.rb | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/spec/models/holiday_import_spec.rb b/spec/models/holiday_import_spec.rb index 21061f63f..7ec5c04d5 100644 --- a/spec/models/holiday_import_spec.rb +++ b/spec/models/holiday_import_spec.rb @@ -88,21 +88,35 @@ describe HolidayImport do describe 'when populating a set of holidays to import from suggestions' do - before do - holidays = [ { :date => Date.new(2014, 1, 1), :name => "New Year's Day", :regions => [:gb] } ] + it 'should populate holidays from the suggestions' do + holidays = [ { :date => Date.new(2014, 1, 1), + :name => "New Year's Day", + :regions => [:gb] } ] Holidays.stub!(:between).and_return(holidays) @holiday_import = HolidayImport.new(:source => 'suggestions') @holiday_import.populate - end - it 'should populate holidays from the suggestions' do @holiday_import.holidays.size.should == 1 holiday = @holiday_import.holidays.first holiday.description.should == "New Year's Day" holiday.day.should == Date.new(2014, 1, 1) end + it 'returns an empty array for an unknown country code' do + AlaveteliConfiguration.stub(:iso_country_code).and_return('UNKNOWN_COUNTRY_CODE') + @holiday_import = HolidayImport.new(:source => 'suggestions') + @holiday_import.populate + expect(@holiday_import.holidays).to be_empty + end + it 'should return a flag that it has been populated' do + holidays = [ { :date => Date.new(2014, 1, 1), + :name => "New Year's Day", + :regions => [:gb] } ] + Holidays.stub!(:between).and_return(holidays) + @holiday_import = HolidayImport.new(:source => 'suggestions') + @holiday_import.populate + @holiday_import.populated.should == true end |