Sha256: 0cb95db16bb54066dd15bb3a0f1765f056dd1bc2e7fe964350c532d48439b4c4
Contents?: true
Size: 1.35 KB
Versions: 9
Compression:
Stored size: 1.35 KB
Contents
require_relative '../../spec_helper' require_lib 'reek/smell_detectors/prima_donna_method' RSpec.describe Reek::SmellDetectors::PrimaDonnaMethod do it 'reports the right values' do src = <<-EOS class Alfa def bravo! end end EOS expect(src).to reek_of(:PrimaDonnaMethod, lines: [1], context: 'Alfa', message: "has prima donna method 'bravo!'", source: 'string', name: 'bravo!') end it 'does count all occurences' do src = <<-EOS class Alfa def bravo! end def charlie! end end EOS expect(src). to reek_of(:PrimaDonnaMethod, lines: [1], name: 'bravo!'). and reek_of(:PrimaDonnaMethod, lines: [1], name: 'charlie!') end it 'reports nothing when method and bang counterpart exist' do src = <<-EOS class Alfa def bravo end def bravo! end end EOS expect(src).not_to reek_of(:PrimaDonnaMethod) end it 'does not report methods we excluded via comment' do source = <<-EOF # :reek:PrimaDonnaMethod: { exclude: [ bravo! ] } class Alfa def bravo! end end EOF expect(source).not_to reek_of(:PrimaDonnaMethod) end end
Version data entries
9 entries across 9 versions & 1 rubygems