Skip to content

Run the specs and RuboCop in GitHub Actions - #9

Merged
IgorFroehner merged 2 commits into
masterfrom
chore/ci
Aug 13, 2026
Merged

Run the specs and RuboCop in GitHub Actions#9
IgorFroehner merged 2 commits into
masterfrom
chore/ci

Conversation

@IgorFroehner

Copy link
Copy Markdown
Collaborator

Adds CI, as asked for in #8. Stacked on chore/make-suite-runnable, because a
workflow on master as it stands would go red immediately — the suite does not
boot there, which is what #8 fixes.

Until #8 merges this PR shows its nine commits too. The two that belong here:

Commit
5c4e71b Fix the outstanding RuboCop offences
b11db30 Run the specs and RuboCop in GitHub Actions

Merge #8 first and this narrows to those two.

The workflow

Specs and lint on push to master and on every PR. Ruby comes from
.ruby-version, so CI and local development cannot drift. Postgres runs as a
service container on the port spec/dummy/config/database.yml already defaults
to, so there is no CI-specific database configuration to keep in sync.

.travis.yml goes: 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

rubocop reported 5 offences that predate this work, so CI would have been red
on day one. Three were mechanical — described_class, and naming a subject.

The other two were RSpec/SubjectStub, and those were pointing at something
real: two data_spec contexts stubbed associations_for on the object under
test
to simulate an association, because Security had none to record. So the
associations: option — a documented feature — had never been exercised against
a real association. Giving Security a self-referential guard removes the
stubs 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.

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.
@IgorFroehner
IgorFroehner merged commit 7bd00a7 into master Aug 13, 2026
2 checks passed
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