Skip to content

Commit 269c848

Browse files
authored
Fix intermittently failing specs (#3228)
- **spec/features/doubles_vaccination_administered_spec.rb** - The two "vaccination administered" emails for doubles can come in different order, as has been demonstrated with intermittent failures of specs in CI. I don't see why these need to be ordered, since sending emails can happen out-of-order. - **spec/lib/reports/programme_vaccinations_exporter_spec.rb** - Timestamps are generated within the tests so we need to freeze time for the entire spec.
2 parents 905f5f9 + 653d753 commit 269c848

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

spec/features/doubles_vaccination_administered_spec.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,26 +127,28 @@ def when_vaccination_confirmations_are_sent
127127
def then_an_email_is_sent_to_the_parent_confirming_the_vaccinations
128128
expect_email_to(
129129
@patient.consents.last.parent.email,
130-
:vaccination_administered_menacwy
130+
:vaccination_administered_menacwy,
131+
:any
131132
)
132133

133134
expect_email_to(
134135
@patient.consents.last.parent.email,
135136
:vaccination_administered_td_ipv,
136-
:second
137+
:any
137138
)
138139
end
139140

140141
def and_a_text_is_sent_to_the_parent_confirming_the_vaccinations
141142
expect_sms_to(
142143
@patient.consents.last.parent.phone,
143-
:vaccination_administered_menacwy
144+
:vaccination_administered_menacwy,
145+
:any
144146
)
145147

146148
expect_sms_to(
147149
@patient.consents.last.parent.phone,
148150
:vaccination_administered_td_ipv,
149-
:second
151+
:any
150152
)
151153
end
152154
end

spec/lib/reports/programme_vaccinations_exporter_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@
9292
end
9393

9494
describe "rows" do
95-
subject(:rows) { freeze_time { CSV.parse(call, headers: true) } }
95+
subject(:rows) { CSV.parse(call, headers: true) }
96+
97+
around { |example| freeze_time { example.run } }
9698

9799
context "a school session" do
98100
let(:location) { create(:school, team:) }

0 commit comments

Comments
 (0)