Sha256: f7578f63987ee6bc5455ae98b159f28ddd29cc55a47bfd5614b59592d9d62135

Contents?: true

Size: 823 Bytes

Versions: 9

Compression:

Stored size: 823 Bytes

Contents

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

  it 'finds multiple top level describes with class and method' do
    expect_violation(<<-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_violation(<<-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_violations(<<-RUBY)
      require 'spec_helper'

      describe MyClass do
      end
    RUBY
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rubocop-rspec-1.12.0 spec/rubocop/cop/rspec/multiple_describes_spec.rb
rubocop-rspec-1.11.0 spec/rubocop/cop/rspec/multiple_describes_spec.rb
rubocop-rspec-1.10.0 spec/rubocop/cop/rspec/multiple_describes_spec.rb
rubocop-rspec-1.9.1 spec/rubocop/cop/rspec/multiple_describes_spec.rb
rubocop-rspec-1.9.0 spec/rubocop/cop/rspec/multiple_describes_spec.rb
rubocop-rspec-1.8.0 spec/rubocop/cop/rspec/multiple_describes_spec.rb
rubocop-rspec-1.7.0 spec/rubocop/cop/rspec/multiple_describes_spec.rb
rubocop-rspec-1.6.0 spec/rubocop/cop/rspec/multiple_describes_spec.rb
rubocop-rspec-1.5.3 spec/rubocop/cop/rspec/multiple_describes_spec.rb