This error happens randomly during testing (standard Rails testing toolkit) after running rails test. Failed test can be any test in any file.
This error happens usually in testing environment during CI/CD process. Locally it occurs very rarely.
Here is a full stack trace:
Error:
SitePositionsControllerTest#test_should_create_position_link:
ActionView::Template::Error: 785: unexpected token at ''
app/views/layouts/site/application.html.erb:10
test/controllers/site_positions_controller_test.rb:28:in `block (2 levels) in <class:SitePositionsControllerTest>'
test/controllers/site_positions_controller_test.rb:27:in `block in <class:SitePositionsControllerTest>'
test/test_helper.rb:64:in `block (3 levels) in run'
test/test_helper.rb:63:in `block (2 levels) in run'
test/test_helper.rb:62:in `block in run'
test/test_helper.rb:54:in `run'
rails test test/controllers/site_positions_controller_test.rb:18
Like @jellymann I was having this issue on calls to javascript_pack_tag.
I added bin/rails webpacker:compile before rails test and it seems to have resolved the issue.
This was happening pretty regularly. In the two days since I made that change, at least a dozen or so builds have gone off without this error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With