Sha256: 7dcc1ec1addc1e8d1735b71d89f844c7a9bd174b81da4c60f9c8bc35bd9708b9

Contents?: true

Size: 730 Bytes

Versions: 3

Compression:

Stored size: 730 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    module Style
      describe AsciiIdentifiers do
        let(: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.offences.map(&:message))
            .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
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
rubocop-0.9.1 spec/rubocop/cops/style/ascii_identifiers_spec.rb
sabat-rubocop-0.9.0 spec/rubocop/cops/style/ascii_identifiers_spec.rb
rubocop-0.9.0 spec/rubocop/cops/style/ascii_identifiers_spec.rb