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.



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

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

Instance Method Details

#descriptionObject



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

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

#does_not_match?(actual) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#queryObject



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

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