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



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

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

Instance Method Details

#descriptionObject



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

def description
  "have all selectors"
end

#does_not_match?(_actual) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (ArgumentError)


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

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)


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

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