lib/rubocop/cop/rspec/capybara/specific_matcher.rb in rubocop-rspec-2.15.0 vs lib/rubocop/cop/rspec/capybara/specific_matcher.rb in rubocop-rspec-2.16.0
- old
+ new
@@ -24,13 +24,11 @@
# expect(page).to have_no_link('foo', class: 'cls', href: 'http://example.com')
# expect(page).to have_table(class: 'cls')
# expect(page).to have_select
# expect(page).to have_field('foo')
#
- class SpecificMatcher < Base
- include CapybaraHelp
-
+ class SpecificMatcher < ::RuboCop::Cop::Base
MSG = 'Prefer `%<good_matcher>s` over `%<bad_matcher>s`.'
RESTRICT_ON_SEND = %i[have_selector have_no_selector have_css
have_no_css].freeze
SPECIFIC_MATCHER = {
'button' => 'button',
@@ -47,11 +45,11 @@
def on_send(node)
first_argument(node) do |arg|
next unless (matcher = specific_matcher(arg))
next if CssSelector.multiple_selectors?(arg)
- next unless specific_option?(node, arg, matcher)
- next unless specific_pseudo_classes?(arg)
+ next unless CapybaraHelp.specific_option?(node, arg, matcher)
+ next unless CapybaraHelp.specific_pseudo_classes?(arg)
add_offense(node, message: message(node, matcher))
end
end