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
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
– Diametricallyapp/views/layouts/site/application.html.erb:10
generally points to thejavascript_pack_tag
statement, which leads me to believe that there's some sort of race condition between the test and webpack – Allamerican