Skip to content

Require Ruby 3.2 or newer - #1866

Draft
neilvcarvalho wants to merge 4 commits into
mainfrom
nc/require-ruby-3-2-5ce768
Draft

neilvcarvalho wants to merge 4 commits into
mainfrom
nc/require-ruby-3-2-5ce768

Conversation

@neilvcarvalho

Copy link
Copy Markdown
Member

Ruby 3.1 reached end of life in March 2025. An upcoming refactoring step converts internal value objects to Data.define, which needs Ruby 3.2. This pull request raises the floor in the same way as #1843 did for Ruby 3.1. It uses no Ruby 3.2 feature in lib/ beyond dropping a require that 3.2 makes redundant.

Changes

  • factory_bot.gemspec: required_ruby_version is now >= 3.2.0.
  • .github/workflows/build.yml: Ruby 3.1 and its three exclude entries are removed from the matrix. jruby-9.4 and its exclude entries are removed too, because it implements Ruby 3.1. jruby-10 stays.
  • lib/factory_bot.rb: require "set" is removed. Standard reports it as Lint/RedundantRequireStatement once it targets Ruby 3.2, since Set is available without a require from 3.2 onwards.
  • .standard.yml: ruby_version is now "3.2".
  • NEWS.md: an "Unreleased" entry records the dropped version.

No documentation states a minimum Ruby version (the README points at the build workflow), and Gemfile.lock does not change.

Side effects

Users on Ruby 3.1 or JRuby 9.4 will not be able to install releases that include this change and will stay on the last compatible version.

Verification

On the default gemfile with Ruby 4.0.10:

  • bundle exec rake all_specs: 312 unit examples, 457 acceptance examples and 4 cucumber scenarios, all passing.
  • bundle exec standardrb: 149 files inspected, no offenses.

Ruby 3.1 reached end of life in March 2025, and upcoming refactoring
needs Data.define, which is only available from Ruby 3.2 onwards.

This commit raises required_ruby_version in the gemspec to 3.2.0 and
removes Ruby 3.1 from the build matrix together with its exclusions.
JRuby 9.4 is removed as well because it implements Ruby 3.1; JRuby 10
stays in the matrix.

Users still on Ruby 3.1 or JRuby 9.4 will not be able to install
releases that include this change and will stay on the last compatible
version.
Ruby 3.2 makes Set available without requiring it, and standard reports
the explicit require as Lint/RedundantRequireStatement once it targets
Ruby 3.2.

This commit removes the require now that the gemspec guarantees Ruby
3.2 or newer. There is no behavior change.
The gemspec now requires Ruby 3.2 or newer, so standard no longer needs
to restrict itself to syntax that parses on Ruby 3.1. Raising the
target lets the linter use rules that assume 3.2 features.

Running standard with the new target reports no offenses.
The gemspec now requires Ruby 3.2 or newer. Users upgrading need to
know that releases including this change will not install on Ruby 3.1,
so record it in the unreleased section of the changelog.
@neilvcarvalho
neilvcarvalho marked this pull request as draft November 27, 2026 20:14

This branch has not been deployed

No deployments
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.

1 participant