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

Only pass template language to parser #119

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

iainbeeston
Copy link
Contributor

@iainbeeston iainbeeston commented Sep 20, 2023

assert_erb_safety accepts a filename option which prints the filename in the error message, which is invaluable for finding which file the error comes from (without this the error message just reports that there is an error in "(buffer)"). However, passing the filename right now also throws an error: ArgumentError: unknown keyword: :filename, which comes about because assert_erb_safety passes all of it's own options to straight to BetterHtml::Parser and that doesn't support a filename option (in fact it only supports template_language).

I've changed assert_erb_safety so that it only passes the template_language option through to Parser, which fixes the error and allows assert_erb_safety to correctly include the filename in the assertion message.

@iainbeeston
Copy link
Contributor Author

I have signed the CLA!

README.md Outdated Show resolved Hide resolved
lib/better_html/test_helper/safe_erb_tester.rb Outdated Show resolved Hide resolved
`assert_erb_safety` accepts a `filename` option which prints the filename in the error message, which is invaluable for finding which file the error comes from (without this the error message just reports that there is an error in "(buffer)"). However, passing the filename right now throws an error: `ArgumentError: unknown keyword: :filename`, which comes about because `assert_erb_safety` passes all of it's own options to straight to `BetterHtml::Parser` and that doesn't support a `filename` option (in fact it only supports `template_language`).

I've changed `assert_erb_safety` so that it only passes the `template_language` option through to `Parser`, which fixes the error and allows `assert_erb_safety` to correctly include the filename in the assertion message.
@iainbeeston
Copy link
Contributor Author

Thanks @rafaelfranca I've incorporated your feedback now.

@rafaelfranca rafaelfranca merged commit 2a94d6e into Shopify:main Mar 14, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants