Ensure screenshot taken on expect() failures
Ensure screenshot taken on expect() failures

Starting with RSpec 3.3.0, `expect()` failures do not raise an
exception immediately. Instead each failure is recorded in a thread-
local "aggregator" and then raised at end of the example.

This interferes with capybara-screenshot because `after` hooks execute
*before* these aggregated failures are raised. In other words, in the
`after` block `example.exception` will be `nil`. This makes capybara-
screenshot think that the example hasn't failed, and thus it does not
take a screenshot, even though there are actual failures.

This commit works around this problem by using some behind-the-scenes
knowledge of how rspec-expectations does the aggregation. Now we reach
into the thread-local storage (`RSpec::Support.failure_notifier`) and
discover whether there are in fact failures "queued up". If so, we will
consider the example to have failed and take a screenshot.

mattheworiordan/capybara-screenshot