Skip to content

5563 - Replace value parameter spec stubs with real tests#7068

Open
fuentesjr wants to merge 4 commits into
rubyforgood:mainfrom
fuentesjr:5563-values-specs
Open

5563 - Replace value parameter spec stubs with real tests#7068
fuentesjr wants to merge 4 commits into
rubyforgood:mainfrom
fuentesjr:5563-values-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/values/ with real specs (one commit per file), following the patterns in case_contact_parameters_spec.rb, volunteer_parameters_spec.rb, and banner_parameters_spec.rb:

  • UserParameters — carries the bulk of the coverage: the permit allowlist (including nested address_attributes), ParameterMissing on a missing root key, and each builder method (with_organization, with_password, with_type, without_type, without_active, with_only, without)
  • SupervisorParameters / CasaAdminParameters — thin subclasses that only fix the root param key (:supervisor / :casa_admin); specs pin the root key, ParameterMissing, and one inherited builder each rather than re-testing the parent's surface
  • AllCasaAdminParameters — a separate SimpleDelegator rather than a UserParameters subclass: email/password passthrough, unpermitted filtering, ParameterMissing, and with_password

These characterize current behavior; no app code changed.

One thing worth a look: writing these surfaced a real bug in UserParameters#without, filed as #7067. ActionController::Parameters#reject! yields string keys, so the symbol-keyed keys.include?(key) check never matches and the method silently removes nothing. Its only caller — CreateCasaAdminService#build — passes symbols (.without(:active, :type)), so neither attribute is actually stripped from admin creation. The specs document current behavior with NOTE: comments pointing at #7067 rather than fixing app code in a test PR; happy to follow up with the fix separately.

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

  • bundle exec rspec spec/values/user_parameters_spec.rb spec/values/supervisor_parameters_spec.rb spec/values/casa_admin_parameters_spec.rb spec/values/all_casa_admin_parameters_spec.rb → 22 examples, 0 failures, 0 pending
  • bundle exec standardrb spec/values/ → no offenses
  • No pending / skip / xit remains in the four files

Screenshots please :)

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

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.

1 participant