Sha256: f461646152613b05a6e20ffef1a08c79ae0229b31b46b2c1bdbaeee1d5423e75
Contents?: true
Size: 1.24 KB
Versions: 15
Compression:
Stored size: 1.24 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe Simplabs::Excellent::Checks::ModuleLineCountCheck do before do @excellent = Simplabs::Excellent::Runner.new(Simplabs::Excellent::Checks::ModuleLineCountCheck.new({ :threshold => 2 })) end describe '#evaluate' do it 'should accept modules with less lines than the threshold' do code = <<-END module OneLineModule; end END @excellent.check_code(code) @excellent.warnings.should be_empty end it 'should accept modules with the same number of lines as the threshold' do code = <<-END module TwoLinesModule end END @excellent.check_code(code) @excellent.warnings.should be_empty end it 'should reject modules with more lines than the threshold' do code = <<-END module FourLinesModule @foo = 1 @bar = 2 end END @excellent.check_code(code) warnings = @excellent.warnings warnings.should_not be_empty warnings[0].info.should == { :module => 'FourLinesModule', :count => 4 } warnings[0].line_number.should == 1 warnings[0].message.should == 'FourLinesModule has 4 lines.' end end end
Version data entries
15 entries across 15 versions & 2 rubygems