Class: Capybara::RSpecMatchers::HaveSelector

Inherits:
Matcher
  • Object
show all
Defined in:
lib/capybara/rspec/matchers.rb

Direct Known Subclasses

MatchSelector

Instance Attribute Summary

Attributes inherited from Matcher

#failure_message, #failure_message_when_negated

Instance Method Summary collapse

Methods inherited from Matcher

#wrap

Methods included from Compound

#and, #and_then, #or

Constructor Details

#initialize(*args, &filter_block) ⇒ HaveSelector

Returns a new instance of HaveSelector



59
60
61
62
# File 'lib/capybara/rspec/matchers.rb', line 59

def initialize(*args, &filter_block)
  @args = args
  @filter_block = filter_block
end

Instance Method Details

#descriptionObject



72
73
74
# File 'lib/capybara/rspec/matchers.rb', line 72

def description
  "have #{query.description}"
end

#does_not_match?(actual) ⇒ Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/capybara/rspec/matchers.rb', line 68

def does_not_match?(actual)
  wrap_does_not_match?(actual) { |el| el.assert_no_selector(*@args, &@filter_block) }
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/capybara/rspec/matchers.rb', line 64

def matches?(actual)
  wrap_matches?(actual) { |el| el.assert_selector(*@args, &@filter_block) }
end

#queryObject



76
77
78
# File 'lib/capybara/rspec/matchers.rb', line 76

def query
  @query ||= Capybara::Queries::SelectorQuery.new(*session_query_args, &@filter_block)
end