I came across your posts after I applied a similar question. In my case, I started with webkit as a driver in capybara. I read a blog post suggesting the following code that used the has_errors match to catch any js error.
it 'should not have JavaScript errors', js: true do visit(root_path) expect(page).to_not have_errors end
If you are referring to something like this, you do not need to use any specific method to check when using the poltergeist. You can see my code that shows what I switched.
https://github.com/alaghu/learn_jquery/compare/dev...1d6be6dfd500
Basically, each test automatically checks for page errors. I needed to enter js: true in my tests. I checked this by deliberate js file error to validate these tests.
Hope this was helpful.
source share