Class: Capybara::RSpecMatchers::HaveNoSelectors

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

Returns a new instance of HaveNoSelectors.



101
102
103
104
# File 'lib/capybara/rspec/matchers.rb', line 101

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

Instance Method Details

#descriptionObject



114
115
116
# File 'lib/capybara/rspec/matchers.rb', line 114

def description
  'have no selectors'
end

#does_not_match?(_actual) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (ArgumentError)


110
111
112
# File 'lib/capybara/rspec/matchers.rb', line 110

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

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


106
107
108
# File 'lib/capybara/rspec/matchers.rb', line 106

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