Sha256: e2a5e0e4108c98f6417ce646e55d0a2089aff20c3ce90e0325fca3d4570c2ead

Contents?: true

Size: 959 Bytes

Versions: 3

Compression:

Stored size: 959 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

      it 'registers an offence for left brace without spaces' do
        inspect_source(space, 'file.rb', ['each{ puts }'])
        space.offences.map(&:message).should ==
          ["Surrounding space missing for '{'."]
      end

      it 'registers an offence for right brace without inner space' do
        inspect_source(space, 'file.rb', ['each { puts}'])
        space.offences.map(&:message).should ==
          ["Space missing to the left of '}'."]
      end

      it 'accepts an empty hash literal with no space inside' do
        inspect_source(space, 'file.rb',
                       ['view_hash.each do |view_key|',
                        'end',
                        '@views = {}',
                        ''])
        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_around_braces_spec.rb
rubocop-0.3.1 spec/rubocop/cops/space_around_braces_spec.rb
rubocop-0.3.0 spec/rubocop/cops/space_around_braces_spec.rb