Sha256: 8528e30fe56d127d1a1637b0936405e342fd680c433f9dbbd627fcd55a515528

Contents?: true

Size: 590 Bytes

Versions: 6

Compression:

Stored size: 590 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Rubocop::Cop::Style::AsciiComments do
  subject(:cop) { described_class.new }

  it 'registers an offense for a comment with non-ascii chars' do
    inspect_source(cop,
                   ['# encoding: utf-8',
                    '# 这是什么?'])
    expect(cop.offenses.size).to eq(1)
    expect(cop.messages)
      .to eq(['Use only ascii symbols in comments.'])
  end

  it 'accepts comments with only ascii chars' do
    inspect_source(cop,
                   ['# AZaz1@$%~,;*_`|'])
    expect(cop.offenses).to be_empty
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rubocop-0.22.0 spec/rubocop/cop/style/ascii_comments_spec.rb
rubocop-0.21.0 spec/rubocop/cop/style/ascii_comments_spec.rb
rubocop-0.20.1 spec/rubocop/cop/style/ascii_comments_spec.rb
rubocop-0.20.0 spec/rubocop/cop/style/ascii_comments_spec.rb
rubocop-0.19.1 spec/rubocop/cop/style/ascii_comments_spec.rb
rubocop-0.19.0 spec/rubocop/cop/style/ascii_comments_spec.rb