Sha256: 3aa27df4b96b8d406e1a216663e1c1e97a89aa22d9ea27a736e2502b65dcd3a6

Contents?: true

Size: 1.26 KB

Versions: 7

Compression:

Stored size: 1.26 KB

Contents

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

  it 'accepts describe with an argument' do
    expect_no_offenses(<<-RUBY)
      describe FooClass do
      end

      RSpec.describe FooClass do
      end
    RUBY
  end

  it 'accepts methods with a name like an example block' do
    expect_no_offenses(<<-RUBY)
      Scenario.context do
        'static'
      end
    RUBY
  end

  it 'checks first argument of describe' do
    expect_offense(<<-RUBY)
      describe do
      ^^^^^^^^^^^ The first argument to `describe` should not be empty.
      end

      RSpec.describe do
      ^^^^^^^^^^^^^^^^^ The first argument to `describe` should not be empty.
      end
    RUBY
  end

  it 'checks first argument of nested describe' do
    expect_offense(<<-RUBY)
      describe FooClass do
        describe do
        ^^^^^^^^^^^ The first argument to `describe` should not be empty.
        end

        RSpec.describe do
        ^^^^^^^^^^^^^^^^^ The first argument to `describe` should not be empty.
        end
      end
    RUBY
  end

  it 'checks first argument of context' do
    expect_offense(<<-RUBY)
      context do
      ^^^^^^^^^^ The first argument to `context` should not be empty.
      end
    RUBY
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rubocop-rspec-1.32.0 spec/rubocop/cop/rspec/missing_example_group_argument_spec.rb
rubocop-rspec-1.31.0 spec/rubocop/cop/rspec/missing_example_group_argument_spec.rb
rubocop-rspec-1.30.1 spec/rubocop/cop/rspec/missing_example_group_argument_spec.rb
rubocop-rspec-1.30.0 spec/rubocop/cop/rspec/missing_example_group_argument_spec.rb
rubocop-rspec-1.29.1 spec/rubocop/cop/rspec/missing_example_group_argument_spec.rb
rubocop-rspec-1.29.0 spec/rubocop/cop/rspec/missing_example_group_argument_spec.rb
rubocop-rspec-1.28.0 spec/rubocop/cop/rspec/missing_example_group_argument_spec.rb