Class: RuboCop::Cop::RSpec::Capybara::MatchStyle
- Extended by:
- AutoCorrector
- Defined in:
- lib/rubocop/cop/rspec/capybara/match_style.rb
Overview
Checks for usage of deprecated style methods.
Constant Summary collapse
- MSG =
'Use `%<good>s` instead of `%<bad>s`.'
- RESTRICT_ON_SEND =
%i[assert_style has_style? have_style].freeze
- PREFERRED_METHOD =
{ 'assert_style' => 'assert_matches_style', 'has_style?' => 'matches_style?', 'have_style' => 'match_style' }.freeze
Instance Method Summary collapse
Methods inherited from Base
inherited, #on_new_investigation
Methods included from RSpec::Language::NodePattern
#block_pattern, #numblock_pattern, #send_pattern
Methods included from RSpec::Language
#example?, #example_group?, #example_group_with_body?, #hook?, #include?, #let?, #rspec?, #shared_group?, #spec_group?, #subject?
Instance Method Details
#on_send(node) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/rubocop/cop/rspec/capybara/match_style.rb', line 43 def on_send(node) method_node = node.loc.selector add_offense(method_node) do |corrector| corrector.replace(method_node, PREFERRED_METHOD[method_node.source]) end end |