Sha256: 4df8753059434775d7801c655da4e1657aa92a3caa483ac59e98d14794422018

Contents?: true

Size: 830 Bytes

Versions: 24

Compression:

Stored size: 830 Bytes

Contents

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

  it 'ignores describes with only a class' do
    expect_no_offenses('describe Some::Class do; end')
  end

  it 'enforces non-method names' do
    expect_offense(<<-RUBY)
      describe Some::Class, 'nope', '.incorrect_usage' do
                            ^^^^^^ The second argument to describe should be the method being tested. '#instance' or '.class'.
      end
    RUBY
  end

  it 'skips methods starting with a . or #' do
    expect_no_offenses(<<-RUBY)
      describe Some::Class, '.asdf' do
      end

      describe Some::Class, '#fdsa' do
      end
    RUBY
  end

  it 'skips specs not having a string second argument' do
    expect_no_offenses(<<-RUBY)
      describe Some::Class, :config do
      end
    RUBY
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

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