File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -247,8 +247,8 @@ def as_json
247247 private
248248
249249 def confirm_appointment_after_initial_call
250- if appointment_date . present? && initial_call_date &.send ( :> , appointment_date )
251- errors . add ( :appointment_date , 'must be after date of initial call' )
250+ if appointment_date . present? && initial_call_date . present? && ( initial_call_date - 60 . days ) &.send ( :> , appointment_date )
251+ errors . add ( :appointment_date , 'must be closer to the date of initial call' )
252252 end
253253 end
254254
Original file line number Diff line number Diff line change @@ -79,19 +79,19 @@ class PatientTest < ActiveSupport::TestCase
7979 end
8080 end
8181
82- it 'should require appointment_date to be after initial_call_date' do
82+ it 'should require appointment_date to be reasonably after initial_call_date' do
8383 # when initial call date is nil
8484 @patient . appointment_date = '2016-05-01'
8585 @patient . initial_call_date = nil
8686 refute @patient . valid?
8787 # when initial call date is after appointment date
88- @patient . initial_call_date = '2016-06 -01'
88+ @patient . initial_call_date = '2016-09 -01'
8989 refute @patient . valid?
9090 # when appointment date is nil
9191 @patient . appointment_date = nil
9292 assert @patient . valid?
9393 # when appointment date is after initial call date
94- @patient . appointment_date = '2016-07 -01'
94+ @patient . appointment_date = '2016-08 -01'
9595 assert @patient . valid?
9696 end
9797
You can’t perform that action at this time.
0 commit comments