Sha256: 878903cff668440c284f9700a5753645eb84948f28eab1f1d421945bdb8b9cc7

Contents?: true

Size: 719 Bytes

Versions: 2

Compression:

Stored size: 719 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    module Style
      describe AsciiComments do
        subject(:ascii) { AsciiComments.new }

        it 'registers an offence for a comment with non-ascii chars' do
          inspect_source(ascii,
                         ['# encoding: utf-8',
                          '# 这是什么?'])
          expect(ascii.offences.size).to eq(1)
          expect(ascii.messages)
            .to eq([AsciiComments::MSG])
        end

        it 'accepts comments with only ascii chars' do
          inspect_source(ascii,
                         ['# AZaz1@$%~,;*_`|'])
          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_comments_spec.rb
rubocop-0.13.0 spec/rubocop/cop/style/ascii_comments_spec.rb