Skip to content

5563 - Replace policy spec stubs with real tests#7053

Merged
compwron merged 4 commits into
rubyforgood:mainfrom
fuentesjr:5563-policy-specs
Jul 13, 2026
Merged

5563 - Replace policy spec stubs with real tests#7053
compwron merged 4 commits into
rubyforgood:mainfrom
fuentesjr:5563-policy-specs

Conversation

@fuentesjr

Copy link
Copy Markdown
Contributor

What github issue is this PR for, if any?

Part of #5563 — intentionally not Resolves, since the umbrella has more stubs remaining.

What changed, and why?

Replaces the four pending "add some tests for X" stubs in spec/policies/ with real specs (one commit per file), using the pundit-matchers permissions DSL and build_stubbed, following the patterns in checklist_item_policy_spec.rb and custom_org_link_policy_spec.rb:

  • NotePolicycreate? / edit? / update? / destroy? (all delegate to admin_or_supervisor?): casa_admin and supervisor permitted, volunteer denied
  • FundRequestPolicynew? / create? are intentionally unconditional; the spec pins that all roles (and even a nil user) are permitted, with a NOTE explaining access is constrained upstream by FundRequestsController#verify_casa_case
  • LearningHourTopicPolicy / LearningHourTypePolicy — empty policy classes; specs characterize the inherited admin-only contract (new? / create? / edit? / update?) their controllers rely on: casa_admin permitted, supervisor and volunteer denied

Coverage matches each controller's authorized actions exactly. None of these policies define a Scope or permitted_attributes, so no org-scoping specs apply.

How is this tested? (please write rspec and jest tests!) 💖💪

  • bundle exec rspec spec/policies/note_policy_spec.rb spec/policies/fund_request_policy_spec.rb spec/policies/learning_hour_topic_policy_spec.rb spec/policies/learning_hour_type_policy_spec.rb → 13 examples, 0 failures, 0 pending
  • bundle exec standardrb spec/policies/ → no offenses
  • No pending / skip / xit remains in the four files

Screenshots please :)

N/A — test-only change, no UI.

@github-actions github-actions Bot added 🧪 Tests Tests ruby Touches Ruby code labels Jul 11, 2026

@compwron compwron left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

@compwron compwron merged commit 04ddbc8 into rubyforgood:main Jul 13, 2026
12 checks passed
@compwron

Copy link
Copy Markdown
Collaborator

yay tests! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ruby Touches Ruby code 🧪 Tests Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants