Sha256: 02cb8ab6f1b61e802d0544f27133cb08d6ca4f2001b75bf46818358a61c9c1ec

Contents?: true

Size: 713 Bytes

Versions: 3

Compression:

Stored size: 713 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    describe SpaceAfterColon do
      let (:space) { SpaceAfterColon.new }

      it 'registers an offence for colon without space after it' do
        inspect_source(space, 'file.rb', ['x = w ? {a:3}:4'])
        space.offences.map(&:message).should ==
          ['Space missing after colon.'] * 2
      end

      it 'allows the colons in symbols' do
        inspect_source(space, 'file.rb', ['x = :a'])
        space.offences.map(&:message).should == []
      end

      it 'allows colons in strings' do
        inspect_source(space, 'file.rb', ["str << ':'"])
        space.offences.map(&:message).should == []
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubocop-0.3.2 spec/rubocop/cops/space_after_colon_spec.rb
rubocop-0.3.1 spec/rubocop/cops/space_after_colon_spec.rb
rubocop-0.3.0 spec/rubocop/cops/space_after_colon_spec.rb