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
#on_send(node) ⇒ Object
246 247 248 249 250 251 252 |
# File 'lib/rubocop/cop/capybara/rspec/predicate_matcher.rb', line 246 def on_send(node) if style == :inflected check_inflected(node) elsif style == :explicit check_explicit(node) end end |