Skip to content

Add a dummy app, specs and CI; fix form auto-init on jQuery 3 - #9

Merged
Fivell merged 4 commits into
masterfrom
feature/dummy-app-and-ci
Oct 1, 2026
Merged

Fivell merged 4 commits into
masterfrom
feature/dummy-app-and-ci

Conversation

@Fivell

@Fivell Fivell commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

The gem had no tests and no CI, so a regression could only be caught by a user. Writing the first suite found one.

Test harness

A throwaway Rails app, generated on demand by spec/support/rails_template.rb into the gitignored spec/rails/rails-<version>/ — the same pattern the sibling plugins use. Driven through headless Chrome by cuprite.

The dummy app pins config.eager_load in the test environment. The generated default only eager loads when CI is set, and without it Zeitwerk drops Active Admin's own constants during boot, which fails the index page long before any of this gem's code runs. Pinning it keeps a local run and a CI run on the same footing.

10 examples covering both entry points: the date_range filter (the "Set range" link, the popup, each preset's dates, dismissal by an outside click, and that the chosen range actually filters the collection) and the datetime_preset_pair auto-init in a form.

The bug

$(document).on('ready') was removed in jQuery 3.0, and Active Admin 3.x ships jQuery 3. The auto-init handler never fired, so every input pair marked with the documented wrapper_html: { class: 'datetime_preset_pair' } was silently left without its "Set range" link. Only the filter path — wired by hand in the host app — still worked. Switched to $(fn), and fixed the README snippets that told readers to use the removed form.

Both auto-init specs fail on the parent commit and pass on the fix.

CI

Ruby 3.2-3.4 against Rails 7.1, 7.2 and 8.0, each with Active Admin 3.2 and 3.5. Rails 8 has no 3.2-compatible release, so that pair is excluded. Every corner of the matrix was run locally before pushing.

Also

  • Dropped the bundler "~> 1.8" development dependency — it cannot resolve against the bundler that ships with any supported Ruby, so bundle install failed outright.

@Fivell Fivell closed this Sep 30, 2026
@Fivell Fivell reopened this Sep 30, 2026
The gem shipped with no tests at all, so every change to the JS was
verified by hand. Add the harness the sibling plugins use: a Rails app
generated on demand by spec/support/rails_template.rb into the gitignored
spec/rails/rails-<version>/, driven through headless Chrome by cuprite.

The dummy app pins config.eager_load in the test environment. The
generated default only eager loads when CI is set, and without it
Zeitwerk drops Active Admin's own constants during boot, which fails the
index page long before any of this gem's code runs.

Covers the date_range filter path: the "Set range" link, the popup, each
preset's dates, dismissal by an outside click, and that the chosen range
actually filters the collection.

The bundler "~> 1.8" development dependency goes: it cannot resolve
against the bundler that ships with any supported Ruby.
$(document).on('ready') was removed in jQuery 3.0, and Active Admin 3.x
ships jQuery 3. The handler never fired, so every input pair marked with
the documented `wrapper_html: { class: 'datetime_preset_pair' }` was
silently left without its "Set range" link. Only the filter path, wired
by hand in the host app, still worked.

Switch to $(fn), which jQuery has always supported, and fix the README
snippets that told readers to use the removed form.
Ruby 3.2-3.4 against Rails 7.1, 7.2 and 8.0, each with Active Admin 3.2
and 3.5. Rails 8 has no 3.2-compatible release, so that pair is excluded.
The suite's first visit compiles active_admin.scss and the JS bundle, which
outruns Ferrum's 5s default response timeout on a loaded runner. A leg died
with Ferrum::TimeoutError on the very first example; every later request is
served from the Sprockets cache and is nowhere near the limit.
@Fivell
Fivell merged commit 5a006ec into master Oct 1, 2026
15 checks passed
@Fivell
Fivell deleted the feature/dummy-app-and-ci branch October 1, 2026 09:39
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