spec/rubocop/cops/style/and_or_spec.rb in rubocop-0.10.0 vs spec/rubocop/cops/style/and_or_spec.rb in rubocop-0.11.0
- old
+ new
@@ -41,9 +41,21 @@
it 'auto-corrects "or" with ||' do
new_source = autocorrect_source(cop, 'true or false')
expect(new_source).to eq('true || false')
end
+
+ it 'leaves *or* as is if auto-correction changes the meaning' do
+ src = "teststring.include? 'a' or teststring.include? 'b'"
+ new_source = autocorrect_source(cop, src)
+ expect(new_source).to eq(src)
+ end
+
+ it 'leaves *and* as is if auto-correction changes the meaning' do
+ src = 'x = a + b and return x'
+ new_source = autocorrect_source(cop, src)
+ expect(new_source).to eq(src)
+ end
end
end
end
end