aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/clean_up_spec.rb
diff options
context:
space:
mode:
authorcedricnjanga2017-07-12 11:00:07 +0200
committercedricnjanga2017-07-12 11:06:32 +0200
commitc120db456568dfcc6bb4f0653fc9d9ffa3f1a80a (patch)
tree18e2d60121bd17c2b53f7b4ce7a09c2fbda21897 /spec/models/clean_up_spec.rb
parent74da5aa9fdfa792cfbef2fcfc23c35d9a0b19408 (diff)
downloadchouette-core-c120db456568dfcc6bb4f0653fc9d9ffa3f1a80a.tar.bz2
#4028 Clean Up end date must be greater than begin date
Diffstat (limited to 'spec/models/clean_up_spec.rb')
-rw-r--r--spec/models/clean_up_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/models/clean_up_spec.rb b/spec/models/clean_up_spec.rb
index e03921582..2753c8718 100644
--- a/spec/models/clean_up_spec.rb
+++ b/spec/models/clean_up_spec.rb
@@ -6,6 +6,18 @@ RSpec.describe CleanUp, :type => :model do
it { should validate_presence_of(:begin_date).with_message(:presence) }
it { should belong_to(:referential) }
+ context 'Clean Up With Date Type : Between' do
+ subject(:cleaner) { create(:clean_up, date_type: :between) }
+ it { should validate_presence_of(:end_date).with_message(:presence) }
+
+ it 'should have a end date strictly greater than the begin date' do
+ expect(cleaner).to be_valid
+
+ cleaner.end_date = cleaner.begin_date
+ expect(cleaner).not_to be_valid
+ end
+ end
+
context '#exclude_dates_in_overlapping_period with :before date_type' do
let(:time_table) { create(:time_table) }
let(:period) { time_table.periods[0] }