Skip to content

Fix flex-column validation errors on ActiveModel 6.1+; make the specs run on Ruby 3.2 - #5

Merged
rfojta-elastic merged 9 commits into
masterfrom
modernize-test-suite
Oct 12, 2026
Merged

rfojta-elastic merged 9 commits into
masterfrom
modernize-test-suite

Conversation

@rfojta-elastic

Copy link
Copy Markdown

Problem

FlexColumns::Contents::FlexColumnContentsBase#before_validation! iterated errors.each do |name, message|. On ActiveModel 6.1+ each yields an error object, so validation errors from a flex column were copied onto the model under an attribute name built from the error object's inspect string (for example user_attributes.#<ActiveModel::Error:0x...>).

Changes

  1. Accept both shapes of errors.each, and fix the specs for Ruby 3 (lambda arity, options hash vs. keyword arguments in mock expectations).
  2. Make the development setup work on Ruby 3.2: drop the Ruby 1.8-era pins (bundler 1.x, rake < 11, rspec 2), add .ruby-version, remove the Travis configuration, require json < 3 (ActiveSupport 7.x passes quirks_mode, which json 3 removed), add ActiveRecord 6-only test pins, document how to run the specs, bump to 1.0.13.

Testing

328 examples, 0 failures (1 pending, already present), on Ruby 3.2.8 with ActiveRecord 7.2.3.2 and 6.1.7.10, each against SQLite and MySQL.

🤖 Generated with Claude Code

rfojta-elastic and others added 2 commits October 12, 2026 10:49
…ix specs on Ruby 3

ActiveModel::Errors#each yields an error object instead of a name and a message
on ActiveModel 6.1+, so errors from a flex column ended up on the model under
an attribute name built from the error object's inspect string.

The specs also needed updating for Ruby 3: lambdas used as blocks are strict
about arity, and expectations on a trailing options hash must pass it
explicitly rather than as keyword arguments.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Drop the Ruby 1.8-era dependency pins and conditionals (bundler 1.x, rake < 11,
rspec 2), add .ruby-version, remove the Travis configuration, pin json < 3 and
the ActiveRecord 6-only test pins (sqlite3 1.x, concurrent-ruby < 1.3.5), and
document how to run the specs. Bump the version to 1.0.13.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@rfojta-elastic

Copy link
Copy Markdown
Author

Update: the specs were also run against PostgreSQL 16 (the pg gem installed without a local Postgres).

SQLite MySQL PostgreSQL
ActiveRecord 7.2.3.2 pass pass pass
ActiveRecord 6.1.7.10 pass pass pass

Ruby 3.2.8. SQLite and MySQL: 328 examples, 0 failures, 1 pending. PostgreSQL: 329 examples, 0 failures, 1 pending (one extra example runs on PostgreSQL). The pending example was already in the suite.

🤖 Generated with Claude Code

rfojta-elastic and others added 7 commits October 12, 2026 10:59
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Starts throwaway MySQL and PostgreSQL containers on random local ports (SQLite
runs in memory), runs the specs for each ActiveRecord version and prints a
summary table. The spec helper can now read its database configuration from the
path in FLEX_COLUMNS_SPEC_DATABASE_CONFIG_FILE, so a developer's own
spec_database_config.rb is left alone.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Runs script/test-docker for SQLite, MySQL and PostgreSQL against ActiveRecord
6.1 and 7.2 on Ruby 3.2.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Replaces the 2.x-era Travis matrix with the Ruby/ActiveRecord pairs that work
today. The ActiveRecord-version-dependent test pins now use a real version
comparison, so ActiveRecord 7.0 is covered too.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…very database

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Ruby 1.8.7 through 2.6 and JRuby 1.7 (the former Travis matrix) can no longer be
tested and are no longer supported; the gemspec now enforces the floor.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@rfojta-elastic

Copy link
Copy Markdown
Author

Update since the PR was opened (the description above still says 1.0.13, which is now outdated):

  • Version is now 2.0.0, with required_ruby_version >= 2.7 enforced in the gemspec. The old Travis matrix (Ruby 1.8.7 to 2.2, JRuby 1.7, ActiveRecord 3.0 to 4.2) can no longer be run, so dropping those versions is documented as a breaking change in CHANGES.md and the README.
  • GitHub Actions (.github/workflows/test.yml) now replaces Travis: Ruby 2.7, 3.0, 3.1 and 3.2 with ActiveRecord 6.1 (every Ruby) and 7.0, 7.1, 7.2 (Ruby 3.1+), each against SQLite, MySQL and PostgreSQL. 30 jobs, all green on this branch.
  • script/test-docker runs the same matrix locally against throwaway MySQL/PostgreSQL containers (see the README).

🤖 Generated with Claude Code

@rfojta-elastic
rfojta-elastic merged commit c0f0c90 into master Oct 12, 2026
60 checks passed
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.

2 participants