Sha256: 55add5eda8a5d298a17ac7185df9cf3de57b918130cd72833e677a9f1f173cd9

Contents?: true

Size: 1022 Bytes

Versions: 6

Compression:

Stored size: 1022 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe Roodi::Checks::ClassNameCheck do
  before(:each) do
    @roodi = Roodi::Core::Runner.new(Roodi::Checks::ClassNameCheck.new)
  end
  
  it "should accept camel case class names starting in capitals" do
    content = <<-END
    class GoodClassName 
    end
    END
    @roodi.check_content(content)
    @roodi.errors.should be_empty
  end

  it "should be able to parse scoped class names" do
    content = <<-END
    class MyScope::GoodClassName 
      def method
      end
    end
    END
    # @roodi.print_content(content)
    @roodi.check_content(content)
    @roodi.errors.should be_empty
  end

  it "should reject class names with underscores" do
    content = <<-END
    class Bad_ClassName 
    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 name \"Bad_ClassName\" should match pattern /^[A-Z][a-zA-Z0-9]*$/")
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

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