Test setup - #88
Merged
Merged
Conversation
jasonkarns
force-pushed
the
test-setup
branch
2 times, most recently
from
July 23, 2026 20:40
acebbdd to
557b27d
Compare
jasonkarns
marked this pull request as ready for review
July 23, 2026 20:46
jasonkarns
force-pushed
the
test-setup
branch
3 times, most recently
from
July 24, 2026 19:39
e087fa2 to
ad9d45e
Compare
This will allow the gemfile to do things more intelligently in response to specific rails versions. (Attempting to avoid separate Gemfiles)
Update rails-generated binstubs to v6
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Extract and unify the "setup" of the example app by using
example/script/setup. Previously, the setup steps were (partially) duplicated between the top levelscript/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 runscript/setup, and iterate on test invocations. (under various rails or ruby combinations)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 cleanwipes the sqlite dbs, andrake clobberwipes bundler binstubs and bundler lockfiles. (Sorake cleancan be invoked between each unit test.rake clobberis more heavy handed and would be run to nuke and reset a script/setup run.)