diff options
| author | Robert | 2017-06-23 17:25:43 +0200 |
|---|---|---|
| committer | Robert | 2017-06-23 17:25:43 +0200 |
| commit | 9abf17639260e5fe57565c876d16483f33765daf (patch) | |
| tree | 54601f40305cd7a1dec61d6afdd062aa5786d723 /spec | |
| parent | 1ba9e1439ec0fce45676aa6eff04d5f9ce12a524 (diff) | |
| parent | d245c7bc9abab607c6d6e139057dba8ab47a0cec (diff) | |
| download | chouette-core-9abf17639260e5fe57565c876d16483f33765daf.tar.bz2 | |
Merge branch '3605_cal_end_period'
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/models/calendar_spec.rb | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/spec/models/calendar_spec.rb b/spec/models/calendar_spec.rb index 33d9676cd..222e6283f 100644 --- a/spec/models/calendar_spec.rb +++ b/spec/models/calendar_spec.rb @@ -109,15 +109,11 @@ RSpec.describe Calendar, :type => :model do let(:calendar) { create(:calendar, date_ranges: []) } it 'shoud fill date_ranges with date ranges' do - expected_ranges = [ - Range.new(Date.today, Date.tomorrow) - ] - expected_ranges.each_with_index do |range, index| - calendar.date_ranges << Calendar::Period.from_range(index, range) - end + expected_range = Date.today..Date.tomorrow + calendar.date_ranges << expected_range calendar.valid? - expect(calendar.date_ranges.map { |period| period.begin..period.end }).to eq(expected_ranges) + expect(calendar.date_ranges.map { |period| period.begin..period.end }).to eq([expected_range]) end end |
