Sha256: 87a2e607d1bd23357ae1cb94cadca8d3229aacf50e8b05f1f61b35c5fe6238ae

Contents?: true

Size: 688 Bytes

Versions: 6

Compression:

Stored size: 688 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rubocop-0.22.0 spec/rubocop/cop/lint/empty_ensure_spec.rb
rubocop-0.21.0 spec/rubocop/cop/lint/empty_ensure_spec.rb
rubocop-0.20.1 spec/rubocop/cop/lint/empty_ensure_spec.rb
rubocop-0.20.0 spec/rubocop/cop/lint/empty_ensure_spec.rb
rubocop-0.19.1 spec/rubocop/cop/lint/empty_ensure_spec.rb
rubocop-0.19.0 spec/rubocop/cop/lint/empty_ensure_spec.rb