spec/rubocop/cop/style/semicolon_spec.rb in rubocop-0.28.0 vs spec/rubocop/cop/style/semicolon_spec.rb in rubocop-0.29.0
- old
+ new
@@ -6,35 +6,35 @@
subject(:cop) { described_class.new(config) }
let(:cop_config) { { 'AllowAsExpressionSeparator' => false } }
it 'registers an offense for a single expression' do
inspect_source(cop,
- ['puts "this is a test";'])
+ 'puts "this is a test";')
expect(cop.offenses.size).to eq(1)
end
it 'registers an offense for several expressions' do
inspect_source(cop,
- ['puts "this is a test"; puts "So is this"'])
+ 'puts "this is a test"; puts "So is this"')
expect(cop.offenses.size).to eq(1)
end
it 'registers an offense for one line method with two statements' do
inspect_source(cop,
- ['def foo(a) x(1); y(2); z(3); end'])
+ 'def foo(a) x(1); y(2); z(3); end')
expect(cop.offenses.size).to eq(1)
end
it 'accepts semicolon before end if so configured' do
inspect_source(cop,
- ['def foo(a) z(3); end'])
+ 'def foo(a) z(3); end')
expect(cop.offenses).to be_empty
end
it 'accepts semicolon after params if so configured' do
inspect_source(cop,
- ['def foo(a); z(3) end'])
+ 'def foo(a); z(3) end')
expect(cop.offenses).to be_empty
end
it 'accepts one line method definitions' do
inspect_source(cop,
@@ -63,17 +63,17 @@
expect(cop.offenses).to be_empty
end
it 'accepts one line empty module definitions' do
inspect_source(cop,
- ['module Foo; end'])
+ 'module Foo; end')
expect(cop.offenses).to be_empty
end
it 'registers an offense for semicolon at the end no matter what' do
inspect_source(cop,
- ['module Foo; end;'])
+ 'module Foo; end;')
expect(cop.offenses.size).to eq(1)
end
it 'accept semicolons inside strings' do
inspect_source(cop,
@@ -99,16 +99,16 @@
context 'when AllowAsExpressionSeparator is true' do
let(:cop_config) { { 'AllowAsExpressionSeparator' => true } }
it 'accepts several expressions' do
inspect_source(cop,
- ['puts "this is a test"; puts "So is this"'])
+ 'puts "this is a test"; puts "So is this"')
expect(cop.offenses).to be_empty
end
it 'accepts one line method with two statements' do
inspect_source(cop,
- ['def foo(a) x(1); y(2); z(3); end'])
+ 'def foo(a) x(1); y(2); z(3); end')
expect(cop.offenses).to be_empty
end
end
end