Sha256: 360ab52bbadf6b9666be909a39692d9ef7806e66b707d0c7914904783adac0da
Contents?: true
Size: 1.97 KB
Versions: 5
Compression:
Stored size: 1.97 KB
Contents
require 'spec_helper' require 'reek/core/smell_configuration' include Reek::Core describe SmellConfiguration do it 'returns the default value when key not found' do cf = SmellConfiguration.new({}) cf.value('fred', nil, 27).should == 27 end context 'when overriding default configs' do before(:each) do @base_config = {"enabled"=>true, "exclude"=>[], "reject"=>[/^.$/, /[0-9]$/, /[A-Z]/], "accept"=>["_"]} @smell_config = SmellConfiguration.new(@base_config) end it { @smell_config.merge!({}).should == @base_config } it { @smell_config.merge!({"enabled"=>true}).should == @base_config } it { @smell_config.merge!({"exclude"=>[]}).should == @base_config } it { @smell_config.merge!({"accept"=>["_"]}).should == @base_config } it { @smell_config.merge!({"reject"=>[/^.$/, /[0-9]$/, /[A-Z]/]}).should == @base_config } it { @smell_config.merge!({"enabled"=>true, "accept"=>["_"]}).should == @base_config } it 'should override single values' do @smell_config.merge!({"enabled"=>false}).should == {"enabled"=>false, "exclude"=>[], "reject"=>[/^.$/, /[0-9]$/, /[A-Z]/], "accept"=>["_"]} end it 'should override arrays of values' do @smell_config.merge!({"reject"=>[/^.$/, /[3-9]$/]}).should == {"enabled"=>true, "exclude"=>[], "reject"=>[/^.$/, /[3-9]$/], "accept"=>["_"]} end it 'should override multiple values' do @smell_config.merge!({"enabled"=>false, "accept"=>[/[A-Z]$/]}).should == {"enabled"=>false, "exclude"=>[], "reject"=>[/^.$/, /[0-9]$/, /[A-Z]/], "accept"=>[/[A-Z]$/]} end end end
Version data entries
5 entries across 5 versions & 1 rubygems