Class: RuboCop::Cop::RSpec::Capybara::NegationMatcher

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/rspec/capybara/negation_matcher.rb

Overview

Enforces use of ‘have_no_*` or `not_to` for negated expectations.

Examples:

EnforcedStyle: not_to (default)

# bad
expect(page).to have_no_selector
expect(page).to have_no_css('a')

# good
expect(page).not_to have_selector
expect(page).not_to have_css('a')

EnforcedStyle: have_no

# bad
expect(page).not_to have_selector
expect(page).not_to have_css('a')

# good
expect(page).to have_no_selector
expect(page).to have_no_css('a')