-
-
Notifications
You must be signed in to change notification settings - Fork 543
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
Use :format
as default exposure for view unit tests.
#860
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
Note that this workaround is still necessary to get specs for views with partials to not crash as of Hanami 1.2.0. |
@jdickey Yeah, I'm receiving an error when my application.html.erb has partials:
|
This is a proposal for both a fix and a small enhancement for view unit tests.
The Fix
If you're running unit tests of a view that renders a template, without
format: :html
in theexposures
, it raises an error. See hanami/view#137So instead of generating unit tests with bogus exposures (
foo: "bar"
), we can generate with useful exposures (format: :html
).The enhancement
Given we were setting bogus exposures, we took the decision of marking that unit tests as pending. Now that we have real exposures, it's worth to test for real that the view is using
:html
as a format.So the proposal is to generate unit tests that are no longer pending.
This is related to the proposals that @cllns made with #831
Fixes hanami/view#137
Closes #831
Ref #664