Sha256: bf290e2be00e14213619484d0909b181fcca38042135217d02509db5e699b0db

Contents?: true

Size: 838 Bytes

Versions: 4

Compression:

Stored size: 838 Bytes

Contents

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

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

  it 'enforces non-method names' do
    expect_violation(<<-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_violations(<<-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_violations(<<-RUBY)
      describe Some::Class, :config do
      end
    RUBY
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-rspec-1.15.1 spec/rubocop/cop/rspec/describe_method_spec.rb
rubocop-rspec-1.15.0 spec/rubocop/cop/rspec/describe_method_spec.rb
rubocop-rspec-1.14.0 spec/rubocop/cop/rspec/describe_method_spec.rb
rubocop-rspec-1.13.0 spec/rubocop/cop/rspec/describe_method_spec.rb