aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/calendar_spec.rb
diff options
context:
space:
mode:
authorRobert2017-06-23 17:01:00 +0200
committerRobert2017-06-23 17:25:20 +0200
commitd245c7bc9abab607c6d6e139057dba8ab47a0cec (patch)
tree9f511d1ace0eb396d640118063693e1e3a9228ad /spec/models/calendar_spec.rb
parent509a52c5d7d4aae55debab1bdcb8e6a0802f46ff (diff)
downloadchouette-core-d245c7bc9abab607c6d6e139057dba8ab47a0cec.tar.bz2
Fixes: #3605@2h, also refact of models/calendar
Diffstat (limited to 'spec/models/calendar_spec.rb')
-rw-r--r--spec/models/calendar_spec.rb10
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