require File.dirname(__FILE__) + '/../../spec_helper.rb' require 'reek/code_parser' require 'reek/sniffer' require 'reek/smells/long_method' include Reek include Reek::Smells def process_method(src) source = src.to_reek_source sniffer = Sniffer.new(source) CodeParser.new(sniffer).process_defn(source.syntax_tree) end describe LongMethod do it 'should not report short methods' do 'def short(arga) alf = f(1);@bet = 2;@cut = 3;@dit = 4; @emp = 5;end'.should_not reek end it 'should report long methods' do 'def long(arga) alf = f(1);@bet = 2;@cut = 3;@dit = 4; @emp = 5;@fry = 6;end'.should reek_only_of(:LongMethod, /6 statements/) end it 'should not report initialize' do 'def initialize(arga) alf = f(1);@bet = 2;@cut = 3;@dit = 4; @emp = 5;@fry = 6;end'.should_not reek end it 'should only report a long method once' do src = <