Class: RuboCop::Cop::Capybara::RSpec::PredicateMatcher
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Capybara::RSpec::PredicateMatcher
- Extended by:
- AutoCorrector
- Includes:
- ConfigurableEnforcedStyle, ExplicitHelper, InflectedHelper
- Defined in:
- lib/rubocop/cop/capybara/rspec/predicate_matcher.rb
Overview
Prefer using predicate matcher over using predicate method directly.
Capybara defines magic matchers for predicate methods. This cop recommends to use the predicate matcher instead of using predicate method directly.
Constant Summary collapse
- RESTRICT_ON_SEND =
%i[to to_not not_to].freeze
Constants included from ExplicitHelper
ExplicitHelper::BUILT_IN_MATCHERS, ExplicitHelper::INFLECTED_MATCHER, ExplicitHelper::MSG_EXPLICIT
Constants included from InflectedHelper
InflectedHelper::EXPLICIT_MATCHER, InflectedHelper::MSG_INFLECTED
Instance Method Summary collapse
Instance Method Details
permalink #on_send(node) ⇒ Object
[View source]
252 253 254 255 256 257 258 259 260 261 262 |
# File 'lib/rubocop/cop/capybara/rspec/predicate_matcher.rb', line 252 def on_send(node) if style == :inflected check_inflected(node) elsif style == :explicit check_explicit(node) else # :nocov: :noop # :nocov: end end |