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

5906 update renders for turbo #5930

Merged

Conversation

mononoken
Copy link
Contributor

What github issue is this PR for, if any?

This does not resolve #5906, but is the first part in completing it.

What changed, and why?

Turbo expects all form failures to return 422 (unprocessable entity). This used to not be required in Rails, so many renders from form failures just returned 200 by default. This PR adds 422 to all render messages in controllers for form failures.

Beyond the Turbo requirement, this is a better practice and should not break any old behavior.

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

I update tests that are affected by the changed message. Many tests were asserting for were_successful or similar but now they properly expect 422.

Screenshots please :)

Note the response in the network tab:
image

@github-actions github-actions bot added dependencies Pull requests that update a dependency file ruby Pull requests that update Ruby code Tests! 🎉💖👏 labels Jul 20, 2024
@mononoken mononoken marked this pull request as ready for review July 20, 2024 23:55
@mononoken mononoken force-pushed the 5906_update_renders_for_turbo branch from 23b9c20 to cfed33c Compare July 21, 2024 00:00
Copy link
Collaborator

@elasticspoon elasticspoon left a comment

Choose a reason for hiding this comment

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

You can also do expect(response).to be_unprocessable

@elasticspoon elasticspoon merged commit 7f58519 into rubyforgood:main Jul 24, 2024
16 of 17 checks passed
@mononoken mononoken mentioned this pull request Jul 25, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file ruby Pull requests that update Ruby code Tests! 🎉💖👏
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add turbo-rails
2 participants