|
1 | 1 | # frozen_string_literal: true |
2 | 2 |
|
3 | 3 | describe AppVaccinateFormComponent do |
4 | | - subject { render_inline(component) } |
5 | | - |
6 | 4 | let(:programme) { Programme.sample } |
7 | 5 | let(:programmes) { [programme] } |
8 | 6 |
|
|
27 | 25 |
|
28 | 26 | let(:component) { described_class.new(vaccinate_form) } |
29 | 27 |
|
30 | | - it { should have_css(".nhsuk-card") } |
| 28 | + describe "#render" do |
| 29 | + subject { render_inline(component) } |
31 | 30 |
|
32 | | - context "with a flu programme" do |
33 | | - let(:programme) { Programme.flu } |
| 31 | + it { should have_css(".nhsuk-card") } |
34 | 32 |
|
35 | | - it { should have_content("Has Hari confirmed their identity?") } |
36 | | - it { should have_field("No, it was confirmed by somebody else") } |
| 33 | + context "with a flu programme" do |
| 34 | + let(:programme) { Programme.flu } |
37 | 35 |
|
38 | | - it { should have_heading("Is Hari ready for their flu injection?") } |
| 36 | + it { should have_content("Has Hari confirmed their identity?") } |
| 37 | + it { should have_field("No, it was confirmed by somebody else") } |
39 | 38 |
|
40 | | - it { should have_field("Yes") } |
41 | | - it { should have_field("No") } |
| 39 | + it { should have_heading("Is Hari ready for their flu injection?") } |
42 | 40 |
|
43 | | - it { should have_field("Left arm (upper position)") } |
44 | | - it { should have_field("Right arm (upper position)") } |
45 | | - it { should_not have_field("Nose") } |
46 | | - it { should have_field("Other") } |
47 | | - end |
| 41 | + it { should have_field("Yes") } |
| 42 | + it { should have_field("No") } |
48 | 43 |
|
49 | | - context "with a flu programme and consent to nasal spray" do |
50 | | - let(:programme) { Programme.flu } |
51 | | - let(:academic_year) { AcademicYear.current } |
52 | | - |
53 | | - let(:patient) do |
54 | | - create( |
55 | | - :patient, |
56 | | - :consent_given_nasal_only_triage_not_needed, |
57 | | - :in_attendance, |
58 | | - session:, |
59 | | - given_name: "Hari" |
60 | | - ) |
| 44 | + it { should have_field("Left arm (upper position)") } |
| 45 | + it { should have_field("Right arm (upper position)") } |
| 46 | + it { should_not have_field("Nose") } |
| 47 | + it { should have_field("Other") } |
61 | 48 | end |
62 | 49 |
|
63 | | - it { should have_content("Has Hari confirmed their identity?") } |
64 | | - it { should have_field("No, it was confirmed by somebody else") } |
| 50 | + context "with a flu programme and consent to nasal spray" do |
| 51 | + let(:programme) { Programme.flu } |
| 52 | + let(:academic_year) { AcademicYear.current } |
65 | 53 |
|
66 | | - it { should have_heading("Is Hari ready for their flu nasal spray?") } |
| 54 | + let(:patient) do |
| 55 | + create( |
| 56 | + :patient, |
| 57 | + :consent_given_nasal_only_triage_not_needed, |
| 58 | + :in_attendance, |
| 59 | + session:, |
| 60 | + given_name: "Hari" |
| 61 | + ) |
| 62 | + end |
67 | 63 |
|
68 | | - it { should have_field("Yes") } |
69 | | - it { should have_field("No") } |
| 64 | + it { should have_content("Has Hari confirmed their identity?") } |
| 65 | + it { should have_field("No, it was confirmed by somebody else") } |
70 | 66 |
|
71 | | - it { should_not have_field("Left arm (upper position)") } |
72 | | - it { should_not have_field("Right arm (upper position)") } |
73 | | - it { should_not have_field("Nose") } |
74 | | - it { should_not have_field("Other") } |
75 | | - end |
| 67 | + it { should have_heading("Is Hari ready for their flu nasal spray?") } |
| 68 | + |
| 69 | + it { should have_field("Yes") } |
| 70 | + it { should have_field("No") } |
| 71 | + |
| 72 | + it { should_not have_field("Left arm (upper position)") } |
| 73 | + it { should_not have_field("Right arm (upper position)") } |
| 74 | + it { should_not have_field("Nose") } |
| 75 | + it { should_not have_field("Other") } |
| 76 | + end |
76 | 77 |
|
77 | | - context "with a flu programme, consent to nasal spray, but triaged for injection" do |
78 | | - let(:programme) { Programme.flu } |
79 | | - let(:academic_year) { AcademicYear.current } |
80 | | - |
81 | | - let(:patient) do |
82 | | - create( |
83 | | - :patient, |
84 | | - :consent_given_injection_and_nasal_triage_safe_to_vaccinate_injection, |
85 | | - :in_attendance, |
86 | | - session:, |
87 | | - given_name: "Hari" |
88 | | - ) |
| 78 | + context "with a flu programme, consent to nasal spray, but triaged for injection" do |
| 79 | + let(:programme) { Programme.flu } |
| 80 | + let(:academic_year) { AcademicYear.current } |
| 81 | + |
| 82 | + let(:patient) do |
| 83 | + create( |
| 84 | + :patient, |
| 85 | + :consent_given_injection_and_nasal_triage_safe_to_vaccinate_injection, |
| 86 | + :in_attendance, |
| 87 | + session:, |
| 88 | + given_name: "Hari" |
| 89 | + ) |
| 90 | + end |
| 91 | + |
| 92 | + it { should have_heading("Is Hari ready for their flu injection?") } |
| 93 | + |
| 94 | + it { should have_field("Yes") } |
| 95 | + it { should have_field("No") } |
| 96 | + |
| 97 | + it { should have_field("Left arm (upper position)") } |
| 98 | + it { should have_field("Right arm (upper position)") } |
| 99 | + it { should_not have_field("Nose") } |
| 100 | + it { should have_field("Other") } |
89 | 101 | end |
90 | 102 |
|
91 | | - it { should have_heading("Is Hari ready for their flu injection?") } |
| 103 | + context "with an HPV programme" do |
| 104 | + let(:programme) { Programme.hpv } |
| 105 | + |
| 106 | + it { should have_content("Has Hari confirmed their identity?") } |
| 107 | + it { should have_field("No, it was confirmed by somebody else") } |
| 108 | + |
| 109 | + it { should have_heading("Is Hari ready for their HPV vaccination?") } |
92 | 110 |
|
93 | | - it { should have_field("Yes") } |
94 | | - it { should have_field("No") } |
| 111 | + it { should have_field("Yes") } |
| 112 | + it { should have_field("No") } |
95 | 113 |
|
96 | | - it { should have_field("Left arm (upper position)") } |
97 | | - it { should have_field("Right arm (upper position)") } |
98 | | - it { should_not have_field("Nose") } |
99 | | - it { should have_field("Other") } |
| 114 | + it { should have_field("Left arm (upper position)") } |
| 115 | + it { should have_field("Right arm (upper position)") } |
| 116 | + it { should_not have_field("Nose") } |
| 117 | + it { should have_field("Other") } |
| 118 | + end |
100 | 119 | end |
101 | 120 |
|
102 | | - context "with an HPV programme" do |
103 | | - let(:programme) { Programme.hpv } |
| 121 | + describe "#dose_sequence" do |
| 122 | + subject { component.send(:dose_sequence) } |
| 123 | + |
| 124 | + context "with HPV programme" do |
| 125 | + let(:programme) { Programme.hpv } |
104 | 126 |
|
105 | | - it { should have_content("Has Hari confirmed their identity?") } |
106 | | - it { should have_field("No, it was confirmed by somebody else") } |
| 127 | + it { should eq(1) } |
| 128 | + end |
| 129 | + |
| 130 | + context "with Td/IPV programme" do |
| 131 | + let(:programme) { Programme.td_ipv } |
| 132 | + |
| 133 | + it { should be_nil } |
| 134 | + end |
| 135 | + |
| 136 | + context "with MenACWY programme" do |
| 137 | + let(:programme) { Programme.menacwy } |
107 | 138 |
|
108 | | - it { should have_heading("Is Hari ready for their HPV vaccination?") } |
| 139 | + it { should be_nil } |
| 140 | + end |
| 141 | + |
| 142 | + context "with flu programme" do |
| 143 | + let(:programme) { Programme.flu } |
109 | 144 |
|
110 | | - it { should have_field("Yes") } |
111 | | - it { should have_field("No") } |
| 145 | + it { should eq(1) } |
| 146 | + end |
112 | 147 |
|
113 | | - it { should have_field("Left arm (upper position)") } |
114 | | - it { should have_field("Right arm (upper position)") } |
115 | | - it { should_not have_field("Nose") } |
116 | | - it { should have_field("Other") } |
| 148 | + context "with MMR programme" do |
| 149 | + let(:programme) { Programme.mmr } |
| 150 | + |
| 151 | + it { should be_nil } |
| 152 | + end |
117 | 153 | end |
118 | 154 | end |
0 commit comments