Sha256: c739869ceb687303b8e090a43e471a083a2c1d6d8a5dba03dc69b590be69ce09
Contents?: true
Size: 1.12 KB
Versions: 4
Compression:
Stored size: 1.12 KB
Contents
require "capybara/node/matchers" module WildcardFinders module Matchers METHODS = [] def self.method_added(name) METHODS.push(name) end ::WildcardFinders::Finders::METHODS.each do |method| if method =~ /\Afind_/ matcher_method = method.to_s.sub("find", "has") + "?" no_matcher_method = method.to_s.sub("find", "has_no") + "?" define_method(matcher_method) do |*args, &block| wait_method = respond_to?(:synchronize) ? :synchronize : :wait_until __send__(wait_method) do result = __send__(method, *args, &block) result or raise Capybara::ExpectationNotMet, "no results for #{matcher_method}:#{args}" end true end define_method(no_matcher_method) do |*args, &block| wait_method = respond_to?(:synchronize) ? :synchronize : :wait_until __send__(wait_method) do result = __send__(method, *args, &block) result and raise Capybara::ExpectationNotMet, "some results for #{matcher_method}:#{args}" end true end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems