Sha256: c8c8b4c4ef767332135c62fbf1965e657867805f0d7bf8e19c9aededa53b9496
Contents?: true
Size: 928 Bytes
Versions: 2
Compression:
Stored size: 928 Bytes
Contents
# encoding: utf-8 require 'spec_helper' describe RuboCop::Cop::Style::SpaceBeforeComment do subject(:cop) { described_class.new } it 'registers an offense for missing space before an EOL comment' do inspect_source(cop, 'a += 1# increment') expect(cop.highlights).to eq(['# increment']) end it 'accepts an EOL comment with a preceding space' do inspect_source(cop, 'a += 1 # increment') expect(cop.offenses).to be_empty end it 'accepts a comment that begins a line' do inspect_source(cop, '# comment') expect(cop.offenses).to be_empty end it 'accepts a doc comment' do inspect_source(cop, ['=begin', 'Doc comment', '=end']) expect(cop.offenses).to be_empty end it 'auto-corrects missing space' do new_source = autocorrect_source(cop, 'a += 1# increment') expect(new_source).to eq('a += 1 # increment') end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.29.1 | spec/rubocop/cop/style/space_before_comment_spec.rb |
rubocop-0.29.0 | spec/rubocop/cop/style/space_before_comment_spec.rb |