Sha256: c54d9fdd4998f63e30bbf0fdc896ffc09b81912513fbbb417c6922c80e5bef53

Contents?: true

Size: 850 Bytes

Versions: 1

Compression:

Stored size: 850 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

        it 'registers an offence for empty ensure' do
          inspect_source(cop,
                         ['begin',
                          '  something',
                          'ensure',
                          'end'])
          expect(cop.offences).to have(1).item
        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

1 entries across 1 versions & 1 rubygems

Version Path
rubocop-0.10.0 spec/rubocop/cops/lint/empty_ensure_spec.rb