mattheworiordan/capybara-screenshot — pull request #91 by dontfidget (2014-07-30 22:32:41+00:00)
Title: dump screenshots from the last session used within using_session

Fixes #35. As was pointed out in the discussion #35, capybara falls back to the default session if it raises an exception within using_session and then we dump the page from that session. While we could ask capybara to keep track of the failing session name, I was thinking that (a) capybara-screenshot needs to reopen the session anyway so it can't be done without capybara-screenshot support, and (b) that I might have trouble making a general case saving the session name. So I thought it might be easiest to just keep all the logic within capybara-screenshot. This change accomplishes that (to some degree).

The caveat is that I chose not to monkey-patch `Capybara.using_screenshot` and just changed the dsl method for `using_screenshot`, which felt a little cleaner to me. I'm not sure if this is sufficient for most people's needs. I'm happy to push for a solution involving Capybara iyself, or to just monkey-patch Capybara to plug this hole, if that's what the maintainers of this project before, but either way the current behavior has been driving me batty for a year now and I'd really like to see it resolved (and am obviously more than happy to help). Thanks.