|
30 | 30 | end |
31 | 31 | end |
32 | 32 |
|
| 33 | + context "with an Flu session and eligible patient" do |
| 34 | + let(:programmes) { [create(:programme, :flu)] } |
| 35 | + let(:patient) { create(:patient, year_group: 8) } |
| 36 | + |
| 37 | + it "creates a consent status" do |
| 38 | + expect { call }.to change(patient.consent_statuses, :count).by(1) |
| 39 | + expect(patient.consent_statuses.first).to be_no_response |
| 40 | + end |
| 41 | + |
| 42 | + context "when consent is given" do |
| 43 | + before { create(:consent, patient:, programme: programmes.first) } |
| 44 | + |
| 45 | + it "sets the vaccine methods" do |
| 46 | + expect { call }.to change(patient.consent_statuses, :count).by(1) |
| 47 | + expect(patient.consent_statuses.first).to be_vaccine_method_injection |
| 48 | + end |
| 49 | + end |
| 50 | + |
| 51 | + it "creates a registration status" do |
| 52 | + expect { call }.to change { |
| 53 | + patient_session.reload.registration_status |
| 54 | + }.from(nil) |
| 55 | + expect(patient_session.registration_status).to be_unknown |
| 56 | + end |
| 57 | + |
| 58 | + it "creates a triage status" do |
| 59 | + expect { call }.to change(patient.triage_statuses, :count).by(1) |
| 60 | + expect(patient.triage_statuses.first).to be_not_required |
| 61 | + end |
| 62 | + |
| 63 | + it "creates a patient vaccination status" do |
| 64 | + expect { call }.to change(patient.vaccination_statuses, :count).by(1) |
| 65 | + expect(patient.vaccination_statuses.first).to be_none_yet |
| 66 | + end |
| 67 | + |
| 68 | + it "creates a patient session session vaccination status" do |
| 69 | + expect { call }.to change(patient_session.session_statuses, :count).by(1) |
| 70 | + expect(patient_session.session_statuses.first).to be_none_yet |
| 71 | + end |
| 72 | + end |
| 73 | + |
33 | 74 | context "with an HPV session and eligible patient" do |
34 | 75 | let(:programmes) { [create(:programme, :hpv)] } |
35 | 76 | let(:patient) { create(:patient, year_group: 8) } |
|
0 commit comments