-
Notifications
You must be signed in to change notification settings - Fork 22.2k
Description
Ok, so this is more an inconsistency, and I don't know if it is intentional or if it is accidental. It certainly expands the scope of strict locals a bit. But I found no github issues surrounding it, so at the worst there will be a closed issue saying it is not wanted that someone can find.
Steps to reproduce
in NONPARTIAL view, eg show.html.erb:
<%# locals: ( foo:, bar: ) %>
In controller:
render locals: { foo: :baz}
In test :
render(locals: {foo: :baz})
Expected behavior
So what I expect is an error in the controller when doing the render - if I declare I want locals I want them to be enforced. Alternatively an error from the view saying they are not working could be reasonable behavior. Silently ignoring them seems the worst choice by far.
I also prefer to have the error (whichever!) in the test.
Actual behavior
Controller simply ignore the directive about locals being required.
Tests DO enforce them (and this may be an rspec-ism - depending on response I may follow up with an issue for more consistency over on the rspec side).
System configuration
Rails version:
8.1.1
Ruby version:
4.0.1