File tree Expand file tree Collapse file tree
app/controllers/api/reporting
spec/controllers/api/reporting Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -178,7 +178,6 @@ def latest_scoped_consents
178178 . where ( team_id : @team &.id || current_user . team_ids )
179179 . where ( academic_year : params [ :academic_year ] )
180180 . not_invalidated
181- . not_withdrawn
182181 . response_provided
183182
184183 if params [ :programme ] . present?
Original file line number Diff line number Diff line change 564564 expect ( routes [ "self_consent" ] ) . to eq ( 1 )
565565 end
566566
567- it "excludes invalidated and withdrawn consents" do
567+ it "excludes invalidated consents but includes withdrawn consents" do
568568 patient = create ( :patient , session :)
569569 parent_one = create ( :parent )
570570 parent_two = create ( :parent )
578578 programme :,
579579 team :,
580580 parent : parent_one ,
581- reason_for_refusal : "medical_reasons"
581+ reason_for_refusal : "medical_reasons" ,
582+ route : "website"
582583 )
583584 create (
584585 :consent ,
585- :refused ,
586586 :withdrawn ,
587587 patient :,
588588 programme :,
589589 team :,
590590 parent : parent_two ,
591- reason_for_refusal : "personal_choice"
591+ reason_for_refusal : "personal_choice" ,
592+ route : "self_consent"
592593 )
593594 PatientStatusUpdater . call ( patient :)
594595
598599
599600 reasons = parsed_response [ "consent_refusal_reasons" ]
600601 expect ( reasons [ "medical_reasons" ] ) . to eq ( 0 )
601- expect ( reasons [ "personal_choice" ] ) . to eq ( 0 )
602+ expect ( reasons [ "personal_choice" ] ) . to eq ( 1 )
603+
604+ routes = parsed_response [ "consent_routes" ]
605+ expect ( routes [ "website" ] ) . to eq ( 0 )
606+ expect ( routes [ "self_consent" ] ) . to eq ( 1 )
602607 end
603608 end
604609 end
You can’t perform that action at this time.
0 commit comments