Skip to content

Add a test harness and CI (Ruby 3.3-4.0 / Rails 8.0-8.1 / ActiveAdmin 3.2-3.5) - #6

Merged
Fivell merged 5 commits into
masterfrom
feat/test-harness-and-ci
Oct 1, 2026
Merged

Fivell merged 5 commits into
masterfrom
feat/test-harness-and-ci

Conversation

@Fivell

@Fivell Fivell commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

This gem had no tests and no CI. This adds both, mirroring the harness already
in use in the sibling repo activeadmin-plugins/active_admin_sidebar (same
shape of gem: an ActiveAdmin asset plugin).

The harness

The specs run against a generated Rails dummy app, never a committed one
(spec/rails/rails-* is gitignored).

  • Gemfile — gemspec plus rails/activeadmin selected via ENV['RAILS']
    and ENV['AA'] (defaults 8.1.0 / 3.5.0), and a :test group with simplecov,
    rspec-rails, sqlite3, database_cleaner, capybara, cuprite and webrick.

  • Rakefile + tasks/test.rake — rake setup runs
    rails new spec/rails/rails-#{Rails::VERSION::STRING} -m spec/support/rails_template.rb.

  • spec/support/rails_template.rb — generates Author/Post models with
    ransackable_attributes, installs ActiveAdmin + Formtastic, and wires this
    plugin into the dummy app's app/assets/javascripts/active_admin.js:

    //= require active_admin_filters_visibility
    $(document).ready(function() {
      $('#filters_sidebar_section').activeAdminFiltersVisibility();
    });

    Without that invocation the jQuery plugin never runs and no spec could see
    the UI. There is no SCSS to wire up — the plugin injects its own <style>.

  • spec/spec_helper.rb — boots the generated app and auto-runs rake setup
    when it is missing.

  • spec/support/capybara.rb — cuprite/headless Chrome driver, carried over
    verbatim including the comments documenting the real Ferrum::ProcessTimeoutError
    flakes on GitHub runners.

  • spec/support/admin.rb — registers the Author resource per example.

Three Rails 8.1 fixes the sibling repo did not need

  1. Rails 8.1 generates stale_when_importmap_changes into
    ApplicationController, but importmap-rails is not in this bundle (assets
    are served through Sprockets), so loading the controller raises NameError.
    The template strips the line.
  2. That strip has to be the first thing the template does. generate
    shells out to rails generate, which boots the app, and the generated
    config/environments/test.rb contains
    config.eager_load = ENV["CI"].present? — so on a GitHub runner the
    controller is eager-loaded during generation and the template dies on its
    very first model, before any gsub_file runs. Locally CI is unset, the
    controller stays lazily autoloaded, and the ordering bug is invisible. This
    is reproducible locally with CI=true, which is how it was verified here.
  3. Rails 8.1 draws routes lazily, so ActiveAdmin's before_load hooks — the
    ones that mix BatchActions/Filters into ActiveAdmin::Resource — had not
    run by the time a spec called ActiveAdmin.register. Resources came out with
    @batch_actions nil and the index page died in
    wrap_with_batch_action_form. spec_helper.rb now forces
    ActiveAdmin.application.load! before any example registers a resource.

Specs added — spec/filters_visibility_spec.rb (5 examples, js: true)

  1. renders the gear button in the sidebar h3 and the (initially hidden)
    .filters-visibility-panel inside .panel_contents, titled Visibility:
  2. one checkbox per filter (Name, Last name, Birthday, Created at, Updated at),
    all checked, every .filter_form_field visible, button not active
  3. unchecking a checkbox hides that filter's wrapper and adds active to the
    button, leaving the other filters alone
  4. the hidden state survives a page reload (localStorage), and the checkbox
    comes back unchecked
  5. re-checking shows the filter again and clears the button's active class

Nothing from the requested list had to be dropped. Drag-reordering and
isFilterFilled are not covered — the dummy app invokes the plugin with
ordering at its default false, and HTML5 drag-and-drop is not usefully
drivable through CDP.

CI matrix

dimension values
ruby 3.3, 3.4, 4.0
rails 8.0.0, 8.1.0
activeadmin 3.2.0, 3.3.0, 3.4.0, 3.5.0

24 legs, fail-fast: false, no exclude: rules.

EOL dates (https://endoflife.date/ruby, https://endoflife.date/rails) justifying
the floor:

  • Ruby 3.1 eol 2025-03-26, Ruby 3.2 eol 2026-03-31 → dropped. Ruby 3.3 is the
    floor (security-only until 2027-03-31); 3.4 eol 2028-03-31, 4.0 eol 2029-03-31.
  • Rails 7.0 eol 2025-04-01, 7.1 eol 2025-10-01, 7.2 eol 2026-08-09 → not in the
    matrix. Rails 8.0 eol 2026-11-07, 8.1 eol 2027-10-10. Rails 8.2 is not
    released (main is 8.2.0.alpha), so it is not added.
  • ActiveAdmin: every 3.2+ release resolves against both Rails 8.0 and 8.1 and
    passes the suite on both, so all four legs are kept and no exclusions are
    needed. Verified by real bundle install + rspec runs, not by reading
    dependency strings.

The coverage-badge and gh-pages deploy jobs from the sibling workflow are
not carried over: this repo has no gh-pages branch, so the deploy job
would be dead and the badge artifact it feeds would have nowhere to go.

gemspec

  • s.required_ruby_version = '>= 3.3'
  • s.add_dependency 'activeadmin', '>= 3.2', '< 4.0' (was unconstrained) —
    3.2 is the oldest version actually exercised, 4.0 is not released.
  • Gem version untouched, nothing released.

Verification

Real runs on this machine (rbenv 3.4.10 / 4.0.6, Chrome headless via cuprite),
plus the 24-leg CI run on this PR.

Resolution check across the whole Rails x ActiveAdmin product, Ruby 3.4.10:

OK   rails 8.0.0 / AA 3.2.0 ->  activeadmin (3.2.5)  rails (8.0.5.1)
OK   rails 8.0.0 / AA 3.3.0 ->  activeadmin (3.3.0)  rails (8.0.5.1)
OK   rails 8.0.0 / AA 3.4.0 ->  activeadmin (3.4.0)  rails (8.0.5.1)
OK   rails 8.0.0 / AA 3.5.0 ->  activeadmin (3.5.2)  rails (8.0.5.1)
OK   rails 8.1.0 / AA 3.2.0 ->  activeadmin (3.2.5)  rails (8.1.4)
OK   rails 8.1.0 / AA 3.3.0 ->  activeadmin (3.3.0)  rails (8.1.4)
OK   rails 8.1.0 / AA 3.4.0 ->  activeadmin (3.4.0)  rails (8.1.4)
OK   rails 8.1.0 / AA 3.5.0 ->  activeadmin (3.5.2)  rails (8.1.4)

Full suite on Ruby 3.4.10, freshly generated dummy app for every leg:

== rails 8.0 / AA 3.2.0 ==  5 examples, 0 failures
== rails 8.0 / AA 3.3.0 ==  5 examples, 0 failures
== rails 8.0 / AA 3.4.0 ==  5 examples, 0 failures
== rails 8.0 / AA 3.5.0 ==  5 examples, 0 failures
== rails 8.1 / AA 3.2.0 ==  5 examples, 0 failures
== rails 8.1 / AA 3.3.0 ==  5 examples, 0 failures
== rails 8.1 / AA 3.4.0 ==  5 examples, 0 failures
== rails 8.1 / AA 3.5.0 ==  5 examples, 0 failures

The required leg, start to finish:

$ RBENV_VERSION=3.4.10 RAILS=8.1.0 AA=3.5.0 rbenv exec bundle install
Bundle complete! 12 Gemfile dependencies, 109 gems now installed.

$ RBENV_VERSION=3.4.10 rbenv exec ruby -v
ruby 3.4.10 (2026-06-30 revision 2b0b7728dc) +PRISM [arm64-darwin24]

$ RBENV_VERSION=3.4.10 RAILS=8.1.0 AA=3.5.0 rbenv exec bundle list | grep -E 'rails|activeadmin'
  * activeadmin (3.5.2)
  * rails (8.1.4)

$ RBENV_VERSION=3.4.10 RAILS=8.1.0 AA=3.5.0 rbenv exec bundle exec rake setup
(ok)

$ RBENV_VERSION=3.4.10 RAILS=8.1.0 AA=3.5.0 rbenv exec bundle exec rspec spec
.....

Finished in 3.61 seconds (files took 1.05 seconds to load)
5 examples, 0 failures

Order independence confirmed with --order rand:1 and --order rand:42
(5 examples, 0 failures each) — localStorage does not leak between examples.

Eager-loading path, i.e. the runner's configuration, reproduced locally:

CI=true ruby 3.4.10 / rails 8.1.0 / simplecov 1.3.2 : 5 examples, 0 failures
CI=true ruby 3.4.10 / rails 8.0.0 / simplecov 1.3.2 : 5 examples, 0 failures

Top leg of the matrix, install only, as required:

$ RBENV_VERSION=4.0.6 RAILS=8.1.0 AA=3.5.0 rbenv exec bundle install
Bundle complete! 12 Gemfile dependencies, 109 gems now installed.

Ruby 4.0.6 also runs the suite green (5 examples, 0 failures on Rails 8.1.0),
beyond the install-only requirement.

@Fivell
Fivell force-pushed the feat/test-harness-and-ci branch from a482e30 to 41f28fe Compare October 1, 2026 11:25
@Fivell
Fivell force-pushed the feat/test-harness-and-ci branch from 41f28fe to 5b0087d Compare October 1, 2026 11:32
@Fivell
Fivell merged commit 32e157c into master Oct 1, 2026
47 of 48 checks passed
@Fivell
Fivell deleted the feat/test-harness-and-ci branch October 1, 2026 12:31
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