Bug
kettle-jem templating damaged a destination .rspec file by replacing a Rails-specific loader flag instead of preserving it.
Bad template commit:
a17317beff6f4e643c0767ca0356d5586597fb51
- commit subject:
馃帹 Template bootstrap by kettle-jem v7.1.0
- affected repo/member:
galtzo-floss/sanitize_email
- affected file:
.rspec
Bad diff shape:
--format progress
--color
--order random
---require rails_helper
+--require spec_helper
+--exclude-pattern spec/tmp/**/*_spec.rb
--warnings
--format html
--out results/test_results.html
Scenario
sanitize_email is a Rails/Combustion-style gem whose suite relies on .rspec loading rails_helper before specs execute. The generated/template .rspec wanted to add --exclude-pattern spec/tmp/**/*_spec.rb, but the merge also changed the existing loader from rails_helper to spec_helper.
That turned a valid destination-specific RSpec option into the template default. The later release/test failure made it look like individual specs needed require "rails_helper", but that was only a symptom of this .rspec template damage.
Observed downstream symptoms included Rails-dependent specs running without the Rails test boot path during kettle-release/kettle-changelog coverage generation, requiring manual workaround edits in spec files.
Expected Behavior
Templating should preserve destination-specific RSpec loader options.
For this input shape, the result should retain:
and still add managed template flags such as:
--exclude-pattern spec/tmp/**/*_spec.rb
It should not replace rails_helper with spec_helper.
Likely Cause
The current .rspec merge appears to treat lines textually, without understanding option flags and their arguments. --require rails_helper and --require spec_helper are not two arbitrary independent lines; they are --require flag/value records with loader semantics.
Fixing this properly likely requires a --flag aware parser for .rspec / RSpec option files. We do not currently have that parser.
Regression Test Shape
Add a fixture-based regression with:
Destination .rspec:
--format progress
--color
--order random
--require rails_helper
--warnings
--format html
--out results/test_results.html
Template .rspec containing the template default loader and additive temp-spec exclusion:
--format progress
--color
--order random
--require spec_helper
--exclude-pattern spec/tmp/**/*_spec.rb
--warnings
--format html
--out results/test_results.html
Expected merged .rspec should preserve --require rails_helper and add --exclude-pattern spec/tmp/**/*_spec.rb without downgrading the loader to spec_helper.
Acceptance Criteria
kettle-jem has a regression spec for the exact .rspec shape above.
.rspec merge logic is flag-aware enough to treat flag/value pairs as structured records.
- Destination
--require rails_helper survives templating.
- The fix does not require adding
require "rails_helper" to every affected spec file.
Bug
kettle-jemtemplating damaged a destination.rspecfile by replacing a Rails-specific loader flag instead of preserving it.Bad template commit:
a17317beff6f4e643c0767ca0356d5586597fb51馃帹 Template bootstrap by kettle-jem v7.1.0galtzo-floss/sanitize_email.rspecBad diff shape:
Scenario
sanitize_emailis a Rails/Combustion-style gem whose suite relies on.rspecloadingrails_helperbefore specs execute. The generated/template.rspecwanted to add--exclude-pattern spec/tmp/**/*_spec.rb, but the merge also changed the existing loader fromrails_helpertospec_helper.That turned a valid destination-specific RSpec option into the template default. The later release/test failure made it look like individual specs needed
require "rails_helper", but that was only a symptom of this.rspectemplate damage.Observed downstream symptoms included Rails-dependent specs running without the Rails test boot path during
kettle-release/kettle-changelogcoverage generation, requiring manual workaround edits in spec files.Expected Behavior
Templating should preserve destination-specific RSpec loader options.
For this input shape, the result should retain:
and still add managed template flags such as:
It should not replace
rails_helperwithspec_helper.Likely Cause
The current
.rspecmerge appears to treat lines textually, without understanding option flags and their arguments.--require rails_helperand--require spec_helperare not two arbitrary independent lines; they are--requireflag/value records with loader semantics.Fixing this properly likely requires a
--flagaware parser for.rspec/ RSpec option files. We do not currently have that parser.Regression Test Shape
Add a fixture-based regression with:
Destination
.rspec:Template
.rspeccontaining the template default loader and additive temp-spec exclusion:Expected merged
.rspecshould preserve--require rails_helperand add--exclude-pattern spec/tmp/**/*_spec.rbwithout downgrading the loader tospec_helper.Acceptance Criteria
kettle-jemhas a regression spec for the exact.rspecshape above..rspecmerge logic is flag-aware enough to treat flag/value pairs as structured records.--require rails_helpersurvives templating.require "rails_helper"to every affected spec file.