Sha256: 56a73ee530ce6efa54735ac2b9ea2f58e8f333ca27504061d19d16e89a606256
Contents?: true
Size: 1.49 KB
Versions: 1
Compression:
Stored size: 1.49 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe Simplabs::Excellent::Checks::ClassLineCountCheck do before do @excellent = Simplabs::Excellent::Runner.new(Simplabs::Excellent::Checks::ClassLineCountCheck.new({ :threshold => 3 })) end describe '#evaluate' do it 'should accept classes with less lines than the threshold' do content = <<-END class OneLineClass; end END @excellent.check_content(content) @excellent.warnings.should be_empty end it 'should accept classes with the same number of lines as the threshold' do content = <<-END class ThreeLineClass @foo = 1 end END @excellent.check_content(content) @excellent.warnings.should be_empty end it 'should not count blank lines' do content = <<-END class ThreeLineClass @foo = 1 end END @excellent.check_content(content) @excellent.warnings.should be_empty end it 'should reject classes with more lines than the threshold' do content = <<-END class FourLineClass @foo = 1 @bar = 2 end END @excellent.check_content(content) warnings = @excellent.warnings warnings.should_not be_empty warnings[0].info.should == { :class => 'FourLineClass', :count => 4 } warnings[0].line_number.should == 1 warnings[0].message.should == 'FourLineClass has 4 lines.' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
simplabs-excellent-1.2.1 | spec/checks/class_line_count_check_spec.rb |