Sha256: 89d1b64ffa77b0f00c2cdd166e08985bf59ce96baadb84ba3aa86fe34bdd820c

Contents?: true

Size: 854 Bytes

Versions: 4

Compression:

Stored size: 854 Bytes

Contents

# frozen_string_literal: true

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

  it 'finds multiple top level describes with class and method' do
    expect_offense(<<-RUBY)
      describe MyClass, '.do_something' do; end
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not use multiple top level describes - try to nest them.
      describe MyClass, '.do_something_else' do; end
    RUBY
  end

  it 'finds multiple top level describes only with class' do
    expect_offense(<<-RUBY)
      describe MyClass do; end
      ^^^^^^^^^^^^^^^^ Do not use multiple top level describes - try to nest them.
      describe MyOtherClass do; end
    RUBY
  end

  it 'skips single top level describe' do
    expect_no_offenses(<<-RUBY)
      require 'spec_helper'

      describe MyClass do
      end
    RUBY
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-rspec-1.35.0 spec/rubocop/cop/rspec/multiple_describes_spec.rb
rubocop-rspec-1.34.1 spec/rubocop/cop/rspec/multiple_describes_spec.rb
rubocop-rspec-1.34.0 spec/rubocop/cop/rspec/multiple_describes_spec.rb
rubocop-rspec-1.33.0 spec/rubocop/cop/rspec/multiple_describes_spec.rb