How to test that application.js is loaded asynchronously in production
<p>Using capybara, I want to test that the <code>application.js</code> file is loaded asynchronously. I have tried the following code</p>

<pre><code>expect(page).to have_css('script[async="async"][src="/assets/application.js"]', visible: false)
</code></pre>

<p>but this does not work, because running the test in production mode, a digest is added, so the name of the file is something like <code>application-ae5fag34.js</code>. How do accomodate this?</p>