Sha256: ce1b50d1d7e59f45cea4778d481c0723acb87c14270057c27853bcab6cae3dc8
Contents?: true
Size: 1.76 KB
Versions: 2
Compression:
Stored size: 1.76 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Rubocop::Cop::Style::EmptyLinesAroundAccessModifier do subject(:cop) { described_class.new } %w(private protected public).each do |access_modifier| it "requires blank line before #{access_modifier}" do inspect_source(cop, ['class Test', ' something', " #{access_modifier}", '', ' def test; end', 'end']) expect(cop.offenses.size).to eq(1) expect(cop.messages) .to eq(["Keep a blank line before and after #{access_modifier}."]) end it 'requires blank line after #{access_modifier}' do inspect_source(cop, ['class Test', ' something', '', " #{access_modifier}", ' def test; end', 'end']) expect(cop.offenses.size).to eq(1) expect(cop.messages) .to eq(["Keep a blank line before and after #{access_modifier}."]) end it 'accepts missing blank line when at the beginning of class/module' do inspect_source(cop, ['class Test', " #{access_modifier}", '', ' def test; end', 'end']) expect(cop.offenses).to be_empty end it 'recognizes blank lines with DOS style line endings' do inspect_source(cop, ["class Test\r", "\r", " #{access_modifier}\r", "\r", " def test; end\r", "end\r"]) expect(cop.offenses.size).to eq(0) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.19.1 | spec/rubocop/cop/style/empty_lines_around_access_modifier_spec.rb |
rubocop-0.19.0 | spec/rubocop/cop/style/empty_lines_around_access_modifier_spec.rb |