Sha256: f03d993f95569377a7559b1c035727e6b36a08bd067ca05438045ae86e25d2b1

Contents?: true

Size: 862 Bytes

Versions: 8

Compression:

Stored size: 862 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper.rb'

require 'reek/class_checker'
require 'reek/report'

include Reek

describe ClassChecker, "(Large Class)" do

  class BigOne
    26.times do |i|
      define_method "m#{i}".to_sym do
        @melting
      end
    end
  end

  before(:each) do
    @rpt = Report.new
    @cchk = ClassChecker.new(@rpt)
  end

  it 'should not report short class' do
    class ShortClass
      def m1() @m1; end
      def m2() @m2; end
      def m3() @m3; end
      def m4() @m4; end
      def m5() @m5; end
      def m6() @m6; end
    end
    @cchk.check_object(ShortClass)
    @rpt.should be_empty
  end

  it 'should report large class' do
    @cchk.check_object(BigOne)
    @rpt.length.should == 1
  end

  it 'should report class name' do
    @cchk.check_object(BigOne)
    @rpt[0].report.should match(/BigOne/)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
reek-0.0.1 spec/reek/large_class_spec.rb
reek-0.1.1 spec/reek/large_class_spec.rb
reek-0.2.0 spec/reek/large_class_spec.rb
reek-0.2.1 spec/reek/large_class_spec.rb
reek-0.2.2 spec/reek/large_class_spec.rb
reek-0.2.3 spec/reek/large_class_spec.rb
reek-0.3.0 spec/reek/large_class_spec.rb
reek-0.1.0 spec/reek/large_class_spec.rb