Sha256: 0afe28e12c4461f073c433766800f7508d715a9879452a0bef90bbce5d7b6603

Contents?: true

Size: 1.54 KB

Versions: 124

Compression:

Stored size: 1.54 KB

Contents

require "rubygems"                                                                                               
require "yard"                                                                                                   
require File.join(File.expand_path(File.dirname(__FILE__)), "testing")

describe "documentation tests" do
  before do
    # Use YARD to parse all ruby files found in '../lib'
    libdir = File.join(File.dirname(__FILE__), "..", "lib")
    YARD::Registry.load(Dir.glob(File.join(libdir, "**", "*.rb")))
    @registry = YARD::Registry.all
  end

  test "All classes, methods, modules, and constants must be documented" do
    # YARD's parser works best in ruby 1.9.x, so skip 1.8.x
    skip if RUBY_VERSION < "1.9.2"
    # Note, the 'find the undocumented things' code here is 
    # copied mostly from: YARD 0.7.5's lib/yard/cli/stats.rb
    #
    # Find all undocumented classes, modules, and constants
    undocumented = @registry.select do |o| 
      [:class, :module, :constant].include?(o.type) && o.docstring.blank?
    end

    # Find all undocumented methods
    methods = @registry.select { |m| m.type == :method }
    methods.reject! { |m| m.is_alias? || !m.is_explicit? }
    undocumented += methods.select do |m| 
      m.docstring.blank? && !m.overridden_method
    end

    if (undocumented.length > 0)
      message = ["The following are not documented"]
      undocumented.each do |o|
        message << "* #{o.type.to_s} #{o.to_s} <#{o.file}:#{o.line}>"
      end

      flunk(message.join("\n"))
    else
      pass
    end
  end
end

Version data entries

124 entries across 120 versions & 21 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/insist-1.0.0/test/docs.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/insist-1.0.0/test/docs.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/insist-1.0.0/test/docs.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/insist-1.0.0/test/docs.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/insist-1.0.0/test/docs.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/insist-1.0.0/test/docs.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/insist-1.0.0/test/docs.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/insist-1.0.0/test/docs.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/insist-1.0.0/test/docs.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/insist-1.0.0/test/docs.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/insist-1.0.0/test/docs.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/insist-1.0.0/test/docs.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/insist-1.0.0/test/docs.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/insist-1.0.0/test/docs.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/insist-1.0.0/test/docs.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/insist-1.0.0/test/docs.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/insist-1.0.0/test/docs.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/insist-1.0.0/test/docs.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/insist-1.0.0/test/docs.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/insist-1.0.0/test/docs.rb