Sha256: 34f6b2cc3a85b8338e7e8e7ae7144de7c3b739cfc24f6f3ba77268d80871acc3
Contents?: true
Size: 978 Bytes
Versions: 3
Compression:
Stored size: 978 Bytes
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(0)) end def verify_content_complexity(content, complexity) @roodi.check_content(content) errors = @roodi.errors errors.should_not be_empty errors[0].should eql("dummy-file.rb:2 - Block cyclomatic complexity is #{complexity}. It should be 0 or less.") end 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
Version data entries
3 entries across 3 versions & 1 rubygems