Sha256: 803a59e917fb27e29676a950d3aef9eb241338967160f2cbf4df8286884c18c0

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

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

require 'reek/method_checker'
require 'reek/smells'
require 'reek/report'

include Reek

describe Report, " when empty" do
  before(:each) do
    @rpt = Report.new
  end

  it 'should have zero length' do
    @rpt.length.should == 0
  end

  it 'should claim to be empty' do
    @rpt.should be_empty
  end
end

describe Report, "to_s" do
  before(:each) do
    rpt = Report.new
    chk = MethodChecker.new(rpt, 'Thing')
    chk.check_source('def simple(arga) arga[3] end')
    @report = rpt.to_s.split("\n")
  end

  it 'should place each detailed report on a separate line' do
    @report.length.should == 2
  end

  it 'should mention every smell name' do
    @report[0].should match(/[Utility Function]/)
    @report[1].should match(/[Feature Envy]/)
  end
end

describe Report, " as a SortedSet" do
  it 'should only add a smell once' do
    rpt = Report.new
    rpt << UtilityFunction.new(self)
    rpt.length.should == 1
    rpt << UtilityFunction.new(self)
    rpt.length.should == 1
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reek-0.1.1 spec/reek/report_spec.rb