Sha256: e8654f7caa887383e141c1ee7523389dfda5af7871a78a3e4bad5a3eff878ee5
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Roodi::Checks::CyclomaticComplexityBlockCheck do before(:each) do @roodi = Roodi::Core::ParseTreeRunner.new(Roodi::Checks::CyclomaticComplexityBlockCheck.new({'complexity' => 0})) end describe '#evaluate' do it 'should find a simple block' do content = <<-END def method_name it 'should be a simple block' do call_foo end end END verify_content_complexity(content, 1) end it 'should find a block with multiple paths' do content = <<-END def method_name it 'should be a complex block' do call_foo if some_condition end end END verify_content_complexity(content, 2) end end def verify_content_complexity(content, complexity) @roodi.check_content(content) errors = @roodi.errors errors.should_not be_empty errors[0].info.should == { :score => complexity } errors[0].filename.should == 'dummy-file.rb' errors[0].line_number.should == 2 end end
Version data entries
3 entries across 3 versions & 1 rubygems