Skip to content

Style/MixinGrouping registers offense for rspec's include-expectation #4172

Description

@andreaswachowski

The new Style/MixinGrouping incorrectly registers an offense when rspec's include-expectation is used with multiple elements.


Expected behavior

Rubocop does not register an offense.

Actual behavior

Rubocop registers an offense.

Steps to reproduce the problem

Create the following file, e.g. as mixin_grouping_spec.rb:

require 'rspec'

describe 'rubocop Style/MixinGrouping' do
  it 'should not register an offense for rspec-include' do
    expect([1, 2, 3]).to include(1, 2)
  end
end

Call rubocop mixin_grouping_spec.rb:

$ rubocop mixin_grouping_spec.rb
Inspecting 1 file
C

Offenses:

mixin_grouping_spec.rb:5:26: C: Put include mixins in separate statements.
    expect([1, 2, 3]).to include(1, 2)
                         ^^^^^^^^^^^^^

1 file inspected, 1 offense detected

RuboCop version

$ rubocop -V
0.48.0 (using Parser 2.4.0.0, running on ruby 2.4.0 x86_64-darwin16)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions