Sha256: 708c089d05c17b881d41dd28ddf7b0e6d9650b7d35fe93d7d5ba7a1723d19f17

Contents?: true

Size: 852 Bytes

Versions: 2

Compression:

Stored size: 852 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    module Lint
      describe EmptyEnsure do
        subject(:cop) { EmptyEnsure.new }

        it 'registers an offence for empty ensure' do
          inspect_source(cop,
                         ['begin',
                          '  something',
                          'ensure',
                          'end'])
          expect(cop.offences.size).to eq(1)
        end

        it 'does not register an offence for non-empty ensure' do
          inspect_source(cop,
                         ['begin',
                          '  something',
                          '  return',
                          'ensure',
                          '  file.close',
                          'end'])
          expect(cop.offences).to be_empty
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-0.13.1 spec/rubocop/cop/lint/empty_ensure_spec.rb
rubocop-0.13.0 spec/rubocop/cop/lint/empty_ensure_spec.rb