Sha256: 1439a25ce31c5a891988c70cfcf704da6b00648ff26b9b72f856640522f04980

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::ModuleLineCountCheck do
  before(:each) do
    @roodi = Roodi::Core::Runner.new(Roodi::Checks::ModuleLineCountCheck.new({'line_count' => 1}))
  end
  
  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].to_s.should eql("dummy-file.rb:1 - Module \"TwoLineModule\" has 2 lines.  It should have 1 or less.")
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
threedaymonk-roodi-1.3.8 spec/roodi/checks/module_line_count_check_spec.rb
roodi1.9-2.0.1 spec/roodi/checks/module_line_count_check_spec.rb
roodi-2.1.0 spec/roodi/checks/module_line_count_check_spec.rb
roodi-2.0.1 spec/roodi/checks/module_line_count_check_spec.rb
roodi-2.0.0 spec/roodi/checks/module_line_count_check_spec.rb
roodi-1.4.0 spec/roodi/checks/module_line_count_check_spec.rb