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.32.0 spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb
rubocop-rspec-1.31.0 spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb
rubocop-rspec-1.30.1 spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb
rubocop-rspec-1.30.0 spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb
rubocop-rspec-1.29.1 spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb
rubocop-rspec-1.29.0 spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb
rubocop-rspec-1.28.0 spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb
rubocop-rspec-1.27.0 spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb
rubocop-rspec-1.26.0 spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb
rubocop-rspec-1.25.1 spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb
rubocop-rspec-1.25.0 spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb
rubocop-rspec-1.24.0 spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb
rubocop-rspec-1.23.0 spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb
rubocop-rspec-1.22.2 spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb
rubocop-rspec-1.22.1 spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb
rubocop-rspec-1.22.0 spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb
rubocop-rspec-1.21.0 spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb
rubocop-rspec-1.20.1 spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb
rubocop-rspec-1.20.0 spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb
rubocop-rspec-1.19.0 spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb