Last active
December 16, 2015 07:49
-
-
Save terut/5401613 to your computer and use it in GitHub Desktop.
Extend capybara for printing inner html.
This file contains hidden or 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
# Put spec/support/capybara-finders_tap.rb | |
# Target: capybara 2.0.3 | |
module Capybara | |
module Node | |
module Finders | |
# Usage: | |
# find('div.foo1'){|x| puts x.to_s } | |
# | |
def find_with_tap(*args) | |
if block_given? | |
synchronize { all(*args).tap{ |rs| rs.each {|r| yield(r.native)} }.find! }.tap(&:allow_reload!) | |
else | |
find_without_tap(*args) | |
end | |
end | |
alias_method_chain :find, :tap | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment