Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move specs in volunteers_controller_spec to volunteers_spec #4447

Conversation

LeGorge
Copy link
Contributor

@LeGorge LeGorge commented Jan 14, 2023

What github issue is this PR for, if any?

Part of #4129
Not closing yet as there will be more on the way.

What changed, and why?

The volunteers_controller_spec file was removed and all of its specs moved to volunteers_spec

  • Most of it was already being tested in other places, so I only added whatever was missing

    • line 32: already tested between volunteer_policy_spec & application_controller_spec
    • line 42: already tested in volunteers_spec at describe "PATCH /deactivate"
  • I took the liberty of improving the volunteers edit action:

    • by adding a condition to an assignment as the same condition gates its usage in the view and there's no need to always query the DB for it.

How will this affect user permissions?

  • no effect

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

  • does not apply

Screenshots please :)

  • does not apply

Feedback please? (optional)

  • I would like to see the request specs renamed to a format including the name request, for example:
    • volunteers_spec to volunteers_request_spec

That would follow rspec's standard naming convention and avoid a wrong connection to volunteer_spec which is the model one.
I'm not sure if that's already planned, because some files are named that way, but I chose to follow the instructions from here: https://github.com/rubyforgood/casa/blob/main/doc/architecture-decisions/0008-controller-specs.txt

 - Add a couple of missing specs
 - Add a condition to the edit controller action to avoid unnecessary db queries
@github-actions github-actions bot added ruby Pull requests that update Ruby code Tests! 🎉💖👏 labels Jan 14, 2023
@compwron compwron merged commit c5ddad5 into rubyforgood:main Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ruby Pull requests that update Ruby code Tests! 🎉💖👏
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants