aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlban Peignier2018-04-22 16:55:49 +0200
committerAlban Peignier2018-04-22 16:55:49 +0200
commitfdd91bf918c9aaf35d8381c553652458c850b609 (patch)
tree2fb9548ebeccec20fea91dff7ebe2ead696db676
parente7710e8e81eef65f07c441d9efa0562e10b6284c (diff)
downloadchouette-core-fdd91bf918c9aaf35d8381c553652458c850b609.tar.bz2
Fixes Calendar::Period specs. Refs #5519
-rw-r--r--spec/models/calendar/period_spec.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/spec/models/calendar/period_spec.rb b/spec/models/calendar/period_spec.rb
index 233733cbf..0e77c632c 100644
--- a/spec/models/calendar/period_spec.rb
+++ b/spec/models/calendar/period_spec.rb
@@ -5,7 +5,7 @@ RSpec.describe Calendar::Period, type: :model do
def period(attributes = {})
@__period__ ||= {}
- @__period__.fetch(attributes){
+ @__period__.fetch(attributes){
@__period__[attributes] = Calendar::Period.new(attributes)
}
end
@@ -36,12 +36,15 @@ RSpec.describe Calendar::Period, type: :model do
it { is_expected.to validate_presence_of(:begin) }
it { is_expected.to validate_presence_of(:end) }
- it 'should validate that end is greather than or equlals to begin' do
+ it 'should validate that end is greather than to begin' do
expect(period(begin: '2016-11-21', end: '2016-11-22')).to be_valid
- expect(period(begin: '2016-11-21', end: '2016-11-21')).to_not be_valid
expect(period(begin: '2016-11-22', end: '2016-11-21')).to_not be_valid
end
+ it 'should accept a 1-day period' do
+ expect(period(begin: '2016-11-21', end: '2016-11-21')).to be_valid
+ end
+
describe 'intersect?' do
it 'should detect date in common with other date_ranges' do
november = period(begin: '2016-11-01', end: '2016-11-30')