Skip to content

Add RSpec 4 support: widen gemspec constraint and add rspec matrix dimension to CI#9

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/update-rspec-dependency-and-ci
Draft

Add RSpec 4 support: widen gemspec constraint and add rspec matrix dimension to CI#9
Copilot wants to merge 2 commits intomainfrom
copilot/update-rspec-dependency-and-ci

Conversation

Copy link
Contributor

Copilot AI commented Feb 26, 2026

Widen the rspec runtime dependency to accept both 3.6+ and 4.x, and extend CI to validate against both RSpec major versions.

marsh_grass.gemspec

  • '~> 3.6''>= 3.6', '< 5'

Gemfile

Pin rspec version in CI without modifying files at runtime — driven entirely by the RSPEC_VERSION env var:

gem 'rspec', '>= 4.0.0.alpha', '< 5' if ENV['RSPEC_VERSION'] == '4'
gem 'rspec', '~> 3.6'               if ENV['RSPEC_VERSION'] == '3'

>= 4.0.0.alpha is required to resolve the current RSpec 4 beta. The ~> 3.6 pin on RSpec 3 jobs prevents accidental auto-upgrade once RSpec 4 ships stable.

.github/workflows/ci.yml

  • Adds rspec: ["3", "4"] as a third matrix dimension
  • Restricts RSpec 4 jobs to Ruby 4.0 only via exclusions (6 rules covering rubies 3.0–3.5)
  • Sets RSPEC_VERSION: ${{ matrix.rspec }} in env to drive the Gemfile pin
  • Job name updated: Test - <gemfile> - Ruby <ruby> - RSpec <rspec>
  • Adds explicit permissions: contents: read / checks: write on the test job (minimum needed for JUnit publish step)
Original prompt

Create a PR in RoleModel/marsh_grass to:

  1. Bump the runtime dependency on rspec in marsh_grass.gemspec to allow RSpec v4 (currently in beta). The current line is:
spec.add_dependency 'rspec', '~> 3.6'

Update it to a constraint that allows both RSpec 3.6+ and RSpec 4.x while still preventing unexpected major versions beyond 4 (e.g., < 5).

  1. Update GitHub Actions CI config to run the test suite against both RSpec 3.6+ and RSpec 4.0+.

    • CI file is .github/workflows/ci.yml.
    • The repo currently has a Ruby matrix: ["3.0", 3.1, 3.2, 3.3, 3.4, 3.5, 4.0] and a gemfile matrix: activesupport-7.1, activesupport-7.2, activesupport-8.0, activesupport-8.1 with exclusions for Rails/Ruby compatibility.
    • Add an RSpec dimension to the matrix (e.g., rspec: ["3", "4"]).
    • Keep runtime reasonable by running RSpec 4 only on Ruby 4.0 (unless you determine a better approach that matches the request). RSpec 3 should still run on the full existing matrix.
    • Ensure the workflow installs/uses the correct RSpec version for each matrix entry.
    • Prefer a clean approach that doesn’t permanently modify Gemfile or gemspec during CI; if you do temporary modification (e.g., bundle add), ensure it doesn’t create uncommitted changes that break subsequent steps.
  2. Ensure lint settings are followed and CI continues to publish junit output (tmp/rspec.xml) as it currently does.

Reference:

Acceptance criteria:

  • bundle exec rspec passes locally and in CI for both RSpec 3 and RSpec 4 matrix entries.
  • The gem dependency constraints allow installing RSpec 4.
  • CI clearly labels jobs with Ruby, gemfile, and RSpec versions.

This pull request was created from Copilot chat.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: wesrich <1194120+wesrich@users.noreply.github.com>
Copilot AI changed the title [WIP] Bump rspec dependency and update CI configuration Add RSpec 4 support: widen gemspec constraint and add rspec matrix dimension to CI Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants