Skip to content

feat: Add support for rspec 4 - #128

Merged
LuukvH merged 1 commit into
chore/ruby-3.3-minimumfrom
claude/rspec-4-support
Nov 16, 2026
Merged

LuukvH merged 1 commit into
chore/ruby-3.3-minimumfrom
claude/rspec-4-support

Conversation

@LuukvH

@LuukvH LuukvH commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #127 (requires ruby >= 3.3), which should be merged first.

Adds support for RSpec 4. I checked against rspec-core 4.0.0.beta1 (released 2026-02-18), which is the newest RSpec 4 release on rubygems.org. There is no stable 4.x yet.

What changed in RSpec 4 that matters here

  • The formatter API this gem uses still works the same way: RSpec::Core::Formatters.register, BaseFormatter, FailedExampleNotification / SkippedExampleNotification (message_lines, example), and SeedNotification (seed_used?, fully_formatted).
  • The deprecated PendingExampleFixedNotification and PendingExampleFailedAsExpectedNotification classes were removed. This formatter never referenced them.
  • Legacy (RSpec 2 style) formatters now raise an error instead of a warning. This formatter uses the RSpec 3 registration API, so it isn't affected.
  • --color, disable_monkey_patching! and the should syntax (expectations.syntax=) were removed. Only this repo's own test setup used them.
  • Random ordering is now the default, so the seed line is printed by default.

The annotations produced for spec/integration/failing_spec.rb are identical on RSpec 3.13.7 and 4.0.0.beta1.

Changes

  • gemspec: rspec-core '~> 3.0' → '>= 3.0', '< 5'
  • Added gemfiles/rspec3.gemfile and gemfiles/rspec4.gemfile with lockfiles, following the approach from Add support RSpec 4.0.0.beta1 #115.
  • CI: the rspec job (Ruby 3.3, 3.4 and 4.0, from chore: Require ruby 3.3 or newer and test on ruby 4.0 #127) and the e2e job now run against both gemfiles via BUNDLE_GEMFILE. No action versions changed, so actions.lock needs no update.
  • spec_helper.rb: only call disable_monkey_patching! / syntax = :expect when they exist, which is RSpec 3 only.
  • .rspec: dropped --color, which RSpec 4 removed. Colour is still enabled automatically on a TTY.

@LuukvH
LuukvH requested review from a team and a balanced review from Copilot November 16, 2026 11:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block approval of the RSpec 4 compatibility changes.

No open issues 🎉

What changed in this PR

Adds RSpec 4 compatibility to the GitHub Actions formatter while retaining RSpec 3 support, with separate dependency bundles and CI coverage for both versions.

Changes:

  • Broadens the rspec-core dependency range to allow versions 3 and 4.
  • Adds locked RSpec 3 and RSpec 4 bundles and tests both in CI, excluding Ruby 3.1 with the locked RSpec 4 dependencies.
  • Updates test configuration to avoid options removed in RSpec 4.
File Description
spec/​spec_helper.rb Guards RSpec 3-only configuration settings.
rspec-github.gemspec Allows rspec-core versions from 3.0 up to, but excluding, 5.
gemfiles/​rspec4.gemfile.lock Locks the RSpec 4 beta dependency bundle.
gemfiles/​rspec4.gemfile Defines the RSpec 4 test bundle.
gemfiles/​rspec3.gemfile.lock Locks the RSpec 3 dependency bundle.
gemfiles/​rspec3.gemfile Defines the RSpec 3 test bundle.
Gemfile.lock Reflects the expanded runtime dependency constraint.
.rspec Removes the unsupported --color option.
.github/​workflows/​ci.yml Runs unit and end-to-end jobs against both RSpec bundles.

Review effort: Balanced

@LuukvH
LuukvH force-pushed the claude/rspec-4-support branch from f1020fe to 361be59 Compare November 16, 2026 11:15
@LuukvH
LuukvH changed the base branch from master to chore/ruby-3.3-minimum November 16, 2026 11:15
@LuukvH
LuukvH requested a review from RinseV November 16, 2026 11:18
@LuukvH
LuukvH merged commit e0f74d3 into chore/ruby-3.3-minimum Nov 16, 2026
20 checks passed
@LuukvH
LuukvH deleted the claude/rspec-4-support branch November 16, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants