repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/dsl_handler_spec.rb | spec/handlers/dsl_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}DSLHandler" do
before(:all) { parse_file :dsl_handler_001, __FILE__ }
it "creates a readable attribute when @!attribute r is found" do
obj = Registry.at('Foo#at... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/base_spec.rb | spec/handlers/base_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
include Parser
RSpec.describe YARD::Handlers::Base do
describe "#handles and inheritance" do
before do
allow(Handlers::Base).to receive(:inherited)
end
it "keeps track of subclasses" do
expect(Handlers::Base).to r... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/method_handler_spec.rb | spec/handlers/method_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}MethodHandler" do
before(:all) do
log.enter_level(Logger::ERROR) do
parse_file :method_handler_001, __FILE__
end
end
it "adds methods to parent's #m... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/extend_handler_spec.rb | spec/handlers/extend_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}ExtendHandler" do
before(:all) { parse_file :extend_handler_001, __FILE__ }
it "includes modules at class scope" do
expect(Registry.at(:B).class_mixins).to eq [... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/visibility_handler_spec.rb | spec/handlers/visibility_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}VisibilityHandler" do
before(:all) { parse_file :visibility_handler_001, __FILE__ }
it "is able to set visibility to public" do
expect(Registry.at("Testing#pub"... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/spec_helper.rb | spec/handlers/spec_helper.rb | # frozen_string_literal: true
require 'stringio'
include Handlers
def undoc_error(code)
expect { StubbedSourceParser.parse_string(code) }.to raise_error(Parser::UndocumentableError)
end
def with_parser(parser_type)
tmp = StubbedSourceParser.parser_type
StubbedSourceParser.parser_type = parser_type
yield
St... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/private_class_method_handler_spec.rb | spec/handlers/private_class_method_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
require File.dirname(__FILE__) + '/class_method_handler_shared_examples'
RSpec.describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}PrivateClassMethodHandler" do
before { Registry.clear }
let(:visibility) { :private }
in... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/c/path_handler_spec.rb | spec/handlers/c/path_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + "/spec_helper"
RSpec.describe YARD::Handlers::C::PathHandler do
it "tracks variable names defined under namespaces" do
parse_init <<-eof
mFoo = rb_define_module("Foo");
cBar = rb_define_class_under(mFoo, "Bar", rb_cObject);
rb_defin... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/c/mixin_handler_spec.rb | spec/handlers/c/mixin_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + "/spec_helper"
RSpec.describe YARD::Handlers::C::MixinHandler do
it "adds includes to modules or classes" do
parse_init <<-eof
mFoo = rb_define_module("Foo");
cBar = rb_define_class("Bar", rb_cObject);
mBaz = rb_define_module("Baz")... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/c/module_handler_spec.rb | spec/handlers/c/module_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + "/spec_helper"
RSpec.describe YARD::Handlers::C::ClassHandler do
it "registers modules" do
parse_init 'mFoo = rb_define_module("Foo");'
expect(Registry.at('Foo').type).to eq :module
end
it "registers classes under namespaces" do
parse_in... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/c/attribute_handler_spec.rb | spec/handlers/c/attribute_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + "/spec_helper"
RSpec.describe YARD::Handlers::C::AttributeHandler do
def run(read, write, commented = nil)
parse <<-eof
/* FOO */
VALUE foo(VALUE x) { int value = x; }
void Init_Foo() {
rb_cFoo = rb_define_class("Foo", rb_cO... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/c/constant_handler_spec.rb | spec/handlers/c/constant_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + "/spec_helper"
RSpec.describe YARD::Handlers::C::ConstantHandler do
it "registers constants" do
parse_init <<-eof
mFoo = rb_define_module("Foo");
rb_define_const(mFoo, "FOO", ID2SYM(100));
rb_define_global_const("BAR", ID2SYM(100));... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/c/struct_handler_spec.rb | spec/handlers/c/struct_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::Handlers::C::StructHandler do
after { Registry.clear }
it "handles Struct class definitions" do
parse_init <<-eof
rb_cRange = rb_struct_define_without_accessor(
"Range", rb_cFoo, range_alloc,
... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/c/class_handler_spec.rb | spec/handlers/c/class_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + "/spec_helper"
RSpec.describe YARD::Handlers::C::ClassHandler do
it "registers classes" do
parse_init 'cFoo = rb_define_class("Foo", rb_cObject);'
expect(Registry.at('Foo').type).to eq :class
end
it "registers classes under namespaces" do
... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/c/alias_handler_spec.rb | spec/handlers/c/alias_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + "/spec_helper"
RSpec.describe YARD::Handlers::C::AliasHandler do
it "allows defining of aliases (rb_define_alias)" do
parse <<-eof
/* FOO */
VALUE foo(VALUE x) { int value = x; }
void Init_Foo() {
rb_cFoo = rb_define_class("... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/c/init_handler_spec.rb | spec/handlers/c/init_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + "/spec_helper"
RSpec.describe YARD::Handlers::C::InitHandler do
it "adds documentation in Init_ClassName() to ClassName" do
parse(<<-eof)
// Bar!
void Init_A() {
rb_cA = rb_define_class("A", rb_cObject);
}
eof
expect... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/c/override_comment_handler_spec.rb | spec/handlers/c/override_comment_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + "/spec_helper"
RSpec.describe YARD::Handlers::C::OverrideCommentHandler do
[:class, :module].each do |type|
it "handles Document-#{type}" do
parse(<<-eof)
void something;
/* Document-#{type}: A
* Foo bar baz
*/... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/c/method_handler_spec.rb | spec/handlers/c/method_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + "/spec_helper"
RSpec.describe YARD::Handlers::C::MethodHandler do
it "registers methods" do
parse_init <<-eof
mFoo = rb_define_module("Foo");
rb_define_method(mFoo, "bar", bar, 0);
eof
expect(Registry.at('Foo#bar')).not_to be nil
... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/c/spec_helper.rb | spec/handlers/c/spec_helper.rb | # frozen_string_literal: true
def parse(src, file = '(stdin)')
YARD::Registry.clear
parser = YARD::Parser::SourceParser.new(:c)
parser.file = file
parser.parse(StringIO.new(src))
end
def parse_init(src)
YARD::Registry.clear
YARD.parse_string("void Init_Foo() {\n#{src}\n}", :c)
end
def parse_multi_file_in... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/ruby/base_spec.rb | spec/handlers/ruby/base_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Handlers::Ruby::Base, '#valid_handler?' do
include YARD::Parser::Ruby
YARD::Parser::Ruby::AstNode # rubocop:disable Lint/Void
before do
allow(Handlers::Ruby::Base).to receive(:inherited)
@processor = Handlers::Processor.new(OpenStruct.new(:parser_type =... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/ruby/legacy/base_spec.rb | spec/handlers/ruby/legacy/base_spec.rb | # frozen_string_literal: true
include Parser::Ruby::Legacy
RSpec.describe YARD::Handlers::Ruby::Legacy::Base, "#handles and inheritance" do
before do
allow(Handlers::Ruby::Legacy::Base).to receive(:inherited)
if RUBY_VERSION > '1.8.7'
allow(Handlers::Ruby::Legacy::MixinHandler).to receive(:inherited) ... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/class_spec.rb | spec/templates/class_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::Templates::Engine.template(:default, :docstring) do
before do
Registry.clear
YARD.parse_string <<-'eof'
private
# Comments
# @abstract override this class
# @author Test
# @version... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/module_spec.rb | spec/templates/module_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::Templates::Engine.template(:default, :module) do
before do
Registry.clear
YARD.parse_string <<-'eof'
module B
def c; end
def d; end
private
def e; end
end
modu... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/onefile_spec.rb | spec/templates/onefile_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
class StringSerializer < YARD::Serializers::Base
attr_accessor :files, :string
def initialize(files, string)
@files = files
@string = string
end
def serialize(object, data)
files << object
string << data
end
end
R... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/tag_spec.rb | spec/templates/tag_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::Templates::Engine.template(:default, :tags) do
before { Registry.clear }
describe "all known tags" do
before do
YARD.parse_string <<-'eof'
# Comments
# @abstract override me
# @para... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/constant_spec.rb | spec/templates/constant_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + "/spec_helper"
RSpec.describe YARD::Templates::Engine.template(:default, :constant) do
describe "fully dressed constant" do
it "renders text format correctly" do
YARD.parse_string <<-'eof'
class YARD::CLI::YRI
# Default search... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/method_spec.rb | spec/templates/method_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
# $COPY = :method001
# $COPYT = :html
RSpec.describe YARD::Templates::Engine.template(:default, :method) do
before { Registry.clear }
shared_examples_for "all formats" do
it "renders html format correctly" do
html_equals(Regi... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/template_spec.rb | spec/templates/template_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::Templates::Template do
def template(path)
YARD::Templates::Engine.template!(path, '/full/path/' + path.to_s)
end
before :each do
YARD::Templates::ErbCache.clear!
end
describe ".include_parent" do
... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/section_spec.rb | spec/templates/section_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::Templates::Section do
include YARD::Templates
describe "#initialize" do
it "converts first argument to splat if it is array" do
s = Section.new(:name, [:foo, :bar])
expect(s.name).to eq :name
e... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/engine_spec.rb | spec/templates/engine_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::Templates::Engine do
before { @paths = Engine.template_paths }
after { Engine.template_paths = @paths }
describe ".register_template_path" do
it "registers a String path" do
Engine.register_template_path... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/spec_helper.rb | spec/templates/spec_helper.rb | # frozen_string_literal: true
include YARD::Templates
def only_copy?(result, example, type)
return false unless defined?($COPY)
if $COPY == :all || $COPY == example
puts(result) unless $COPYT && $COPYT != type
end
$COPY ? true : false
end
def text_equals(result, expected_example)
return if only_copy?(... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/helpers/html_syntax_highlight_helper_spec.rb | spec/templates/helpers/html_syntax_highlight_helper_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Templates::Helpers::HtmlSyntaxHighlightHelper do
include YARD::Templates::Helpers::HtmlHelper
include YARD::Templates::Helpers::HtmlSyntaxHighlightHelper
describe "#html_syntax_highlight" do
let(:object) { CodeObjects::NamespaceObject.new(:root, :YARD) }
... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/helpers/shared_signature_examples.rb | spec/templates/helpers/shared_signature_examples.rb | # frozen_string_literal: true
RSpec.shared_examples_for "signature" do
before do
YARD::Registry.clear
@options = Templates::TemplateOptions.new
@options.reset_defaults
allow(self).to receive(:options).and_return(@options)
end
def trim(sig) sig.gsub(/\s+/, ' ') end
it "shows signature for regul... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/helpers/module_helper_spec.rb | spec/templates/helpers/module_helper_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Templates::Helpers::ModuleHelper do
include YARD::Templates::Helpers::BaseHelper
include YARD::Templates::Helpers::ModuleHelper
describe "#prune_method_listing" do
before { YARD::Registry.clear }
let(:options) { OpenStruct.new }
let(:object) { YARD:... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/helpers/base_helper_spec.rb | spec/templates/helpers/base_helper_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Templates::Helpers::BaseHelper do
include YARD::Templates::Helpers::BaseHelper
describe "#run_verifier" do
it "runs verifier proc against list if provided" do
mock = Verifier.new
expect(mock).to receive(:call).with(1)
expect(mock).to receive... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/helpers/text_helper_spec.rb | spec/templates/helpers/text_helper_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + "/shared_signature_examples"
RSpec.describe YARD::Templates::Helpers::TextHelper do
include YARD::Templates::Helpers::BaseHelper
include YARD::Templates::Helpers::TextHelper
include YARD::Templates::Helpers::MethodHelper
describe "#signature" do
... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/helpers/method_helper_spec.rb | spec/templates/helpers/method_helper_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Templates::Helpers::MethodHelper do
include YARD::Templates::Helpers::BaseHelper
include YARD::Templates::Helpers::MethodHelper
describe "#format_args" do
it "displays keyword arguments" do
params = [['a:', '1'], ['b:', '2'], ['**kwargs', nil]]
... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/helpers/markup_helper_spec.rb | spec/templates/helpers/markup_helper_spec.rb | # frozen_string_literal: true
module YARD::Templates::Helpers::MarkupHelper
public :load_markup_provider, :markup_class, :markup_provider
end
class GeneratorMock
attr_accessor :options
include YARD::Templates::Helpers::MarkupHelper
def initialize(options = Templates::TemplateOptions.new)
self.options = op... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/helpers/html_helper_spec.rb | spec/templates/helpers/html_helper_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + "/shared_signature_examples"
RSpec.describe YARD::Templates::Helpers::HtmlHelper do
include YARD::Templates::Helpers::BaseHelper
include YARD::Templates::Helpers::HtmlHelper
include YARD::Templates::Helpers::MethodHelper
def options
Templates:... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/helpers/markup/rdoc_markup_spec.rb | spec/templates/helpers/markup/rdoc_markup_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Templates::Helpers::Markup::RDocMarkup do
describe "loading mechanism" do
before { @good_libs = [] }
def require(lib)
return true if @good_libs.include?(lib)
raise LoadError
end
def load_markup
require 'rdoc/markup'
require ... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/markup_processor_integrations/asciidoctor_spec.rb | spec/templates/markup_processor_integrations/asciidoctor_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/integration_spec_helper'
RSpec.describe 'Asciidoctor integration' do
include_context 'shared helpers for markup processor integration specs'
let(:markup) { :asciidoc }
let(:markup_provider) { :asciidoctor }
let(:document) do
<<-ASCIIDOC
== ... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/markup_processor_integrations/integration_spec_helper.rb | spec/templates/markup_processor_integrations/integration_spec_helper.rb | # frozen_string_literal: true
RSpec.shared_context 'shared helpers for markup processor integration specs' do
after do
YARD::Templates::Helpers::MarkupHelper.clear_markup_cache
end
let(:rendered_document) { html_renderer.htmlify document }
let(:template_options) do
Templates::TemplateOptions.new.tap ... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/markup_processor_integrations/rdoc_markdown_spec.rb | spec/templates/markup_processor_integrations/rdoc_markdown_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/integration_spec_helper'
RSpec.describe 'Markdown via RDoc integration' do
include_context 'shared helpers for markup processor integration specs'
let(:markup) { :markdown }
let(:markup_provider) { :rdoc }
let(:document) do
<<-MARKDOWN
## E... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/markup_processor_integrations/rdoc_spec.rb | spec/templates/markup_processor_integrations/rdoc_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/integration_spec_helper'
RSpec.describe 'RDoc integration' do
include_context 'shared helpers for markup processor integration specs'
let(:markup) { :rdoc }
# Must be nil as this is how this provider is defined.
# See: https://github.com/lsegal/... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/markup_processor_integrations/redcloth_spec.rb | spec/templates/markup_processor_integrations/redcloth_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/integration_spec_helper'
# Hack to fix RedCloth compat issues with MinGW compilation hosts
begin
require 'redcloth'
rescue LoadError
require 'rbconfig'
RbConfig::CONFIG['arch'] = 'not_windows_dont_worry'
end
RSpec.describe 'RedCloth integration' ... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/templates/markup_processor_integrations/markdown_spec.rb | spec/templates/markup_processor_integrations/markdown_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/integration_spec_helper'
RSpec.describe 'Markdown processors integration' do
include_context 'shared helpers for markup processor integration specs'
shared_examples 'shared examples for markdown processors' do
let(:document) do
<<-MARKDOWN
... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/rake/yardoc_task_spec.rb | spec/rake/yardoc_task_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Rake::YardocTask do
before do
@yardoc = YARD::CLI::Yardoc.new
@yardoc.statistics = false
@yardoc.use_document_file = false
@yardoc.use_yardopts_file = false
@yardoc.generate = false
allow(Templates::Engine).to receive(:render)
allow(Templ... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/rubygems/doc_manager_spec.rb | spec/rubygems/doc_manager_spec.rb | # frozen_string_literal: true
require File.join(YARD::ROOT, 'rubygems_plugin')
require 'fileutils'
RSpec.describe Gem::DocManager do
before do
# Ensure filesystem integrity
allow(FileUtils).to receive(:mkdir_p)
allow(FileUtils).to receive(:rm_rf)
allow(Dir).to receive(:chdir)
allow(YARD::CLI::Ya... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/server/static_caching_spec.rb | spec/server/static_caching_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::Server::StaticCaching do
include StaticCaching
describe "#check_static_cache" do
def adapter; @adapter ||= mock_adapter end
def request; @request ||= MockRequest.new end
it "returns nil if document root... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/server/webrick_servlet_spec.rb | spec/server/webrick_servlet_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::Server::WebrickServlet do
describe "#do_GET" do
it "performs a GET" do
resp = OpenStruct.new
class << resp
def []=(name, value) (self.headers ||= {})[name] = value end
end
server = d... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/server/doc_server_helper_spec.rb | spec/server/doc_server_helper_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + "/spec_helper"
class MyDocServerSerializerRouter
attr_accessor :request
def docs_prefix; 'PREFIX' end
def initialize; @request = mock_request end
end
class MockDocServerHelper
include YARD::Templates::Helpers::BaseHelper
include YARD::Templates:... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/server/router_spec.rb | spec/server/router_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
class MyRouterSpecRouter < Router
def docs_prefix; 'mydocs/foo' end
def list_prefix; 'mylist/foo' end
def search_prefix; 'mysearch/foo' end
def check_static_cache; nil end
end
RSpec.describe YARD::Server::Router do
before do
... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/server/rack_adapter_spec.rb | spec/server/rack_adapter_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + "/spec_helper"
RSpec.describe "YARD::Server::RackMiddleware" do
before do
begin; require 'rack'; rescue LoadError; pending "rack required for these tests" end
@superapp = double(:superapp)
@app = YARD::Server::RackMiddleware.new(@superapp, :l... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/server/doc_server_serializer_spec.rb | spec/server/doc_server_serializer_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::Server::DocServerSerializer do
describe "#serialized_path" do
before do
Registry.clear
@serializer = Server::DocServerSerializer.new
end
after(:all) { Server::Adapter.shutdown }
it "return... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/server/adapter_spec.rb | spec/server/adapter_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::Server::Adapter do
after(:all) { Server::Adapter.shutdown }
describe "#add_library" do
it "adds a library" do
lib = LibraryVersion.new('yard')
a = Adapter.new({})
expect(a.libraries).to be_empt... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/server/spec_helper.rb | spec/server/spec_helper.rb | # frozen_string_literal: true
include Server
include Commands
def mock_adapter(opts = {})
opts[:libraries] ||= {'project' => [LibraryVersion.new('project', '1.0.0'), LibraryVersion.new('project', '1.0.1')]}
opts[:document_root] ||= '/public'
opts[:options] ||= {:single_library => false, :caching => false}
opt... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/server/commands/library_command_spec.rb | spec/server/commands/library_command_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Server::Commands::LibraryCommand do
before do
allow(Templates::Engine).to receive(:render)
allow(Templates::Engine).to receive(:generate)
allow(YARD).to receive(:parse)
allow(Registry).to receive(:load)
allow(Registry).to receive(:save)
@cmd... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/server/commands/base_spec.rb | spec/server/commands/base_spec.rb | # frozen_string_literal: true
class MyProcCommand < Base
def initialize(&block)
self.class.send(:undef_method, :run)
self.class.send(:define_method, :run, &block)
end
end
class MyCacheCommand < Base
def run; cache 'foo' end
end
RSpec.describe YARD::Server::Commands::Base do
describe "#cache" do
b... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/cli/stats_spec.rb | spec/cli/stats_spec.rb | # frozen_string_literal: true
require 'stringio'
RSpec.describe YARD::CLI::Stats do
before do
Registry.clear
YARD.parse_string <<-eof
class A
CONST = 1
def foo; end
attr_reader :fooattr
# Documented
def bar; end
end
module B; end
eof
@main... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/cli/yri_spec.rb | spec/cli/yri_spec.rb | # frozen_string_literal: true
class TestYRI < YARD::CLI::YRI
public :optparse, :find_object, :cache_object
def test_stub; end
def print_object(*args) test_stub; super end
end
RSpec.describe YARD::CLI::YRI do
before do
@yri = TestYRI.new
allow(Registry).to receive(:load)
end
describe "#find_object... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/cli/yardoc_spec.rb | spec/cli/yardoc_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::CLI::Yardoc do
before do
@yardoc = YARD::CLI::Yardoc.new
@yardoc.statistics = false
@yardoc.use_document_file = false
@yardoc.use_yardopts_file = false
@yardoc.generate = false
allow(Templates::Engine).to receive(:render)
allow(Templates:... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | true |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/cli/graph_spec.rb | spec/cli/graph_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::CLI::Graph do
it "serializes output" do
allow(Registry).to receive(:load).at_least(1).times
allow(subject).to receive(:yardopts) { [] }
expect(subject.options.serializer).to receive(:serialize).once
subject.run
end
it "reads yardoc file from .ya... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/cli/gems_spec.rb | spec/cli/gems_spec.rb | # frozen_string_literal: true
require 'rubygems'
RSpec.describe YARD::CLI::Gems do
before do
@rebuild = false
@gem1 = build_mock('gem1')
@gem2 = build_mock('gem2')
@gem3 = build_mock('gem3')
end
def build_mock(name, version = '1.0')
OpenStruct.new :name => name,
:version... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/cli/command_spec.rb | spec/cli/command_spec.rb | # frozen_string_literal: true
require 'optparse'
RSpec.describe YARD::CLI::Command do
describe "#parse_options" do
before do
@options = OptionParser.new
@saw_foo = false
@options.on('--foo') { @saw_foo = true }
end
def parse(*args)
CLI::Command.new.send(:parse_options, @options, ... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/cli/diff_spec.rb | spec/cli/diff_spec.rb | # frozen_string_literal: true
require 'stringio'
require 'open-uri'
RSpec.describe YARD::CLI::Diff do
before do
allow(CLI::Yardoc).to receive(:run)
allow(CLI::Gems).to receive(:run)
@diff = CLI::Diff.new
end
describe "Argument handling" do
it "exits if there is only one gem name" do
expect... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/cli/i18n_spec.rb | spec/cli/i18n_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::CLI::I18n do
before do
@i18n = YARD::CLI::I18n.new
@i18n.use_document_file = false
@i18n.use_yardopts_file = false
output_path = File.expand_path(@i18n.options.serializer.basepath)
allow(File).to receive(:open!).with(output_path, "wb")
allow(... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/cli/command_parser_spec.rb | spec/cli/command_parser_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::CLI::CommandParser do
describe "#run" do
before do
@cmd = CLI::CommandParser.new
end
it "shows help if --help is provided" do
command = double(:command)
expect(command).to receive(:run).with('--help')
CLI::CommandParser.commands[... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/cli/list_spec.rb | spec/cli/list_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::CLI::List do
it "passes command off to Yardoc with --list" do
expect(YARD::CLI::Yardoc).to receive(:run).with('-c', '--list', '--foo')
YARD::CLI::List.run('--foo')
end
end
| ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/cli/help_spec.rb | spec/cli/help_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::CLI::Help do
describe "#run" do
it "accepts help command" do
expect(CLI::Yardoc).to receive(:run).with('--help')
CLI::Help.run('doc')
end
it "accepts no arguments (and lists all commands)" do
expect(CLI::CommandParser).to receive(:run)... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/cli/server_spec.rb | spec/cli/server_spec.rb | # frozen_string_literal: true
class Server::WebrickAdapter; def start; end end
RSpec.describe YARD::CLI::Server do
before do
allow(CLI::Yardoc).to receive(:run)
@no_verify_libraries = false
@set_libraries = true
@no_adapter_mock = false
@libraries = {}
@options = {:single_library => true, :c... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/cli/display_spec.rb | spec/cli/display_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::CLI::Display do
before do
allow(Registry).to receive(:load)
@object = CodeObjects::ClassObject.new(:root, :Foo)
@object.docstring = 'Foo bar'
end
it "displays an object" do
YARD::CLI::Display.run('-f', 'text', 'Foo')
expect(log.io.string.str... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/cli/markup_types_spec.rb | spec/cli/markup_types_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::CLI::MarkupTypes do
it "lists all available markup types" do
YARD::CLI::MarkupTypes.run
data = log.io.string
exts = YARD::Templates::Helpers::MarkupHelper::MARKUP_EXTENSIONS
YARD::Templates::Helpers::MarkupHelper::MARKUP_PROVIDERS.each do |name, prov... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/cli/yard_on_yard_spec.rb | spec/cli/yard_on_yard_spec.rb | # frozen_string_literal: true
$TOPDIR = File.expand_path(File.join(File.dirname(__FILE__), '../..'))
require 'fileutils'
RSpec.describe YARD::CLI::Yardoc do
include FileUtils
context 'building the documentation of YARD itself' do
before(:context) do
rm_rf File.join($TOPDIR, 'doc')
rm_rf File.joi... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/cli/config_spec.rb | spec/cli/config_spec.rb | # frozen_string_literal: true
require 'yaml'
RSpec.describe YARD::CLI::Config do
before do
@config = YARD::CLI::Config.new
YARD::Config.options = YARD::Config::DEFAULT_CONFIG_OPTIONS.dup
allow(YARD::Config).to receive(:save)
end
def run(*args)
@config.run(*args)
end
describe "Listing config... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/parser/c_parser_spec.rb | spec/parser/c_parser_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Parser::C::CParser do
describe "#parse" do
def parse(contents)
Registry.clear
YARD.parse_string(contents, :c)
end
describe "Array class" do
before(:all) do
file = File.join(File.dirname(__FILE__), 'examples', 'array.c.txt')
... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/parser/source_parser_spec.rb | spec/parser/source_parser_spec.rb | # frozen_string_literal: true
class MyParser < Parser::Base; end
RSpec.shared_examples_for "parser type registration" do
after do
Parser::SourceParser.parser_types.delete(:my_parser)
Parser::SourceParser.parser_type_extensions.delete(:my_parser)
end
end
RSpec.describe YARD::Parser::SourceParser do
befo... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/parser/tag_parsing_spec.rb | spec/parser/tag_parsing_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Parser, "tag handling" do
before { parse_file :tag_handler_001, __FILE__ }
it "knows the list of all available tags" do
expect(P("Foo#foo").tags).to include(P("Foo#foo").tag(:api))
end
it "knows the text of tags on a method" do
expect(P("Foo#foo").ta... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/parser/base_spec.rb | spec/parser/base_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Parser::Base do
describe "#initialize" do
class MyParser < Parser::Base; def initialize(a, b) end end
it "takes 2 arguments" do
expect { YARD::Parser::Base.new }.to raise_error(ArgumentError,
/wrong (number|#) of arguments|given 0, expected 2/... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/parser/ruby/token_resolver_spec.rb | spec/parser/ruby/token_resolver_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Parser::Ruby::TokenResolver do
before(:all) do
YARD.parse_string <<-eof
module A
def nomatch; end
module B
class C
def initialize; end
# @return [A::B::C]
def self.foo; end
# @ret... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/parser/ruby/ruby_parser_spec.rb | spec/parser/ruby/ruby_parser_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Parser::Ruby::RubyParser do
def stmt(stmt)
YARD::Parser::Ruby::RubyParser.new(stmt, nil).parse.root.first
end
def stmts(stmts)
YARD::Parser::Ruby::RubyParser.new(stmts, nil).parse.root
end
def tokenize(stmt)
YARD::Parser::Ruby::RubyParser.new(s... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/parser/ruby/ast_node_spec.rb | spec/parser/ruby/ast_node_spec.rb | # frozen_string_literal: true
require 'pp'
require 'stringio'
include YARD::Parser::Ruby
RSpec.describe YARD::Parser::Ruby::AstNode do
describe "#jump" do
it "jumps to the first specific inner node if found" do
ast = s(:paren, s(:paren, s(:params, s(s(:ident, "hi"), s(:ident, "bye")))))
expect(ast.j... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/parser/ruby/legacy/statement_list_spec.rb | spec/parser/ruby/legacy/statement_list_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Parser::Ruby::Legacy::StatementList do
def stmts(code) YARD::Parser::Ruby::Legacy::StatementList.new(code) end
def stmt(code) stmts(code).first end
it "parses dangling block expressions" do
s = stmt <<-eof
if
foo
puts 'hi'
end
... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/parser/ruby/legacy/token_list_spec.rb | spec/parser/ruby/legacy/token_list_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Parser::Ruby::Legacy::TokenList do
Legacy = YARD::Parser::Ruby::Legacy
TokenList = Legacy::TokenList
LT = Legacy::RubyToken
describe "#initialize / #push" do
it "accepts a tokenlist (via constructor or push)" do
expect { TokenList.new(TokenList.new)... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/docs/templates/plugin.rb | docs/templates/plugin.rb | # frozen_string_literal: true
include YARD
include Templates
module TagTemplateHelper
def all_tags
Registry.all(:method).map {|m| m.tag('yard.tag') }.compact
end
def all_directives
Registry.all(:method).map {|m| m.tag('yard.directive') }.compact
end
def collect_tags
(all_tags + all_directives).... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/docs/templates/default/yard_tags/html/setup.rb | docs/templates/default/yard_tags/html/setup.rb | # frozen_string_literal: true
def init
sections :list, [T('docstring')]
end
def tag_signature(tag)
types = tag.types || []
signature = "<strong>#{tag_link_name(tag)}</strong> "
sig_tag = tag.object.tag('yard.signature')
extra = sig_tag.text if sig_tag
extra ||= case types.first
when 'with_name'... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/docs/templates/default/fulldoc/html/setup.rb | docs/templates/default/fulldoc/html/setup.rb | # frozen_string_literal: true
def generate_tag_list
@list_title = "Tag List"
@list_type = "tag"
asset('tag_list.html', erb(:full_list))
end
| ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/docs/templates/default/layout/html/setup.rb | docs/templates/default/layout/html/setup.rb | # frozen_string_literal: true
def init
super
sections.place(:tag_list).after_any(:files)
end
def menu_lists
super + [{:type => 'tag', :title => 'Tags', :search_title => 'Tag List'}]
end
| ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/templates/default/constant/text/setup.rb | templates/default/constant/text/setup.rb | # frozen_string_literal: true
def init
sections :header, [T('docstring')]
end
| ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/templates/default/root/dot/setup.rb | templates/default/root/dot/setup.rb | # frozen_string_literal: true
include T('default/module/dot')
def format_path(_object)
""
end
| ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/templates/default/root/html/setup.rb | templates/default/root/html/setup.rb | # frozen_string_literal: true
include T('default/module/html')
| ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/templates/default/fulldoc/html/setup.rb | templates/default/fulldoc/html/setup.rb | # frozen_string_literal: true
include Helpers::ModuleHelper
def init
options.objects = objects = run_verifier(options.objects)
return serialize_onefile if options.onefile
generate_assets
serialize('_index.html')
options.files.each_with_index do |file, _i|
serialize_file(file, file.title)
end
option... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/templates/default/tags/setup.rb | templates/default/tags/setup.rb | # frozen_string_literal: true
def init
tags = Tags::Library.visible_tags - [:abstract, :deprecated, :note, :todo]
create_tag_methods(tags - [:example, :option, :overload, :see])
sections :index, tags.map {|t| t.to_s.tr('.', '_').to_sym }
sections.any(:overload).push(T('docstring'))
end
def return
if object.t... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/templates/default/method_details/setup.rb | templates/default/method_details/setup.rb | # frozen_string_literal: true
def init
sections :header, [:method_signature, T('docstring'), :source]
end
def source
return if owner != object.namespace
return if Tags::OverloadTag === object
return if object.source.nil?
erb(:source)
end
| ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/templates/default/method_details/text/setup.rb | templates/default/method_details/text/setup.rb | # frozen_string_literal: true
def init
super
sections.last.pop
end
def format_object_title(object)
title = "Method: #{object.name(true)}"
title += " (#{object.namespace})" unless object.namespace.root?
title
end
| ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/templates/default/method/setup.rb | templates/default/method/setup.rb | # frozen_string_literal: true
def init
sections :header, [T('method_details')]
end
| ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/templates/default/layout/dot/setup.rb | templates/default/layout/dot/setup.rb | # frozen_string_literal: true
attr_reader :contents
def init
if object
type = object.root? ? :module : object.type
sections :header, [T(type)]
else
sections :header, [:contents]
end
end
def header
tidy erb(:header)
end
| ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/templates/default/layout/html/setup.rb | templates/default/layout/html/setup.rb | # frozen_string_literal: true
def init
@breadcrumb = []
@page_title = ''
@breadcrumb_title = ''
if @onefile
sections :layout
elsif defined?(@file) && @file
if @file.attributes[:namespace]
@object = options.object = Registry.at(@file.attributes[:namespace]) || Registry.root
end
@breadcrum... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/templates/default/docstring/setup.rb | templates/default/docstring/setup.rb | # frozen_string_literal: true
def init
return if object.docstring.blank? && !object.has_tag?(:api)
sections :index, [:private, :deprecated, :abstract, :todo, :note, :returns_void, :text], T('tags')
end
def private
return unless object.has_tag?(:api) && object.tag(:api).text == 'private'
erb(:private)
end
def ... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/templates/default/class/setup.rb | templates/default/class/setup.rb | # frozen_string_literal: true
include T('default/module')
def init
super
sections.place(:subclasses).before(:children)
sections.place(:constructor_details, [T('method_details')]).before(:methodmissing)
end
def constructor_details
ctors = object.meths(:inherited => true, :included => true)
@ctor = ctors.find... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/templates/default/class/dot/setup.rb | templates/default/class/dot/setup.rb | # frozen_string_literal: true
include T('default/module/dot')
def init
super
sections.push :superklass
end
| ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.