From ad9e5c93133bf38eec1a9a2c533e783846936de8 Mon Sep 17 00:00:00 2001 From: Zog Date: Thu, 19 Apr 2018 14:30:06 +0200 Subject: Refs #5519; Authorize 1-day calendars --- app/models/calendar/period.rb | 2 +- config/locales/line_referentials.en.yml | 2 +- spec/models/chouette/purchase_window_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/calendar/period.rb b/app/models/calendar/period.rb index 07926e818..c549a7575 100644 --- a/app/models/calendar/period.rb +++ b/app/models/calendar/period.rb @@ -16,7 +16,7 @@ class Calendar < ApplicationModel alias_method :period_end=, :end= def check_end_greather_than_begin - if self.begin && self.end && self.begin >= self.end + if self.begin && self.end && self.begin > self.end errors.add(:base, I18n.t('calendars.errors.short_period')) end end diff --git a/config/locales/line_referentials.en.yml b/config/locales/line_referentials.en.yml index 18ff28c24..6c15b340a 100644 --- a/config/locales/line_referentials.en.yml +++ b/config/locales/line_referentials.en.yml @@ -9,7 +9,7 @@ en: show: title: Line referential synchronized: Synchronized - status: Status + state: Status message: Message activerecord: models: diff --git a/spec/models/chouette/purchase_window_spec.rb b/spec/models/chouette/purchase_window_spec.rb index 702a44eeb..5e81108e1 100644 --- a/spec/models/chouette/purchase_window_spec.rb +++ b/spec/models/chouette/purchase_window_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Chouette::PurchaseWindow, :type => :model do describe 'validations' do it 'validates and date_ranges do not overlap' do expect(build(:purchase_window, referential: referential,date_ranges: [Date.today..Date.today + 10.day, Date.yesterday..Date.tomorrow])).to_not be_valid - # expect(build(periods: [Date.today..Date.today + 10.day, Date.yesterday..Date.tomorrow ])).to_not be_valid + expect(build(:purchase_window, referential: referential,date_ranges: [Date.today..Date.today])).to be_valid end end -- cgit v1.2.3