diff options
author | Gareth Rees <gareth@mysociety.org> | 2015-04-30 10:10:27 +0100 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2015-04-30 10:10:27 +0100 |
commit | 3eedb794df41ffe02e6c613cdbfe1b69ad669378 (patch) | |
tree | f5bec685aa2dbecab6af5ef89341960e15ecbf3f /spec/models | |
parent | 842d4f92d8f2fdd9d9fcb789a62cb364cdb87d82 (diff) | |
parent | 196cce975887aca513b0fca6e90f8024aff981e5 (diff) |
Merge branch 'hotfix/0.21.0.24' 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 |