Sha256: 6a75527264f7bfe4b3e4cb02700602adb6041150443b17ca4b155bf0ac8c33b8

Contents?: true

Size: 650 Bytes

Versions: 3

Compression:

Stored size: 650 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    describe MultilineBlocks do
      let (:blocks) { MultilineBlocks.new }

      it 'registers an offence for a multiline block with braces' do
        inspect_source(blocks, '', ['each { |x|',
                                    '}'])
        blocks.offences.map(&:message).should ==
          ['Avoid using {...} for multi-line blocks.']
      end

      it 'accepts a multiline block with do-end' do
        inspect_source(blocks, '', ['each do |x|',
                                    'end'])
        blocks.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/multiline_blocks_spec.rb
rubocop-0.3.1 spec/rubocop/cops/multiline_blocks_spec.rb
rubocop-0.3.0 spec/rubocop/cops/multiline_blocks_spec.rb