Sha256: 6e44aebc9246c0997afc2c7c500f3a2b82b4af263f0240f3400fe62168a5a991
Contents?: true
Size: 1.04 KB
Versions: 6
Compression:
Stored size: 1.04 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Roodi::Checks::ClassLineCountCheck do before(:each) do @roodi = Roodi::Core::ParseTreeRunner.new(Roodi::Checks::ClassLineCountCheck.new({'line_count' => 1})) end it "should accept classes with less lines than the threshold" do content = <<-END class ZeroLineClass end END @roodi.check_content(content) @roodi.errors.should be_empty end it "should accept classes with the same number of lines as the threshold" do content = <<-END Class OneLineClass @foo = 1 end END @roodi.check_content(content) @roodi.errors.should be_empty end it "should reject classes with more lines than the threshold" do content = <<-END class TwoLineClass @foo = 1 @bar = 2 end END @roodi.check_content(content) errors = @roodi.errors errors.should_not be_empty errors[0].to_s.should eql("dummy-file.rb:1 - Class \"TwoLineClass\" has 2 lines. It should have 1 or less.") end end
Version data entries
6 entries across 6 versions & 1 rubygems