Sha256: a0cc90338016a75ba2b7c865aae02f6e393bf91abae7fe0ab6df166c7b39901e

Contents?: true

Size: 1.06 KB

Versions: 24

Compression:

Stored size: 1.06 KB

Contents

RSpec.describe RuboCop::Cop::RSpec::InvalidPredicateMatcher do
  subject(:cop) { described_class.new }

  it 'registers an offense for double question' do
    expect_offense(<<-RUBY)
      expect(foo).to be_something?
                     ^^^^^^^^^^^^^ Omit `?` from `be_something?`.
    RUBY
  end

  it 'registers an offense for double question with `not_to`' do
    expect_offense(<<-RUBY)
      expect(foo).not_to be_something?
                         ^^^^^^^^^^^^^ Omit `?` from `be_something?`.
    RUBY
  end

  it 'registers an offense for double question with `to_not`' do
    expect_offense(<<-RUBY)
      expect(foo).to_not be_something?
                         ^^^^^^^^^^^^^ Omit `?` from `be_something?`.
    RUBY
  end

  it 'registers an offense for double question with `have_something?`' do
    expect_offense(<<-RUBY)
      expect(foo).to have_something?
                     ^^^^^^^^^^^^^^^ Omit `?` from `have_something?`.
    RUBY
  end

  it 'accepts valid predicate matcher' do
    expect_no_offenses(<<-RUBY)
      expect(foo).to be_something
    RUBY
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
rubocop-rspec-1.18.0 spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb
rubocop-rspec-1.17.1 spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb
rubocop-rspec-1.17.0 spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb
rubocop-rspec-1.16.0 spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb