class Capybara::RSpecMatchers::Matcher
def initialize(*args, &filter_block)
def initialize(*args, &filter_block) @args = args.dup @filter_block = filter_block end
def session_options
def session_options @context_el ||= nil if @context_el.respond_to? :session_options @context_el.session_options elsif @context_el.respond_to? :current_scope @context_el.current_scope.session_options else Capybara.session_options end end
def session_query_args
def session_query_args if @args.last.is_a? Hash @args.last[:session_options] = session_options else @args.push(session_options: session_options) end @args end
def wrap(actual)
def wrap(actual) actual = actual.to_capybara_node if actual.respond_to?(:to_capybara_node) @context_el = if actual.respond_to?(:has_selector?) actual else Capybara.string(actual.to_s) end end
def wrap_does_not_match?(actual)
def wrap_does_not_match?(actual) yield(wrap(actual)) rescue Capybara::ExpectationNotMet => err @failure_message_when_negated = err.message false end
def wrap_matches?(actual)
def wrap_matches?(actual) yield(wrap(actual)) rescue Capybara::ExpectationNotMet => err @failure_message = err.message false end