Sha256: b1059898c23d6530494644c00581a186ae12540ca8b0433b5b01e9dc5b29eda3

Contents?: true

Size: 756 Bytes

Versions: 7

Compression:

Stored size: 756 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

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

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

        it 'allows colons in strings' do
          inspect_source(space, ["str << ':'"])
          expect(space.offences.map(&:message)).to be_empty
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
rubocop-0.12.0 spec/rubocop/cop/style/space_after_colon_spec.rb
rubocop-0.11.1 spec/rubocop/cop/style/space_after_colon_spec.rb
rubocop-0.11.0 spec/rubocop/cops/style/space_after_colon_spec.rb
rubocop-0.10.0 spec/rubocop/cops/style/space_after_colon_spec.rb
rubocop-0.9.1 spec/rubocop/cops/style/space_after_colon_spec.rb
sabat-rubocop-0.9.0 spec/rubocop/cops/style/space_after_colon_spec.rb
rubocop-0.9.0 spec/rubocop/cops/style/space_after_colon_spec.rb