Sha256: 1694f59988651942b255ab385ac8492224ddf0a0062a84b189ec4719d1f0f7a8

Contents?: true

Size: 563 Bytes

Versions: 2

Compression:

Stored size: 563 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

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

  it 'allows the colons in symbols' do
    inspect_source(cop, ['x = :a'])
    expect(cop.messages).to be_empty
  end

  it 'allows colons in strings' do
    inspect_source(cop, ["str << ':'"])
    expect(cop.messages).to be_empty
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-0.14.1 spec/rubocop/cop/style/space_after_colon_spec.rb
rubocop-0.14.0 spec/rubocop/cop/style/space_after_colon_spec.rb