Sha256: 8856b1fcce96ee5ee02f80be93dfd7c2b5463b907b8ee7e770fa5b9c7d7fb803
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe Simplabs::Excellent::Checks::CyclomaticComplexityBlockCheck do before(:each) do @excellent = Simplabs::Excellent::Runner.new(Simplabs::Excellent::Checks::CyclomaticComplexityBlockCheck.new({ :threshold => 0 })) end describe '#evaluate' do it 'should find a simple block' do content = <<-END it 'should be a simple block' do call_foo end END verify_content_complexity(content, 1) end it 'should find a block with multiple paths' do content = <<-END it 'should be a complex block' do if some_condition call_foo else call_bar end end END verify_content_complexity(content, 2) end end def verify_content_complexity(content, score) @excellent.check_content(content) warnings = @excellent.warnings warnings.should_not be_empty warnings[0].info.should == { :block => 'block', :score => score } warnings[0].line_number.should == 1 warnings[0].message.should == "block has cyclomatic complexity of #{score}." end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
simplabs-excellent-1.2.1 | spec/checks/cyclomatic_complexity_block_check_spec.rb |