RSpec: implement ERB testing patterns throughout
Summary
Following #4123 (closed), we can now test ERB content directly as rendered. We should evaluate all instances of RSpec testing ERB content, for the need to test the result, or simply the presence within the ERB string content.
Description
Currently, there is a mix of direct YAML.safe_load()
of ERB content, and direct to contain()
string comparison. We should evaluate each instance of any test of ERB, determining if it should be an evaluation of the final content as YAML, or a specific match to the content of the ERB template itself (via string comparators).
Any instance which should be a YAML evaluation should be translated to make use of RuntimeTemplate.erb
from the recently added (!3289 (merged)) spec/runtime_template_helper.rb
.
Process
- Identify all instances (listing of all RSpec files doing this)
- Determine appropriate check for each instance within each file
- Replace those as necessary, as a single RSpec file per MR to keep reviews small
Acceptance Criteria
-
All uses of RSpec on ERB content have been evaluated for replacement -
All instances of such ERB have been updated to make use of RuntimeTemplate.erb
as appropriate.