diff --git a/spec/rubocop/cli/cli_autocorrect_spec.rb b/spec/rubocop/cli/cli_autocorrect_spec.rb index 15b3c079452..552e2ff0adb 100644 --- a/spec/rubocop/cli/cli_autocorrect_spec.rb +++ b/spec/rubocop/cli/cli_autocorrect_spec.rb @@ -1693,41 +1693,4 @@ def self.some_method(foo, bar: 1) expect(status).to eq(0) expect(source_file.read).to eq(source) end - - it 'corrects multiple Layout/DotPosition offenses' do - create_file('.rubocop.yml', <<~YAML) - Layout/DotPosition: - EnforcedStyle: leading - YAML - - source_file = Pathname('example.rb') - source = <<~RUBY - @objects = @objects.where(type: :a) - - @objects = @objects. - with_relation. - paginate - RUBY - create_file(source_file, source) - - status = cli.run( - [ - '--auto-correct', - '--only', - [ - 'Layout/DotPosition', - ].join(',') - ] - ) - expect(status).to eq(0) - - corrected = <<~RUBY - @objects = @objects.where(type: :a) - - @objects = @objects - .with_relation - .paginate - RUBY - expect(source_file.read).to eq(corrected) - end end diff --git a/spec/rubocop/cop/layout/dot_position_spec.rb b/spec/rubocop/cop/layout/dot_position_spec.rb index 96fd0cf8e13..b137b270cc6 100644 --- a/spec/rubocop/cop/layout/dot_position_spec.rb +++ b/spec/rubocop/cop/layout/dot_position_spec.rb @@ -119,6 +119,14 @@ ^ Place the . on the next line, together with the method name. paginate RUBY + + expect_correction(<<~RUBY) + @objects = @objects.where(type: :a) + + @objects = @objects + .with_relation + .paginate + RUBY end end end