Sha256: 386c75a970889bfd73541be0108e5024c6520dbaef677ccafd1ba4ccbcb454b5
Contents?: true
Size: 1.21 KB
Versions: 3
Compression:
Stored size: 1.21 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Roodi::Checks::ModuleLineCountCheck do before(:each) do @roodi = Roodi::Core::ParseTreeRunner.new(Roodi::Checks::ModuleLineCountCheck.new({'line_count' => 1})) end describe '#evaluate' do it 'should accept modules with less lines than the threshold' do content = <<-END module ZeroLineModule end END @roodi.check_content(content) @roodi.errors.should be_empty end it 'should accept modules with the same number of lines as the threshold' do content = <<-END module OneLineModule @foo = 1 end END @roodi.check_content(content) @roodi.errors.should be_empty end it 'should reject modules with more lines than the threshold' do content = <<-END module TwoLineModule @foo = 1 @bar = 2 end END @roodi.check_content(content) errors = @roodi.errors errors.should_not be_empty errors[0].info.should == { :module => :TwoLineModule, :count => 2 } errors[0].filename.should == 'dummy-file.rb' errors[0].line_number.should == 1 end end end
Version data entries
3 entries across 3 versions & 1 rubygems