Class: Capybara::RSpecMatchers::HaveAllSelectors

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

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) ⇒ HaveAllSelectors

Returns a new instance of HaveAllSelectors.



83
84
85
86
# File 'lib/capybara/rspec/matchers.rb', line 83

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

Instance Method Details

#descriptionObject



96
97
98
# File 'lib/capybara/rspec/matchers.rb', line 96

def description
  "have all selectors"
end

#does_not_match?(_actual) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (ArgumentError)


92
93
94
# File 'lib/capybara/rspec/matchers.rb', line 92

def does_not_match?(_actual)
  raise ArgumentError, "The have_all_selectors matcher does not support use with not_to/should_not"
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


88
89
90
# File 'lib/capybara/rspec/matchers.rb', line 88

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