Sha256: 337c1fa758779bdd06df08c9a0ce090ff328387b31741be86981da5bbc2f0df7
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 KB
Contents
# encoding: utf-8 require 'spec_helper' describe RuboCop::Cop::Style::Tab do subject(:cop) { described_class.new } it 'registers an offense for a line indented with tab' do inspect_source(cop, ["\tx = 0"]) expect(cop.offenses.size).to eq(1) end it 'registers an offense for a line indented with multiple tabs' do inspect_source(cop, ["\t\t\tx = 0"]) expect(cop.offenses.size).to eq(1) end it 'registers an offense for a line indented with mixed whitespace' do inspect_source(cop, [" \tx = 0"]) expect(cop.offenses.size).to eq(1) end it 'accepts a line with tab in a string' do inspect_source(cop, ["(x = \"\t\")"]) expect(cop.offenses).to be_empty end it 'auto-corrects a line indented with tab' do new_source = autocorrect_source(cop, ["\tx = 0"]) expect(new_source).to eq(' x = 0') end it 'auto-corrects a line indented with multiple tabs' do new_source = autocorrect_source(cop, ["\t\t\tx = 0"]) expect(new_source).to eq(' x = 0') end it 'auto-corrects a line indented with mixed whitespace' do new_source = autocorrect_source(cop, [" \tx = 0"]) expect(new_source).to eq(' x = 0') end it 'auto-corrects a line with tab in a string indented with tab' do new_source = autocorrect_source(cop, ["\t(x = \"\t\")"]) expect(new_source).to eq(" (x = \"\t\")") end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.28.0 | spec/rubocop/cop/style/tab_spec.rb |