Sha256: a03fc89fed196c1b9b09769acfb5e9e55a93b02848e4752fd18a773d7c01f9eb

Contents?: true

Size: 752 Bytes

Versions: 3

Compression:

Stored size: 752 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    module Style
      describe ModuleFunction do
        let(:cop) { described_class.new }

        it 'registers an offence for extend self in module' do
          inspect_source(cop,
                         ['module Test',
                          '  extend self',
                          '  def test; end',
                          'end'])
          expect(cop.offences.size).to eq(1)
        end

        it 'accepts extend self in class' do
          inspect_source(cop,
                         ['class Test',
                          '  extend self',
                          'end'])
          expect(cop.offences).to be_empty
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubocop-0.12.0 spec/rubocop/cop/style/module_function_spec.rb
rubocop-0.11.1 spec/rubocop/cop/style/module_function_spec.rb
rubocop-0.11.0 spec/rubocop/cops/style/module_function_spec.rb