|
17 | 17 | let(:batch) do
|
18 | 18 | create(:batch, name: "ABC", expiry: Date.new(2026, 1, 1), vaccine:)
|
19 | 19 | end
|
| 20 | + let(:batch_name) { nil } |
| 21 | + let(:batch_expiry) { nil } |
20 | 22 | let(:other_batch) do
|
21 | 23 | create(:batch, name: "DEF", expiry: Date.new(2027, 1, 1), vaccine:)
|
22 | 24 | end
|
|
31 | 33 | performed_at:,
|
32 | 34 | outcome:,
|
33 | 35 | batch:,
|
| 36 | + batch_name:, |
| 37 | + batch_expiry:, |
34 | 38 | vaccine:,
|
35 | 39 | patient:,
|
36 | 40 | session:,
|
|
161 | 165 | end
|
162 | 166 |
|
163 | 167 | describe "batch ID row" do
|
164 |
| - it { should have_css(".nhsuk-summary-list__row", text: "Batch IDABC") } |
| 168 | + context "with a batch, and vaccine" do |
| 169 | + it { should have_css(".nhsuk-summary-list__row", text: "Batch IDABC") } |
| 170 | + end |
165 | 171 |
|
166 |
| - context "without a vaccine" do |
| 172 | + context "with a batch_name, and vaccine" do |
| 173 | + let(:batch) { nil } |
| 174 | + let(:batch_name) { "ABC" } |
| 175 | + let(:batch_expiry) { Date.new(2026, 1, 1) } |
| 176 | + |
| 177 | + it { should have_css(".nhsuk-summary-list__row", text: "Batch IDABC") } |
| 178 | + end |
| 179 | + |
| 180 | + context "with a batch_name, and no vaccine" do |
| 181 | + let(:vaccine) { nil } |
| 182 | + let(:batch) { nil } |
| 183 | + let(:batch_name) { "ABC" } |
| 184 | + let(:batch_expiry) { nil } |
| 185 | + let(:other_batch) { nil } |
| 186 | + |
| 187 | + it { should have_css(".nhsuk-summary-list__row", text: "Batch IDABC") } |
| 188 | + end |
| 189 | + |
| 190 | + context "without a vaccine, batch_name or batch_expiry" do |
167 | 191 | let(:outcome) { :not_well }
|
168 | 192 | let(:vaccine) { nil }
|
169 | 193 | let(:batch) { nil }
|
| 194 | + let(:batch_name) { nil } |
| 195 | + let(:batch_expiry) { nil } |
170 | 196 | let(:other_batch) { nil }
|
171 | 197 |
|
172 | 198 | it { should_not have_css(".nhsuk-summary-list__row", text: "Batch ID") }
|
173 | 199 | end
|
174 | 200 | end
|
175 | 201 |
|
176 | 202 | describe "batch expiry date row" do
|
177 |
| - it do |
178 |
| - expect(rendered).to have_css( |
179 |
| - ".nhsuk-summary-list__row", |
180 |
| - text: "Batch expiry date1 January 2026" |
181 |
| - ) |
| 203 | + context "with a batch, and vaccine" do |
| 204 | + it do |
| 205 | + expect(rendered).to have_css( |
| 206 | + ".nhsuk-summary-list__row", |
| 207 | + text: "Batch expiry date1 January 2026" |
| 208 | + ) |
| 209 | + end |
| 210 | + end |
| 211 | + |
| 212 | + context "with a batch_expiry, and vaccine" do |
| 213 | + let(:batch) { nil } |
| 214 | + let(:batch_name) { "ABC" } |
| 215 | + let(:batch_expiry) { Date.new(2026, 1, 1) } |
| 216 | + |
| 217 | + it do |
| 218 | + expect(rendered).to have_css( |
| 219 | + ".nhsuk-summary-list__row", |
| 220 | + text: "Batch expiry date1 January 2026" |
| 221 | + ) |
| 222 | + end |
| 223 | + end |
| 224 | + |
| 225 | + context "with a batch_expiry, and no vaccine" do |
| 226 | + let(:vaccine) { nil } |
| 227 | + let(:batch) { nil } |
| 228 | + let(:batch_name) { "ABC" } |
| 229 | + let(:batch_expiry) { Date.new(2026, 1, 1) } |
| 230 | + let(:other_batch) { nil } |
| 231 | + |
| 232 | + it do |
| 233 | + expect(rendered).to have_css( |
| 234 | + ".nhsuk-summary-list__row", |
| 235 | + text: "Batch expiry date1 January 2026" |
| 236 | + ) |
| 237 | + end |
| 238 | + end |
| 239 | + |
| 240 | + context "with a batch_expiry, but no batch_name" do |
| 241 | + let(:batch) { nil } |
| 242 | + let(:batch_name) { nil } |
| 243 | + let(:batch_expiry) { Date.new(2026, 1, 1) } |
| 244 | + |
| 245 | + it do |
| 246 | + expect(rendered).to have_css( |
| 247 | + ".nhsuk-summary-list__row", |
| 248 | + text: "Batch expiry date1 January 2026" |
| 249 | + ) |
| 250 | + end |
182 | 251 | end
|
183 | 252 |
|
184 | 253 | context "without a vaccine" do
|
|
0 commit comments