Sha256: 794daeb37c848e3893dd1c0724c5cb76ead618e49e95ce0fecaf974a6521e3b2

Contents?: true

Size: 1.35 KB

Versions: 3

Compression:

Stored size: 1.35 KB

Contents

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

require 'reek/adapters/report'
require 'reek/smells/duplication'
require 'reek/smells/large_class'
require 'reek/smells/long_method'

include Reek
include Reek::Smells

describe SmellDetector, 'configuration' do
  before:each do
    @detector = LongMethod.new
  end

  it 'adopts new max_statements value' do
    @detector.configure_with('max_statements' => 25)
    @detector.max_statements.should == 25
  end
end

describe SmellDetector, 'when copied' do
  before :each do
    @detector = LongMethod.new
    @copy = @detector.copy
  end

  it 'should have the same state' do
    @copy.max_statements.should == @detector.max_statements
  end

  it 'should change independently of its parent' do
    default_max = @detector.max_statements
    @copy.configure_with('max_statements' => 25)
    @detector.max_statements.should == default_max
  end
end

describe SmellDetector, 'configuration' do
#  it 'stays enabled when not disabled' do
#    @detector = LargeClass.new
#    @detector.should be_enabled
#    @detector.configure({'LargeClass' => {'max_methods' => 50}})
#    @detector.should be_enabled
#  end

  it 'becomes disabled when disabled' do
    @detector = LargeClass.new
    @detector.should be_enabled
    @detector.configure({'LargeClass' => {'enabled' => false}})
    @detector.should_not be_enabled
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kevinrutherford-reek-1.1.3.11 spec/reek/smells/smell_detector_spec.rb
kevinrutherford-reek-1.1.3.12 spec/reek/smells/smell_detector_spec.rb
kevinrutherford-reek-1.1.3.13 spec/reek/smells/smell_detector_spec.rb