Skip to content

Modernize: Rails 7.1–8.1, Ruby 3.2–4.0, Propshaft, browser specs - #52

Merged
andreibondarev merged 2 commits into
mainfrom
modernize
Oct 26, 2026
Merged

andreibondarev merged 2 commits into
mainfrom
modernize

Conversation

@andreibondarev

Copy link
Copy Markdown
Member

Brings the gem up to date with current Ruby, Rails and asset pipelines.

Support and CI

  • Requires Ruby 3.2+, Rails 7.1+ and Administrate 1.0+. The old rails >= 5.2 claim was never tested, and Administrate 1.0 itself needs Rails 6.0+.
  • CI runs Ruby 3.2 / 3.3 / 3.4 / 4.0 × Rails 7.1 / 7.2 / 8.0 / 8.1 (16 jobs). Rails 7.x runs on Sprockets and Rails 8 on Propshaft, so both pipelines are covered.
  • The Rails version is picked with RAILS_VERSION in the Gemfile, and Gemfile.lock is no longer committed, since one lockfile can't cover the matrix.
  • rspec-rails moves from 3.9 (2019) to 8.x. Dev dependencies move from the gemspec to the Gemfile.
  • Adds .github/dependabot.yml with grouped monthly updates for bundler and GitHub Actions.

Library changes

  • Propshaft: the sprockets-rails dependency is gone. The script is only registered for precompilation when Sprockets is present; Propshaft serves engine assets automatically.
  • No JS globals: script.js is wrapped in an IIFE. Before, its top-level const init would throw a SyntaxError if any other script on the page declared init.
  • Helpers are included via ActiveSupport.on_load(:action_view) instead of ActionView::Base.send :include, so ActionView isn't loaded early.
  • Controller loading for route generation uses Rails.autoloaders.main.eager_load_dir instead of require_dependency.
  • Button helper: passing options like confirm: without class: no longer drops the default button class (it rendered class="btn ").

Tests

  • The Rails 6.1-generated dummy app is replaced with a minimal one that runs unchanged on Rails 7.1–8.1.
  • New Cuprite system specs drive headless Chrome: the disabled state, submitted ids, query params kept, confirm accept/dismiss, select all, and no leaked globals. The globals spec fails against the script currently on main.
  • Helper specs use Capybara matchers instead of exact HTML strings, because button_to markup differs slightly between Rails versions.

Gemspec

  • required_ruby_version, metadata (source_code_uri, changelog_uri, bug_tracker_uri, rubygems_mfa_required), a fixed homepage URL, and an explicit file list. The built gem contains only app/, config/, lib/, README, CHANGELOG and LICENSE, and builds without warnings.

Verified locally

  • All 16 Ruby × Rails combinations: 15 examples, 0 failures each, no deprecation warnings
  • Batch action routes survive a development-mode code reload with the Zeitwerk loader

- Require Ruby 3.2+, Rails 7.1+, Administrate 1.0+ and test the full
  Ruby 3.2–4.0 × Rails 7.1–8.1 matrix in CI (Rails 7.x on Sprockets,
  Rails 8 on Propshaft)
- Drop the sprockets-rails dependency; only register the script for
  precompilation when Sprockets is present
- Wrap script.js in an IIFE so it doesn't define globals like `init`
- Include helpers via ActiveSupport.on_load(:action_view)
- Load namespace controllers with Zeitwerk's eager_load_dir instead of
  require_dependency
- Keep the button helper's default `button` class when other options
  such as `confirm:` are given
- Replace the Rails 6.1 dummy app with a minimal version-agnostic one
- Add Cuprite system specs for the batch action UI and make helper
  specs markup-order independent
- Move dev dependencies to the Gemfile, stop committing Gemfile.lock,
  clean up gemspec metadata and packaged files
- Add Dependabot config, ignore built gems, bump .tool-versions to 4.0
@andreibondarev
andreibondarev merged commit 276a1f1 into main Oct 26, 2026
16 checks passed
@andreibondarev
andreibondarev deleted the modernize branch October 26, 2026 19:24
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