hanami-view/spec/unit
Tim Riley a5bd7d25bc
Ensure proper access to full `locals` hash in templates (#208)
This _should_ already have worked, thanks to the `method_missing`-based `#locals` method that we expose in `Hanami::View::Scope`.

However, `locals` in in fact a _local variable_ in the template rendering context, since that's the name of the one and only parameter for the method that Tilt compiles each template into. This means we can't access the `#locals` on our `Scope` instance without explicitly calling `self.locals`.

To fix this, we pass our `scope._locals` additionally into Tilt's `render` method, which will allow bare `locals` references to work inside templates.

Since this behavior evaded detection for so many years, we now have a dedicated test to make sure it remains working like we expect in the future.
2022-04-22 22:41:14 +10:00
..
context_helpers Create ApplicationContext and (initial) context helpers for use within full Hanami apps (#177) 2020-07-21 20:51:15 +10:00
context_spec.rb Rename dry-view to hanami-view 2020-03-15 22:55:10 +11:00
decorated_attributes_spec.rb Rename dry-view to hanami-view 2020-03-15 22:55:10 +11:00
exposure_spec.rb Rename dry-view to hanami-view 2020-03-15 22:55:10 +11:00
exposures_spec.rb Fix spelling in specs (#186) 2021-02-28 09:00:14 +11:00
part_builder_spec.rb Rename dry-view to hanami-view 2020-03-15 22:55:10 +11:00
part_spec.rb Fix spelling in specs (#186) 2021-02-28 09:00:14 +11:00
render_environment_spec.rb Rename dry-view to hanami-view 2020-03-15 22:55:10 +11:00
rendered_spec.rb Rename dry-view to hanami-view 2020-03-15 22:55:10 +11:00
renderer_spec.rb Ensure proper access to full `locals` hash in templates (#208) 2022-04-22 22:41:14 +10:00
scope_spec.rb Fix spelling in specs (#186) 2021-02-28 09:00:14 +11:00
view_spec.rb Raise LayoutNotFoundError when layout is missing (#191) 2021-06-11 22:50:32 +10:00