Sha256: 3627ed2927625fe7ee526695cda5186785951ca8b32540b7113a75a72bd9b5fd
Contents?: true
Size: 1.21 KB
Versions: 3
Compression:
Stored size: 1.21 KB
Contents
# encoding: utf-8 require 'spec_helper' module Rubocop module Cop describe Encoding do let (:encoding) { Encoding.new } it 'registers an offence when no encoding present' do inspect_source(encoding, 'file.rb', ['def foo() end']) encoding.offences.map(&:message).should == ['Missing encoding comment.'] end it 'accepts encoding on first line' do inspect_source(encoding, 'file.rb', ['# encoding: utf-8', 'def foo() end']) encoding.offences.should == [] end it 'accepts encoding on second line when shebang present' do inspect_source(encoding, 'file.rb', ['#!/usr/bin/env ruby', '# encoding: utf-8', 'def foo() end']) encoding.offences.map(&:message).should == [] end it 'registers an offence when encoding is in the wrong place' do inspect_source(encoding, 'file.rb', ['def foo() end', '# encoding: utf-8']) encoding.offences.map(&:message).should == ['Missing encoding comment.'] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.3.2 | spec/rubocop/cops/encoding_spec.rb |
rubocop-0.3.1 | spec/rubocop/cops/encoding_spec.rb |
rubocop-0.3.0 | spec/rubocop/cops/encoding_spec.rb |