Skip to content

Commit b39ec21

Browse files
committed
Send vaccination records to NHSE on recording
... from the UI. Jira-Issue: MAV-1482
1 parent 8a1b9ba commit b39ec21

5 files changed

Lines changed: 42 additions & 0 deletions

app/controllers/draft_vaccination_records_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ def handle_confirm
120120

121121
send_vaccination_confirmation(@vaccination_record) if should_notify_parents
122122

123+
EnqueueSyncVaccinationRecordToNHSE.call(@vaccination_record)
124+
123125
# In case the user navigates back to try and edit the newly created
124126
# vaccination record.
125127
@draft_vaccination_record.update!(editing_id: @vaccination_record.id)

spec/features/flu_vaccination_administered_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
given_i_am_signed_in_with_flu_programme
88
and_there_is_a_flu_session_today_with_two_patients_ready_to_vaccinate
99
and_there_are_nasal_and_injection_batches
10+
and_sync_vaccination_records_to_nhse_on_create_feature_is_enabled
1011

1112
when_i_go_to_the_nasal_only_patient
1213
and_i_record_that_the_patient_has_been_vaccinated_with_nasal_spray
1314
then_i_see_the_check_and_confirm_page_for_nasal_spray
1415
and_i_get_confirmation_after_recording
16+
and_the_vaccination_record_is_synced_to_nhse
1517
end
1618

1719
scenario "Administered with injection" do
@@ -91,6 +93,10 @@ def and_there_are_nasal_and_injection_batches
9193
)
9294
end
9395

96+
def and_sync_vaccination_records_to_nhse_on_create_feature_is_enabled
97+
Flipper.enable(:sync_vaccination_records_to_nhse_on_create)
98+
end
99+
94100
def when_i_go_to_the_nasal_only_patient
95101
visit session_record_path(@session)
96102
@patient = @nasal_patient
@@ -170,4 +176,8 @@ def and_i_pick_a_batch_for_injection
170176
choose @injection_batch.name
171177
click_button "Continue"
172178
end
179+
180+
def and_the_vaccination_record_is_synced_to_nhse
181+
assert_enqueued_with(job: SyncVaccinationRecordToNHSEJob)
182+
end
173183
end

spec/features/hpv_vaccination_administered_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
scenario "Administered with common delivery site" do
77
given_i_am_signed_in
8+
and_sync_vaccination_records_to_nhse_on_create_feature_is_enabled
89

910
when_i_go_to_a_patient_that_is_ready_to_vaccinate
1011
and_i_fill_in_pre_screening_questions
@@ -41,6 +42,7 @@
4142
then_i_see_a_success_message
4243
and_i_can_no_longer_vaccinate_the_patient
4344
and_i_no_longer_see_the_patient_in_the_record_tab
45+
and_the_vaccination_record_is_synced_to_nhse
4446

4547
when_i_go_back
4648
and_i_save_changes
@@ -104,6 +106,10 @@ def given_i_am_signed_in
104106
sign_in organisation.users.first
105107
end
106108

109+
def and_sync_vaccination_records_to_nhse_on_create_feature_is_enabled
110+
Flipper.enable(:sync_vaccination_records_to_nhse_on_create)
111+
end
112+
107113
def when_i_go_to_a_patient_that_is_ready_to_vaccinate
108114
visit session_record_path(@session)
109115
click_link @patient.full_name
@@ -242,4 +248,8 @@ def and_a_text_is_sent_to_the_parent_confirming_the_vaccination
242248
:vaccination_administered_hpv
243249
)
244250
end
251+
252+
def and_the_vaccination_record_is_synced_to_nhse
253+
assert_enqueued_with(job: SyncVaccinationRecordToNHSEJob)
254+
end
245255
end

spec/features/menacwy_vaccination_administered_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
scenario "Administered" do
77
given_i_am_signed_in
8+
and_sync_vaccination_records_to_nhse_on_create_feature_is_enabled
89

910
when_i_go_to_a_patient_that_is_ready_to_vaccinate
1011
and_i_record_that_the_patient_has_been_vaccinated
@@ -37,6 +38,7 @@
3738
when_i_confirm_the_details
3839
then_i_see_a_success_message
3940
and_i_no_longer_see_the_patient_in_the_record_tab
41+
and_the_vaccination_record_is_not_synced_to_nhse
4042

4143
when_i_go_back
4244
and_i_save_changes
@@ -82,6 +84,10 @@ def given_i_am_signed_in
8284
sign_in organisation.users.first
8385
end
8486

87+
def and_sync_vaccination_records_to_nhse_on_create_feature_is_enabled
88+
Flipper.enable(:sync_vaccination_records_to_nhse_on_create)
89+
end
90+
8591
def when_i_go_to_a_patient_that_is_ready_to_vaccinate
8692
visit session_record_path(@session)
8793
click_link @patient.full_name
@@ -200,4 +206,8 @@ def and_a_text_is_sent_to_the_parent_confirming_the_vaccination
200206
:vaccination_administered_menacwy
201207
)
202208
end
209+
210+
def and_the_vaccination_record_is_not_synced_to_nhse
211+
assert_no_enqueued_jobs(only: SyncVaccinationRecordToNHSEJob)
212+
end
203213
end

spec/features/td_ipv_vaccination_administered_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
scenario "Administered" do
77
given_i_am_signed_in
8+
and_sync_vaccination_records_to_nhse_on_create_feature_is_enabled
89

910
when_i_go_to_a_patient_that_is_ready_to_vaccinate
1011
and_i_record_that_the_patient_has_been_vaccinated
@@ -37,6 +38,7 @@
3738
when_i_confirm_the_details
3839
then_i_see_a_success_message
3940
and_i_no_longer_see_the_patient_in_the_record_tab
41+
and_the_vaccination_record_is_not_synced_to_nhse
4042

4143
when_i_go_back
4244
and_i_save_changes
@@ -82,6 +84,10 @@ def given_i_am_signed_in
8284
sign_in organisation.users.first
8385
end
8486

87+
def and_sync_vaccination_records_to_nhse_on_create_feature_is_enabled
88+
Flipper.enable(:sync_vaccination_records_to_nhse_on_create)
89+
end
90+
8591
def when_i_go_to_a_patient_that_is_ready_to_vaccinate
8692
visit session_record_path(@session)
8793
click_link @patient.full_name
@@ -200,4 +206,8 @@ def and_a_text_is_sent_to_the_parent_confirming_the_vaccination
200206
:vaccination_administered_td_ipv
201207
)
202208
end
209+
210+
def and_the_vaccination_record_is_not_synced_to_nhse
211+
assert_no_enqueued_jobs(only: SyncVaccinationRecordToNHSEJob)
212+
end
203213
end

0 commit comments

Comments
 (0)