Sha256: 673108cf1a96e21217b880595a6c43c73912b3d5351729c8c4bef5a029caeba1

Contents?: true

Size: 1.45 KB

Versions: 8

Compression:

Stored size: 1.45 KB

Contents

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

require 'reek/configuration'
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(LongMethod::MAX_ALLOWED_STATEMENTS_KEY => 25)
    @detector.value(LongMethod::MAX_ALLOWED_STATEMENTS_KEY, nil, 0).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(LongMethod::MAX_ALLOWED_STATEMENTS_KEY => 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' => {SmellConfiguration::ENABLED_KEY => false}})
    @detector.should_not be_enabled
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
kevinrutherford-reek-1.1.3.14 spec/reek/smells/smell_detector_spec.rb
kevinrutherford-reek-1.1.3.15 spec/reek/smells/smell_detector_spec.rb
kevinrutherford-reek-1.1.3.16 spec/reek/smells/smell_detector_spec.rb
kevinrutherford-reek-1.2.0 spec/reek/smells/smell_detector_spec.rb
reek-1.2.3 spec/reek/smells/smell_detector_spec.rb
reek-1.2.2 spec/reek/smells/smell_detector_spec.rb
reek-1.2.1 spec/reek/smells/smell_detector_spec.rb
reek-1.2.0 spec/reek/smells/smell_detector_spec.rb