Sha256: 41d598dfb70385750c8969af5a8bdcb46b779874e10a6a35dd57b415e8d3045b

Contents?: true

Size: 831 Bytes

Versions: 9

Compression:

Stored size: 831 Bytes

Contents

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

9 entries across 9 versions & 1 rubygems

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