|
1 | 1 | # frozen_string_literal: true
|
2 | 2 |
|
3 | 3 | describe AppVaccinateFormComponent do
|
4 |
| - subject { render_inline(component) } |
5 |
| - |
6 |
| - let(:heading) { "A Heading" } |
7 |
| - let(:body) { "A Body" } |
8 |
| - let(:programmes) { [create(:programme, :hpv)] } |
| 4 | + let(:programme) { create(:programme) } |
| 5 | + let(:programmes) { [programme] } |
9 | 6 | let(:session) { create(:session, :today, programmes:) }
|
10 | 7 | let(:patient) do
|
11 | 8 | create(
|
|
19 | 16 | create(:patient_session, :in_attendance, programmes:, patient:, session:)
|
20 | 17 | end
|
21 | 18 |
|
22 |
| - let(:vaccinate_form) do |
23 |
| - VaccinateForm.new(patient_session:, programme: programmes.first) |
24 |
| - end |
| 19 | + let(:vaccinate_form) { VaccinateForm.new(patient_session:, programme:) } |
25 | 20 |
|
26 | 21 | let(:component) { described_class.new(vaccinate_form) }
|
27 | 22 |
|
28 | 23 | before { patient_session.strict_loading!(false) }
|
29 | 24 |
|
30 |
| - it { should have_css(".nhsuk-card") } |
31 |
| - |
32 |
| - it { should have_heading("Is Hari ready for their HPV vaccination?") } |
33 |
| - |
34 |
| - it { should have_field("Yes") } |
35 |
| - it { should have_field("No") } |
36 |
| - |
37 | 25 | describe "#render?" do
|
38 | 26 | subject(:render) { component.render? }
|
39 | 27 |
|
|
53 | 41 | it { should be(false) }
|
54 | 42 | end
|
55 | 43 | end
|
| 44 | + |
| 45 | + describe "rendered content" do |
| 46 | + subject { render_inline(component) } |
| 47 | + |
| 48 | + it { should have_css(".nhsuk-card") } |
| 49 | + |
| 50 | + context "with a Flu programme" do |
| 51 | + let(:programme) { create(:programme, :flu) } |
| 52 | + |
| 53 | + it { should have_heading("Is Hari ready for their Flu vaccination?") } |
| 54 | + |
| 55 | + it { should have_field("Yes") } |
| 56 | + it { should have_field("No") } |
| 57 | + |
| 58 | + it { should_not have_field("Left arm (upper position)") } |
| 59 | + it { should_not have_field("Right arm (upper position)") } |
| 60 | + it { should_not have_field("Nose") } |
| 61 | + it { should_not have_field("Other") } |
| 62 | + end |
| 63 | + |
| 64 | + context "with an HPV programme" do |
| 65 | + let(:programme) { create(:programme, :hpv) } |
| 66 | + |
| 67 | + it { should have_heading("Is Hari ready for their HPV vaccination?") } |
| 68 | + |
| 69 | + it { should have_field("Yes") } |
| 70 | + it { should have_field("No") } |
| 71 | + |
| 72 | + it { should have_field("Left arm (upper position)") } |
| 73 | + it { should have_field("Right arm (upper position)") } |
| 74 | + it { should_not have_field("Nose") } |
| 75 | + it { should have_field("Other") } |
| 76 | + end |
| 77 | + end |
56 | 78 | end
|
0 commit comments