Created
November 18, 2010 18:55
-
-
Save madadam/705423 to your computer and use it in GitHub Desktop.
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
def has_selector?(*args) | |
options = if args.last.is_a?(Hash) then args.last else {} end | |
wait_conditionally_until do | |
results = all(*args) | |
if results.empty? | |
false | |
else | |
case | |
when options[:between] | |
options[:between] === results.size | |
when options[:count] | |
options[:count] == results.size | |
when options[:maximum] | |
options[:maximum] >= results.size | |
when options[:minimum] | |
options[:minimum] <= results.size | |
else | |
results.size > 0 | |
end | |
end | |
end | |
end | |
rescue Capybara::TimeoutError | |
return false | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment