Created
January 31, 2014 04:45
-
-
Save puyo/8726739 to your computer and use it in GitHub Desktop.
More useful output from Capybara
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# More useful output from Capybara. | |
# | |
# Before: | |
# | |
# Unable to find link or button "Year 5" | |
# | |
# After: | |
# | |
# Unable to find link or button "Year 5" in "Sorry, something went wrong We've | |
# been notified of the error and are looking into it." | |
# | |
# Installation: | |
# | |
# Copy to `spec/support/capybara_find_with_info.rb` | |
# | |
require 'capybara/node/finders' | |
module Capybara | |
module Node | |
module Finders | |
def find_with_info(*args) | |
begin | |
find_without_info(*args) | |
rescue Capybara::ElementNotFound => e | |
raise e.class, "#{e.message} in \"#{text}\"", e.backtrace | |
end | |
end | |
alias_method_chain :find, :info | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment