Run the specs and RuboCop in GitHub Actions - #9
Merged
Merged
Conversation
IgorFroehner
force-pushed
the
chore/ci
branch
2 times, most recently
from
August 13, 2026 17:16
ab465f8 to
ee38006
Compare
Three were mechanical: described_class in config_spec, and naming the subject in data_spec. The other two were RSpec/SubjectStub, which flagged something real. Two data_spec contexts stubbed `associations_for` on the object under test to simulate an association, because Security had none to record. Giving it a self-referential `guard` removes the stub and covers the `associations:` option against a real association for the first time. Also adopts four suggestions from cops that are still pending, where the assertion is plainly better: be(true) proves the value is actually true rather than merely == true, which is the point of the specs covering Config#async= coercion.
Specs and lint are separate jobs. Lint needs neither Postgres nor a database, so it runs in parallel and reports independently -- a failing example does not hide the lint result until the next round. Ruby comes from .ruby-version so CI and local development cannot drift. The specs job takes its database from the service container rather than creating one, since spec/rails_helper.rb runs the migrations at boot and an empty database is all it needs. Replaces .travis.yml, which pinned Ruby 2.2.4 against a gemspec requiring Rails 6.1, and which Travis stopped running for open source repositories years ago.
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.
Adds CI, as asked for in #8. Stacked on
chore/make-suite-runnable, because aworkflow on
masteras it stands would go red immediately — the suite does notboot there, which is what #8 fixes.
Until #8 merges this PR shows its nine commits too. The two that belong here:
Merge #8 first and this narrows to those two.
The workflow
Specs and lint on push to
masterand on every PR. Ruby comes from.ruby-version, so CI and local development cannot drift. Postgres runs as aservice container on the port
spec/dummy/config/database.ymlalready defaultsto, so there is no CI-specific database configuration to keep in sync.
.travis.ymlgoes: it pinned Ruby 2.2.4 against a gemspec requiring Rails 6.1,and Travis stopped running open source repositories years ago.
Getting the lint green
rubocopreported 5 offences that predate this work, so CI would have been redon day one. Three were mechanical —
described_class, and naming a subject.The other two were
RSpec/SubjectStub, and those were pointing at somethingreal: two
data_speccontexts stubbedassociations_foron the object undertest to simulate an association, because
Securityhad none to record. So theassociations:option — a documented feature — had never been exercised againsta real association. Giving
Securitya self-referentialguardremoves thestubs and covers it properly.
Also disabled RuboCop's pending-cop banner. It was 80 of the 84 lines the run
printed and would have buried the actual result in every log.
Verification
Clean checkout, database dropped, running exactly what the workflow runs:
40 examples, 0 failures and no offenses detected.