Sha256: d542ac5c42339d08e0ec18d68551fcc944a039df213117958833e259398a5ef2

Contents?: true

Size: 910 Bytes

Versions: 11

Compression:

Stored size: 910 Bytes

Contents

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

  it 'registers an offense for `be` without an argument' do
    expect_offense(<<-RUBY)
      it { expect(foo).to be }
                          ^^ Don't use `be` without an argument.
    RUBY
  end

  it 'registers an offense for not_to be' do
    expect_offense(<<-RUBY)
      it { expect(foo).not_to be }
                              ^^ Don't use `be` without an argument.
      it { expect(foo).to_not be }
                              ^^ Don't use `be` without an argument.
    RUBY
  end

  it 'allows `be` with an argument' do
    expect_no_offenses(<<-RUBY)
      it { expect(foo).to be(1) }
      it { expect(foo).not_to be(0) }
    RUBY
  end

  it 'allows specific `be_` matchers' do
    expect_no_offenses(<<-RUBY)
      it { expect(foo).to be_truthy }
      it { expect(foo).not_to be_falsy }
    RUBY
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rubocop-rspec-1.32.0 spec/rubocop/cop/rspec/be_spec.rb
rubocop-rspec-1.31.0 spec/rubocop/cop/rspec/be_spec.rb
rubocop-rspec-1.30.1 spec/rubocop/cop/rspec/be_spec.rb
rubocop-rspec-1.30.0 spec/rubocop/cop/rspec/be_spec.rb
rubocop-rspec-1.29.1 spec/rubocop/cop/rspec/be_spec.rb
rubocop-rspec-1.29.0 spec/rubocop/cop/rspec/be_spec.rb
rubocop-rspec-1.28.0 spec/rubocop/cop/rspec/be_spec.rb
rubocop-rspec-1.27.0 spec/rubocop/cop/rspec/be_spec.rb
rubocop-rspec-1.26.0 spec/rubocop/cop/rspec/be_spec.rb
rubocop-rspec-1.25.1 spec/rubocop/cop/rspec/be_spec.rb
rubocop-rspec-1.25.0 spec/rubocop/cop/rspec/be_spec.rb