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.



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

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

Instance Method Details

#descriptionObject



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

def description
  "have no selectors"
end

#does_not_match?(_actual) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (ArgumentError)


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

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)


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

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