Sha256: f945785a9ac8dc8bdfc3d046fb8f4041033732994a3ad2cedc3ae0eedc1058e8
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
# encoding: utf-8 require 'spec_helper' module Rubocop module Cop module Style describe AsciiIdentifiers do subject(:ascii) { AsciiIdentifiers.new } it 'registers an offence for a variable name with non-ascii chars' do inspect_source(ascii, ['# encoding: utf-8', 'älg = 1']) expect(ascii.offences.size).to eq(1) expect(ascii.messages) .to eq([AsciiIdentifiers::MSG]) end it 'accepts identifiers with only ascii chars' do inspect_source(ascii, ['x.empty?']) expect(ascii.offences).to be_empty end it 'does not get confused by a byte order mark' do bom = "\xef\xbb\xbf" inspect_source(ascii, [bom + '# encoding: utf-8', "puts 'foo'"]) expect(ascii.offences).to be_empty end it 'does not get confused by an empty file' do inspect_source(ascii, ['']) expect(ascii.offences).to be_empty end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.13.1 | spec/rubocop/cop/style/ascii_identifiers_spec.rb |
rubocop-0.13.0 | spec/rubocop/cop/style/ascii_identifiers_spec.rb |