Sha256: 52e5c33af7faceba57f883164c4d0d297c3ab8ab1a5e436d41a6204f062b99ce

Contents?: true

Size: 1.11 KB

Versions: 24

Compression:

Stored size: 1.11 KB

Contents

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

  it 'flags violations for `describe :symbol`' do
    expect_offense(<<-RUBY)
      describe(:some_method) { }
               ^^^^^^^^^^^^ Avoid describing symbols.
    RUBY
  end

  it 'flags violations for `describe :symbol` with multiple arguments' do
    expect_offense(<<-RUBY)
      describe(:some_method, "description") { }
               ^^^^^^^^^^^^ Avoid describing symbols.
    RUBY
  end

  it 'flags violations for `RSpec.describe :symbol`' do
    expect_offense(<<-RUBY)
      RSpec.describe(:some_method, "description") { }
                     ^^^^^^^^^^^^ Avoid describing symbols.
    RUBY
  end

  it 'flags violations for a nested `describe`' do
    expect_offense(<<-RUBY)
      RSpec.describe Foo do
        describe :to_s do
                 ^^^^^ Avoid describing symbols.
        end
      end
    RUBY
  end

  it 'does not flag non-Symbol arguments' do
    expect_no_offenses('describe("#some_method") { }')
  end

  it 'does not flag `context :symbol`' do
    expect_no_offenses('context(:some_method) { }')
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
rubocop-rspec-1.32.0 spec/rubocop/cop/rspec/describe_symbol_spec.rb
rubocop-rspec-1.31.0 spec/rubocop/cop/rspec/describe_symbol_spec.rb
rubocop-rspec-1.30.1 spec/rubocop/cop/rspec/describe_symbol_spec.rb
rubocop-rspec-1.30.0 spec/rubocop/cop/rspec/describe_symbol_spec.rb
rubocop-rspec-1.29.1 spec/rubocop/cop/rspec/describe_symbol_spec.rb
rubocop-rspec-1.29.0 spec/rubocop/cop/rspec/describe_symbol_spec.rb
rubocop-rspec-1.28.0 spec/rubocop/cop/rspec/describe_symbol_spec.rb
rubocop-rspec-1.27.0 spec/rubocop/cop/rspec/describe_symbol_spec.rb
rubocop-rspec-1.26.0 spec/rubocop/cop/rspec/describe_symbol_spec.rb
rubocop-rspec-1.25.1 spec/rubocop/cop/rspec/describe_symbol_spec.rb
rubocop-rspec-1.25.0 spec/rubocop/cop/rspec/describe_symbol_spec.rb
rubocop-rspec-1.24.0 spec/rubocop/cop/rspec/describe_symbol_spec.rb
rubocop-rspec-1.23.0 spec/rubocop/cop/rspec/describe_symbol_spec.rb
rubocop-rspec-1.22.2 spec/rubocop/cop/rspec/describe_symbol_spec.rb
rubocop-rspec-1.22.1 spec/rubocop/cop/rspec/describe_symbol_spec.rb
rubocop-rspec-1.22.0 spec/rubocop/cop/rspec/describe_symbol_spec.rb
rubocop-rspec-1.21.0 spec/rubocop/cop/rspec/describe_symbol_spec.rb
rubocop-rspec-1.20.1 spec/rubocop/cop/rspec/describe_symbol_spec.rb
rubocop-rspec-1.20.0 spec/rubocop/cop/rspec/describe_symbol_spec.rb
rubocop-rspec-1.19.0 spec/rubocop/cop/rspec/describe_symbol_spec.rb