Skip to content

Test setup - #88

Merged
jasonkarns merged 5 commits into
mainfrom
test-setup
Jul 24, 2026
Merged

Test setup#88
jasonkarns merged 5 commits into
mainfrom
test-setup

Conversation

@jasonkarns

@jasonkarns jasonkarns commented Jul 23, 2026

Copy link
Copy Markdown
Member
  1. Change test workflow to use matrix that passes in just the rails version itself, not the semver expression.

    This allows the Gemfile to do conditional logic based on the rails version. The first example of this is to get Rails 6.1 working on the more recent rubies

  2. Extract and unify the "setup" of the example app by using example/script/setup. Previously, the setup steps were (partially) duplicated between the top level script/test, and the top level test_helper.

    This way, script/test is merely a thin wrapper to rake. This allows devs to hop into example/ and run script/setup, and iterate on test invocations. (under various rails or ruby combinations)

  3. User rake clean and clobber tasks. In order to support setup scripts that operate both for bespoke manual invocations as well as in tests+CI, we also need repeatable clean and reset operations. To that end, we configure rake clean and clobber tasks. rake clean wipes the sqlite dbs, and rake clobber wipes bundler binstubs and bundler lockfiles. (So rake clean can be invoked between each unit test. rake clobber is more heavy handed and would be run to nuke and reset a script/setup run.)

@jasonkarns
jasonkarns force-pushed the test-setup branch 2 times, most recently from acebbdd to 557b27d Compare July 23, 2026 20:40
@jasonkarns
jasonkarns marked this pull request as ready for review July 23, 2026 20:46
@jasonkarns
jasonkarns force-pushed the test-setup branch 3 times, most recently from e087fa2 to ad9d45e Compare July 24, 2026 19:39
This will allow the gemfile to do things more intelligently in response
to specific rails versions. (Attempting to avoid separate Gemfiles)
rake-clean wipes the sqlite dbs as part of per-test setup.  This also
enables devs to run `rake clean` themselves within the example app when
testing.

rake-clobber nukes bundler binstubs and bundler lockfiles. (So we can
regenerate a fresh install after switching rails or ruby versions.)

Also remove env vars for the rake commands.

BUNDLE_GEMFILE and RAILS_ENV are not necessary for the test commands.
We're currently operating with just a single gemfile, so we don't need
to set explicit paths. Also, RAILS_ENV isn't changed anywhere so the
default (unset) will run as development as Rails does. (Better to lean
on the defaults which adheres to how rails apps are used in the wild.)
This way it can be run manually from a shell session (as well as in
tests).

Example app bootstrapping is handled by its own setup script
@jasonkarns
jasonkarns merged commit b87fe0c into main Jul 24, 2026
40 checks passed
@jasonkarns
jasonkarns deleted the test-setup branch July 24, 2026 20:29
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