Sha256: 16aeb2f2342bc97eeefa6537dec3d9c862a3d66b160e9af801b3b06d6b7dc6db
Contents?: true
Size: 1.52 KB
Versions: 7
Compression:
Stored size: 1.52 KB
Contents
# encoding: utf-8 require 'spec_helper' module Rubocop module Cop module Style describe ClassMethods do let(:cm) { ClassMethods.new } it 'registers an offence for methods using a class name' do inspect_source(cm, ['class Test', ' def Test.some_method', ' do_something', ' end', 'end']) expect(cm.offences.size).to eq(1) end it 'registers an offence for methods using a module name' do inspect_source(cm, ['module Test', ' def Test.some_method', ' do_something', ' end', 'end']) expect(cm.offences.size).to eq(1) end it 'does not register an offence for methods using self' do inspect_source(cm, ['module Test', ' def self.some_method', ' do_something', ' end', 'end']) expect(cm.offences).to be_empty end it 'does not register an offence outside class/module bodies' do inspect_source(cm, ['def self.some_method', ' do_something', 'end']) expect(cm.offences).to be_empty end end end end end
Version data entries
7 entries across 7 versions & 2 rubygems