Class: RuboCop::Cop::RSpec::Capybara::SpecificMatcher

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

Overview

Checks for there is a more specific matcher offered by Capybara.

Examples:


# bad
expect(page).to have_selector('button')
expect(page).to have_no_selector('button.cls')
expect(page).to have_css('button')
expect(page).to have_no_css('a.cls', href: 'http://example.com')
expect(page).to have_css('table.cls')
expect(page).to have_css('select')
expect(page).to have_css('input', exact_text: 'foo')

# good
expect(page).to have_button
expect(page).to have_no_button(class: 'cls')
expect(page).to have_button
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')