Skip to content

Commit

Permalink
Keep all specs in dot_position_spec
Browse files Browse the repository at this point in the history
  • Loading branch information
tdeo authored and bbatsov committed Oct 8, 2020
1 parent 0efca36 commit 2f5a210
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 37 deletions.
37 changes: 0 additions & 37 deletions spec/rubocop/cli/cli_autocorrect_spec.rb
Expand Up @@ -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
8 changes: 8 additions & 0 deletions spec/rubocop/cop/layout/dot_position_spec.rb
Expand Up @@ -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
Expand Down

0 comments on commit 2f5a210

Please sign in to comment.