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

adds error messages for syntax errors #3486

Merged
merged 5 commits into from
Aug 22, 2024
Merged

Conversation

alarad27
Copy link
Contributor

@alarad27 alarad27 commented Apr 1, 2024

Fixes #2700

announcements = Announcements.all(f.path)
announcement = announcements.first
assert_equal :warning, announcement.type
assert_send([announcement.instance_variable_get(:@error).to_str, :include?, "syntax error"])
Copy link
Contributor

Choose a reason for hiding this comment

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

OK - I now see this is where you were using it!

If you're going to write a test for this, then maybe you should do something like this

Rails.logger.stubs(:warn).with("Syntax error in announcement ...").returns(0)

that stubs the warning log line with the specific message and the test will fail if Rails.logger.warn is either called with different arguments (a different string) OR is never called at all.

@johrstrom johrstrom self-requested a review August 22, 2024 15:26
johrstrom
johrstrom previously approved these changes Aug 22, 2024
Copy link
Contributor

@johrstrom johrstrom left a comment

Choose a reason for hiding this comment

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

Thanks for taking this up! Sorry to hear you leave, good luck with everything!

@johrstrom johrstrom merged commit ee50a5d into master Aug 22, 2024
26 checks passed
@johrstrom johrstrom deleted the 2700-syntax-error-checking branch August 22, 2024 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

syntax errors fail silently
3 participants