File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -181,7 +181,7 @@ def call
181181 user : @user
182182 )
183183
184- patient_to_destroy . reload . destroy!
184+ PatientDeleter . call ( patients : Patient . where ( id : patient_to_destroy . id ) )
185185
186186 PatientStatusUpdater . call ( patient : patient_to_keep )
187187 end
Original file line number Diff line number Diff line change 14461446 end
14471447 end
14481448
1449- describe "#destroy_childless_parents" do
1450- context "when parent has only one child" do
1451- let ( :parent ) { create ( :parent ) }
1452- let! ( :patient ) { create ( :patient , parents : [ parent ] ) }
1453-
1454- it "destroys the parent when the patient is destroyed" do
1455- expect { patient . destroy } . to change ( Parent , :count ) . by ( -1 )
1456- end
1457- end
1458-
1459- context "when parent has multiple children" do
1460- let ( :parent ) { create ( :parent ) }
1461- let! ( :patient ) { create ( :patient , parents : [ parent ] ) }
1462-
1463- before { create ( :patient , parents : [ parent ] ) }
1464-
1465- it "does not destroy the parent when one patient is destroyed" do
1466- expect { patient . destroy } . not_to change ( Parent , :count )
1467- end
1468- end
1469-
1470- context "when patient has multiple parents" do
1471- let! ( :patient ) { create ( :patient , parents : create_list ( :parent , 2 ) ) }
1472-
1473- it "destroys only the childless parents" do
1474- expect { patient . destroy } . to change ( Parent , :count ) . by ( -2 )
1475- end
1476- end
1477- end
1478-
14791449 describe "#latest_pds_search_result" do
14801450 subject ( :latest_pds_search_result ) { patient . latest_pds_search_result }
14811451
You can’t perform that action at this time.
0 commit comments