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 |
|---|---|---|---|---|---|---|---|---|
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/rspec/actions/destroy.rb | rails_generators/nifty_scaffold/templates/tests/rspec/actions/destroy.rb | it "destroy action should destroy model and redirect to index action" do
<%= singular_name %> = <%= class_name %>.first
delete :destroy, :id => <%= singular_name %>
response.should redirect_to(<%= items_path('url') %>)
<%= class_name %>.exists?(<%= singular_name %>.id).should be_false
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/rspec/actions/show.rb | rails_generators/nifty_scaffold/templates/tests/rspec/actions/show.rb | it "show action should render show template" do
get :show, :id => <%= class_name %>.first
response.should render_template(:show)
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/rspec/actions/edit.rb | rails_generators/nifty_scaffold/templates/tests/rspec/actions/edit.rb | it "edit action should render edit template" do
get :edit, :id => <%= class_name %>.first
response.should render_template(:edit)
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/shoulda/controller.rb | rails_generators/nifty_scaffold/templates/tests/shoulda/controller.rb | require 'test_helper'
class <%= plural_class_name %>ControllerTest < ActionController::TestCase
<%= controller_methods 'tests/shoulda/actions' %>
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/shoulda/model.rb | rails_generators/nifty_scaffold/templates/tests/shoulda/model.rb | require 'test_helper'
class <%= class_name %>Test < ActiveSupport::TestCase
should "be valid" do
assert <%= class_name %>.new.valid?
end
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/update.rb | rails_generators/nifty_scaffold/templates/tests/shoulda/actions/update.rb | context "update action" do
should "render edit template when model is invalid" do
<%= class_name %>.any_instance.stubs(:valid?).returns(false)
put :update, :id => <%= class_name %>.first
assert_template 'edit'
end
should "redirect when model is valid" do
<%= class_name %>.any_inst... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/index.rb | rails_generators/nifty_scaffold/templates/tests/shoulda/actions/index.rb | context "index action" do
should "render index template" do
get :index
assert_template 'index'
end
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/new.rb | rails_generators/nifty_scaffold/templates/tests/shoulda/actions/new.rb | context "new action" do
should "render new template" do
get :new
assert_template 'new'
end
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/create.rb | rails_generators/nifty_scaffold/templates/tests/shoulda/actions/create.rb | context "create action" do
should "render new template when model is invalid" do
<%= class_name %>.any_instance.stubs(:valid?).returns(false)
post :create
assert_template 'new'
end
should "redirect when model is valid" do
<%= class_name %>.any_instance.stubs(:valid?).returns(true)... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/destroy.rb | rails_generators/nifty_scaffold/templates/tests/shoulda/actions/destroy.rb | context "destroy action" do
should "destroy model and redirect to index action" do
<%= singular_name %> = <%= class_name %>.first
delete :destroy, :id => <%= singular_name %>
assert_redirected_to <%= items_path('url') %>
assert !<%= class_name %>.exists?(<%= singular_name %>.id)
end
... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/show.rb | rails_generators/nifty_scaffold/templates/tests/shoulda/actions/show.rb | context "show action" do
should "render show template" do
get :show, :id => <%= class_name %>.first
assert_template 'show'
end
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/edit.rb | rails_generators/nifty_scaffold/templates/tests/shoulda/actions/edit.rb | context "edit action" do
should "render edit template" do
get :edit, :id => <%= class_name %>.first
assert_template 'edit'
end
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/actions/update.rb | rails_generators/nifty_scaffold/templates/actions/update.rb | def update
@<%= singular_name %> = <%= class_name %>.find(params[:id])
if @<%= singular_name %>.update_attributes(params[:<%= singular_name %>])
flash[:notice] = "Successfully updated <%= name.underscore.humanize.downcase %>."
redirect_to <%= item_path('url') %>
else
render :action => 'e... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/actions/index.rb | rails_generators/nifty_scaffold/templates/actions/index.rb | def index
@<%= plural_name %> = <%= class_name %>.all
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/actions/new.rb | rails_generators/nifty_scaffold/templates/actions/new.rb | def new
@<%= singular_name %> = <%= class_name %>.new
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/actions/create.rb | rails_generators/nifty_scaffold/templates/actions/create.rb | def create
@<%= singular_name %> = <%= class_name %>.new(params[:<%= singular_name %>])
if @<%= singular_name %>.save
flash[:notice] = "Successfully created <%= name.underscore.humanize.downcase %>."
redirect_to <%= item_path('url') %>
else
render :action => 'new'
end
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/actions/destroy.rb | rails_generators/nifty_scaffold/templates/actions/destroy.rb | def destroy
@<%= singular_name %> = <%= class_name %>.find(params[:id])
@<%= singular_name %>.destroy
flash[:notice] = "Successfully destroyed <%= name.underscore.humanize.downcase %>."
redirect_to <%= items_path('url') %>
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/actions/show.rb | rails_generators/nifty_scaffold/templates/actions/show.rb | def show
@<%= singular_name %> = <%= class_name %>.find(params[:id])
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/actions/edit.rb | rails_generators/nifty_scaffold/templates/actions/edit.rb | def edit
@<%= singular_name %> = <%= class_name %>.find(params[:id])
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/benchmarks/struct_vs_ostruct.rb | benchmarks/struct_vs_ostruct.rb | require 'benchmark'
require 'ostruct'
require_relative '../lib/yard'
n = 100000
class MyStruct < Struct.new(:a, :b, :c); end
ostruct = OpenStruct.new
yostruct = YARD::OpenStruct.new
mystruct = MyStruct.new
Benchmark.bmbm do |x|
x.report("Struct.new(args)") { n.times { MyStruct.new 1, 2, 3 } }
x.report("Struct (as... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/benchmarks/erb_vs_erubis.rb | benchmarks/erb_vs_erubis.rb | # frozen_string_literal: true
require 'rubygems'
require 'erubis'
require 'erubis/tiny'
require 'erb'
require "benchmark"
require File.join(File.dirname(__FILE__), '..', 'lib', 'yard')
def rungen
YARD::Registry.load_yardoc(File.join(File.dirname(__FILE__), '..', '.yardoc'))
YARD::Registry.at("YARD::CodeObjects::Ba... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/benchmarks/ripper_parser.rb | benchmarks/ripper_parser.rb | # encoding: utf-8
# frozen_string_literal: true
require 'benchmark'
require File.dirname(__FILE__) + '/../lib/yard'
$files = Dir[File.dirname(__FILE__) + '/../lib/**/*.rb'].map {|f| File.read(f) }
$files_rip = Dir[File.dirname(__FILE__) + '/../lib/**/*.rb'].map {|f| [File.read(f), f] }
TIMES = 2
Benchmark.bmbm do |x|... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/benchmarks/pathname_vs_string.rb | benchmarks/pathname_vs_string.rb | # frozen_string_literal: true
require 'pathname'
require "benchmark"
require File.dirname(__FILE__) + '/../lib/yard'
pathobj = Pathname.new("a/b/c")
strobj = "a/b/c"
TIMES = 1_000
log.puts "join:"
Benchmark.bmbm do |x|
x.report("pathname") { TIMES.times { Pathname.new("a/b/c").join("d", "e", "f") } }
x.report("... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/benchmarks/concat_vs_join.rb | benchmarks/concat_vs_join.rb | # frozen_string_literal: true
require "benchmark"
STR1 = "Hello"
JOIN = "::"
STR2 = "World"
TESTS = 100_000
Benchmark.bmbm do |results|
results.report("concat") { TESTS.times { "".concat(STR1).concat(JOIN).concat(STR2) } }
results.report("add ") { TESTS.times { STR1 + JOIN + STR2 } }
results.report("join ") ... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/benchmarks/yri_cache.rb | benchmarks/yri_cache.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + "/../lib/yard"
require "benchmark"
include YARD::CLI
class YARD::CLI::YRI
def print_object(object) end
end
def remove_cache
File.unlink(YRI::CACHE_FILE)
end
TIMES = 10
NAME = 'YARD'
remove_cache; YRI.run(NAME)
Benchmark.bmbm do |x|
x.report("cache ... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/benchmarks/format_args.rb | benchmarks/format_args.rb | # frozen_string_literal: true
require "benchmark"
require 'lib/yard'
def format_args_regex(object)
if object.signature
object.signature[/#{Regexp.quote object.name.to_s}\s*(.*)/, 1]
else
""
end
end
def format_args_parameters(object)
if !object.parameters.empty?
args = object.parameters.map {|n, v|... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/benchmarks/template_erb.rb | benchmarks/template_erb.rb | # frozen_string_literal: true
require "benchmark"
require File.join(File.dirname(__FILE__), '..', 'lib', 'yard')
YARD::Registry.load_yardoc(File.join(File.dirname(__FILE__), '..', '.yardoc'))
obj = YARD::Registry.at("YARD::CodeObjects::Base")
TIMES = 3
Benchmark.bm do |x|
x.report("trim-line") { TIMES.times { obj.f... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/benchmarks/builtins_vs_eval.rb | benchmarks/builtins_vs_eval.rb | # frozen_string_literal: true
require 'benchmark'
require File.join(File.dirname(__FILE__), '..', 'lib', 'yard')
TIMES = (ARGV[0] || 10_000).to_i
def bench_builtins(name)
YARD::CodeObjects::BUILTIN_EXCEPTIONS_HASH.key? name
end
def bench_eval(name)
eval(name).is_a?(Class)
rescue
false
end
Benchmark.bmbm do |b... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/benchmarks/splat_vs_flatten.rb | benchmarks/splat_vs_flatten.rb | # frozen_string_literal: true
require "benchmark"
# To prove that flattening a small list is not significantly slower than
# calling *list (used to get around create_tag list issue)
$a = "FOO BAR BAZ"
def foo(*args) args.last.inspect end
TESTS = 10_000
Benchmark.bmbm do |x|
x.report("splat") { TESTS.times { foo(*$a... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/benchmarks/template_profile.rb | benchmarks/template_profile.rb | # frozen_string_literal: true
require 'rubygems'
require 'ruby-prof'
# require 'benchmark'
require File.join(File.dirname(__FILE__), '..', 'lib', 'yard')
YARD::Registry.load_yardoc(File.join(File.dirname(__FILE__), '..', '.yardoc'))
obj = YARD::Registry.at("YARD::CodeObjects::Base")
# PerfTools::CpuProfiler.start("te... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/benchmarks/marshal_vs_dbm.rb | benchmarks/marshal_vs_dbm.rb | # frozen_string_literal: true
require 'benchmark'
require 'dbm'
MARSHAL_FILE = "marshal_test.db"
DBM_FILE = "dbm_test"
WRITE_TIMES = 1
READ_TIMES = 100
NUM_INDICES = 10_000
INDICES = ['33', '857', '5022', '8555']
def generate_index
'0' * (rand * 4096).floor
end
def write_dbm
File.unlink(DBM_FILE + ".db") if File... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/benchmarks/parsing.rb | benchmarks/parsing.rb | # frozen_string_literal: true
require "benchmark"
require 'yard'
PATH_ORDER = [
'lib/yard/autoload.rb',
'lib/yard/code_objects/base.rb',
'lib/yard/code_objects/namespace_object.rb',
'lib/yard/handlers/base.rb',
'lib/yard/generators/helpers/*.rb',
'lib/yard/generators/base.rb',
'lib/yard/generators/method... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/benchmarks/registry_store_types.rb | benchmarks/registry_store_types.rb | # frozen_string_literal: true
require 'benchmark'
require File.join(File.dirname(__FILE__), '..', 'lib', 'yard')
def parse_and_select_objects
YARD::Registry.load_yardoc(File.join(File.dirname(__FILE__), '..', '.yardoc'))
YARD::Registry.load_all
$paths = []
4.times { $paths << YARD::Registry.paths[rand(YARD::Re... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/benchmarks/template_format.rb | benchmarks/template_format.rb | # frozen_string_literal: true
require "benchmark"
require File.join(File.dirname(__FILE__), '..', 'lib', 'yard')
YARD::Registry.load_yardoc(File.join(File.dirname(__FILE__), '..', '.yardoc'))
obj = YARD::Registry.at("YARD::CodeObjects::Base")
log.puts Benchmark.measure { obj.format(:format => :html) }
| ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/benchmarks/rdoc_vs_yardoc.rb | benchmarks/rdoc_vs_yardoc.rb | # frozen_string_literal: true
require "benchmark"
files = Dir.glob(File.dirname(__FILE__) + '/../lib/**/*.rb').join(" ")
Benchmark.bmbm do |x|
x.report("rdoc") { `rm -rf rdoc && rdoc -q -o rdoc #{files} && rm -rf rdoc` }
x.report("yardoc") { `rm -rf yard && ./bin/yardoc -q -o yard #{files} && rm -rf yard` }
x.re... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/benchmarks/ri_vs_yri.rb | benchmarks/ri_vs_yri.rb | # frozen_string_literal: true
require "benchmark"
TIMES = 10
Benchmark.bmbm do |x|
x.report("ri") { TIMES.times { `ri -T YARD::Tags::Library` } }
x.report("yri") { TIMES.times { `./bin/yri -T YARD::Tags::Library` } }
end
__END__
Rehearsal ---------------------------------------
ri 0.000000 0.020000 6.8800... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/benchmarks/generation.rb | benchmarks/generation.rb | # frozen_string_literal: true
require "benchmark"
require File.join(File.dirname(__FILE__), '..', 'lib', 'yard')
unless YARD::CodeObjects::Proxy.private_instance_methods.include?('to_obj')
raise "This benchmark is dependent on YARD::CodeObjects::Proxy#to_obj"
end
def rungen
YARD::Registry.clear
YARD::CLI::Yardo... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/registry_store_spec.rb | spec/registry_store_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::RegistryStore do
before do
FileUtils.rm_rf("foo")
@store = RegistryStore.new
@serializer = Serializers::YardocSerializer.new('foo')
@foo = CodeObjects::MethodObject.new(nil, :foo)
@bar = CodeObjects::ClassObject.new(nil, :Bar)
allow(Serialize... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/registry_resolver_spec.rb | spec/registry_resolver_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::RegistryResolver do
include YARD::CodeObjects::NamespaceMapper
describe '#starts_with_separator_match' do
subject { RegistryResolver.new }
it 'should clear cache when a namespace separator is registered' do
expect(subject.send(:starts_with_separato... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/logging_spec.rb | spec/logging_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Logger do
describe "#show_backtraces" do
it "is true if debug level is on" do
log.show_backtraces = true
log.enter_level(Logger::DEBUG) do
log.show_backtraces = false
expect(log.show_backtraces).to be true
end
expect(log.s... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/docstring_parser_spec.rb | spec/docstring_parser_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::DocstringParser do
after(:all) do
YARD::Registry.clear
end
def parse(content, object = nil, handler = nil)
@library ||= Tags::Library.instance
@parser = DocstringParser.new(@library)
@parser.parse(content, object, handler)
@parser
end
d... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/server_spec.rb | spec/server_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Server do
describe ".register_static_path" do
it "registers a static path" do
YARD::Server.register_static_path 'foo'
expect(YARD::Server::Commands::StaticFileCommand::STATIC_PATHS.last).to eq "foo"
end
it "does not duplicate paths" do
... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/docstring_spec.rb | spec/docstring_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Docstring do
before { YARD::Registry.clear }
describe "#initialize" do
it "handles docstrings with empty newlines" do
expect(Docstring.new("\n\n")).to eq ""
end
end
describe "#+" do
it "adds another Docstring" do
d = Docstring.new("FO... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/registry_spec.rb | spec/registry_spec.rb | # frozen_string_literal: true
include CodeObjects
require "thread"
RSpec.describe YARD::Registry do
before { Registry.clear }
describe ".yardoc_file_for_gem" do
before do
@gem = double('gem')
allow(@gem).to receive(:name).and_return('foo')
allow(@gem).to receive(:full_name).and_return('foo-... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/config_spec.rb | spec/config_spec.rb | # frozen_string_literal: true
require 'yaml'
RSpec.describe YARD::Config do
describe ".load" do
before do
expect(File).to receive(:file?).twice.with(CLI::Yardoc::DEFAULT_YARDOPTS_FILE).and_return(false)
end
it "uses default options if no ~/.yard/config is found" do
expect(File).to receive(:f... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require "rubygems"
begin
require "rspec"
rescue LoadError
require "spec"
end
begin
require 'bundler/setup'
rescue LoadError
nil # noop
end
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'yard'))
unless defined?(HAVE_RIPPER)
begin require 'ripper'; resc... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/verifier_spec.rb | spec/verifier_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Verifier do
describe "#parse_expressions" do
it "creates #__execute method" do
v = Verifier.new("expr1")
expect(v).to respond_to(:__execute)
end
it "parses @tagname into tag('tagname')" do
obj = double(:object)
expect(obj).to rec... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/options_spec.rb | spec/options_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Options do
class FooOptions < YARD::Options
attr_accessor :foo
def initialize; self.foo = "abc" end
end
describe ".default_attr" do
it "allows default attributes to be defined with symbols" do
class DefaultOptions1 < YARD::Options
defa... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/serializers/file_system_serializer_spec.rb | spec/serializers/file_system_serializer_spec.rb | # frozen_string_literal: true
require File.join(File.dirname(__FILE__), "spec_helper")
require 'stringio'
RSpec.describe YARD::Serializers::FileSystemSerializer do
before do
allow(FileUtils).to receive(:mkdir_p)
allow(File).to receive(:open)
end
describe "#basepath" do
it "defaults the base path to... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/serializers/yardoc_serializer_spec.rb | spec/serializers/yardoc_serializer_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + "/spec_helper"
instance_eval do
class YARD::Serializers::YardocSerializer
public :dump
public :internal_dump
end
end
RSpec.describe YARD::Serializers::YardocSerializer do
before do
@serializer = YARD::Serializers::YardocSerializer.new('.... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/serializers/spec_helper.rb | spec/serializers/spec_helper.rb | # frozen_string_literal: true
include YARD
| ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/code_objects/class_object_spec.rb | spec/code_objects/class_object_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::CodeObjects::ClassObject do
describe "#inheritance_tree" do
before(:all) do
Registry.clear
@mixin = ModuleObject.new(:root, :SomeMixin)
@mixin2 = ModuleObject.new(:root, :SomeMixin2)
@mixin2... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/code_objects/namespace_object_spec.rb | spec/code_objects/namespace_object_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::CodeObjects::NamespaceObject do
before { Registry.clear }
describe "#child" do
it "returns the object matching the name passed in if argument is a Symbol" do
obj = NamespaceObject.new(nil, :YARD)
oth... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/code_objects/code_object_list_spec.rb | spec/code_objects/code_object_list_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::CodeObjects::CodeObjectList do
before { Registry.clear }
describe "#push" do
it "only allows CodeObjects::Base, String or Symbol" do
list = CodeObjectList.new(nil)
expect { list.push(:hash => 1) }.to... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/code_objects/macro_object_spec.rb | spec/code_objects/macro_object_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::CodeObjects::MacroObject do
before do
Registry.clear
end
describe ".create" do
def create(*args) MacroObject.create(*args) end
it "creates an object" do
create('foo', '')
obj = Registry.at... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/code_objects/proxy_spec.rb | spec/code_objects/proxy_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::CodeObjects::Proxy do
before { Registry.clear }
it "does not allow constants to be used as a namespace if they do not resolve to a valid namespace" do
a = ConstantObject.new(:root, :A)
a.value = "$$INVALID$$... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/code_objects/module_object_spec.rb | spec/code_objects/module_object_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::CodeObjects::ModuleObject do
describe "#meths" do
before do
Registry.clear
# setup the object space:
#
# YARD:module
# YARD#foo:method
# YARD#foo2:method
# YARD#xy... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/code_objects/method_object_spec.rb | spec/code_objects/method_object_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::CodeObjects::MethodObject do
before do
Registry.clear
@yard = ModuleObject.new(:root, :YARD)
end
context "for an instance method in the root" do
it "has a path of testing" do
meth = MethodObject.... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/code_objects/extra_file_object_spec.rb | spec/code_objects/extra_file_object_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::CodeObjects::ExtraFileObject do
describe "#initialize" do
it "attempts to read contents from filesystem if contents=nil" do
expect(File).to receive(:read).with('file.txt').and_return('')
ExtraFileObject... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/code_objects/base_spec.rb | spec/code_objects/base_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::CodeObjects::Base do
before { Registry.clear }
it "does not allow empty object name" do
expect { Base.new(:root, '') }.to raise_error(ArgumentError)
end
it "returns a unique instance of any registered objec... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/code_objects/namespace_mapper_spec.rb | spec/code_objects/namespace_mapper_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::CodeObjects::NamespaceMapper do
include YARD::CodeObjects::NamespaceMapper
describe '#register_separator' do
it 'should allow separators to be registered' do
register_separator '!', :test_type
expec... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/code_objects/spec_helper.rb | spec/code_objects/spec_helper.rb | # frozen_string_literal: true
include CodeObjects
| ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/code_objects/constants_spec.rb | spec/code_objects/constants_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::CodeObjects do
def silence_warnings
origverb = $VERBOSE
$VERBOSE = nil
yield
$VERBOSE = origverb
end
describe :CONSTANTMATCH do
it "matches a constant" do
expect("Constant"[CodeObjects::C... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/tags/library_spec.rb | spec/tags/library_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Tags::Library do
def tag(docstring)
Docstring.new(docstring).tags.first
end
describe "#see_tag" do
it "takes a URL" do
expect(tag("@see http://example.com").name).to eq "http://example.com"
end
it "takes an object path" do
expect(ta... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/tags/default_factory_spec.rb | spec/tags/default_factory_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Tags::DefaultFactory do
before { @f = YARD::Tags::DefaultFactory.new }
describe "#parse_tag" do
it "does not have trailing whitespace on a regular freeform tag" do
expect(@f.parse_tag('api', 'private ').text).to eq "private"
end
end
describ... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/tags/overload_tag_spec.rb | spec/tags/overload_tag_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Tags::OverloadTag do
before do
@tag = Tags::OverloadTag.new(:overload, <<-'eof')
def bar(a, b = 1, &block)
Hello world
@param a [String]
@return [String]
eof
end
it "parses the first line as a method signature" do
expec... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/tags/ref_tag_list_spec.rb | spec/tags/ref_tag_list_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Tags::RefTagList do
before { YARD::Registry.clear }
it "accepts symbol or string as owner's path and convert it into a proxy" do
t = Tags::RefTagList.new('author', :String)
expect(t.owner).to eq P(:String)
end
it "accepts proxy object as owner" do
... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/tags/default_tag_spec.rb | spec/tags/default_tag_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Tags::DefaultTag do
it "creates a tag with defaults" do
o = YARD::Tags::DefaultTag.new('tagname', 'desc', ['types'], 'name', ['defaults'])
expect(o.defaults).to eq ['defaults']
expect(o.tag_name).to eq 'tagname'
expect(o.name).to eq 'name'
expect... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/tags/types_explainer_spec.rb | spec/tags/types_explainer_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::Tags::TypesExplainer do
Type = YARD::Tags::TypesExplainer::Type
CollectionType = YARD::Tags::TypesExplainer::CollectionType
FixedCollectionType = YARD::Tags::TypesExplainer::FixedCollectionType
HashCollectionType = YARD::Tags::TypesExplainer::HashCollectionTyp... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/tags/directives_spec.rb | spec/tags/directives_spec.rb | # frozen_string_literal: true
def tag_parse(content, object = nil, handler = nil)
@parser = DocstringParser.new
@parser.parse(content, object, handler)
@parser
end
RSpec.describe YARD::Tags::ParseDirective do
describe "#call" do
after { Registry.clear }
it "parses if handler=nil but use file=(stdin)"... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/core_ext/file_spec.rb | spec/core_ext/file_spec.rb | # frozen_string_literal: true
RSpec.describe File do
describe ".relative_path" do
it "returns the relative path between two files" do
expect(File.relative_path('a/b/c/d.html', 'a/b/d/q.html')).to eq '../d/q.html'
end
it "returns the relative path between two directories" do
expect(File.relat... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/core_ext/string_spec.rb | spec/core_ext/string_spec.rb | # frozen_string_literal: true
# described_in_docs String, '#camelcase'
# described_in_docs String, '#underscore'
RSpec.describe String do
describe "#shell_split" do
it "splits simple non-quoted text" do
expect("a b c".shell_split).to eq %w(a b c)
end
it "splits double quoted text into single toke... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/core_ext/symbol_hash_spec.rb | spec/core_ext/symbol_hash_spec.rb | # frozen_string_literal: true
RSpec.describe SymbolHash do
it "allows access to keys as String or Symbol" do
h = SymbolHash.new(false)
h['test'] = true
expect(h[:test]).to be true
expect(h['test']).to be true
end
describe "#delete" do
it "accepts either Strings or Symbols as deletion key" do... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/core_ext/array_spec.rb | spec/core_ext/array_spec.rb | # frozen_string_literal: true
RSpec.describe Array do
describe "#place" do
it "creates an Insertion object" do
expect([].place('x')).to be_kind_of(Insertion)
end
it "allows multiple objects to be placed" do
expect([1, 2].place('x', 'y', 'z').before(2)).to eq [1, 'x', 'y', 'z', 2]
end
e... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/core_ext/module_spec.rb | spec/core_ext/module_spec.rb | # frozen_string_literal: true
RSpec.describe Module do
describe "#class_name" do
it "returns just the name of the class/module" do
expect(YARD::CodeObjects::Base.class_name).to eq "Base"
end
end
end
| ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/core_ext/hash_spec.rb | spec/core_ext/hash_spec.rb | # frozen_string_literal: true
RSpec.describe Hash do
describe ".[]" do
it "accepts an Array argument (Ruby 1.8.6 and older)" do
list = [['foo', 'bar'], ['foo2', 'bar2']]
expect(Hash[list]).to eq('foo' => 'bar', 'foo2' => 'bar2')
end
it "accepts an array as a key" do
expect(Hash[['a', '... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/core_ext/insertion_spec.rb | spec/core_ext/insertion_spec.rb | # frozen_string_literal: true
RSpec.describe Insertion do
describe "#before" do
it "places an object before another" do
expect([1, 2].place(3).before(2)).to eq [1, 3, 2]
expect([1, 2].place(3).before(1)).to eq [3, 1, 2]
expect([1, [4], 2].place(3).before(2)).to eq [1, [4], 3, 2]
end
end
... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/i18n/text_spec.rb | spec/i18n/text_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::I18n::Text do
describe "#extract_messages" do
def extract_messages(input, options = {})
text = YARD::I18n::Text.new(StringIO.new(input), options)
messages = []
text.extract_messages do |*message|
messages << message
end
mess... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/i18n/message_spec.rb | spec/i18n/message_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::I18n::Message do
def message(id)
YARD::I18n::Message.new(id)
end
before do
@message = message("Hello World!")
end
describe "#id" do
it "returns ID" do
expect(message("Hello World!").id).to eq "Hello World!"
end
end
describe "#add... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/i18n/pot_generator_spec.rb | spec/i18n/pot_generator_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::I18n::PotGenerator do
def create_messages(messages)
yard_messages = YARD::I18n::Messages.new
add_messages(yard_messages, messages)
yard_messages
end
def add_messages(yard_messages, messages)
messages.each do |id, properties|
yard_message =... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/i18n/locale_spec.rb | spec/i18n/locale_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::I18n::Locale do
def locale(name)
YARD::I18n::Locale.new(name)
end
before do
@locale = locale("fr")
end
describe "#name" do
it "returns name" do
expect(locale("fr").name).to eq "fr"
end
end
describe "#load" do
it "returns fals... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/i18n/messages_spec.rb | spec/i18n/messages_spec.rb | # frozen_string_literal: true
RSpec.describe YARD::I18n::Messages do
def message(id)
YARD::I18n::Message.new(id)
end
def messages
YARD::I18n::Messages.new
end
before do
@messages = messages
end
describe "#each" do
it "enumerates messages" do
@messages.register("Hello World!")
... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/class_condition_handler_spec.rb | spec/handlers/class_condition_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}ClassConditionHandler" do
before(:all) { parse_file :class_condition_handler_001, __FILE__ }
def verify_method(*names)
names.each {|name| expect(Registry.at("A#... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/yield_handler_spec.rb | spec/handlers/yield_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}YieldHandler" do
before(:all) { parse_file :yield_handler_001, __FILE__ }
it "only parses yield blocks in methods" do
expect(P(:Testing).tag(:yield)).to be nil
... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/mixin_handler_spec.rb | spec/handlers/mixin_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}MixinHandler" do
before(:all) { parse_file :mixin_handler_001, __FILE__ }
it "handles includes from classes or modules" do
expect(Registry.at(:X).instance_mixin... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/exception_handler_spec.rb | spec/handlers/exception_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}ExceptionHandler" do
before(:all) { parse_file :exception_handler_001, __FILE__ }
it "does not document an exception outside of a method" do
expect(P('Testing')... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/module_handler_spec.rb | spec/handlers/module_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}ModuleHandler" do
before(:all) { parse_file :module_handler_001, __FILE__ }
it "parses a module block" do
expect(Registry.at(:ModName)).not_to eq nil
expect... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/attribute_handler_spec.rb | spec/handlers/attribute_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}AttributeHandler" do
before(:all) { parse_file :attribute_handler_001, __FILE__ }
def read_write(namespace, name, read, write, scope = :instance)
rname = namesp... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/constant_handler_spec.rb | spec/handlers/constant_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}ConstantHandler" do
before(:all) { parse_file :constant_handler_001, __FILE__ }
it "does not parse constants inside methods" do
expect(Registry.at("A::B::SOMECO... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/decorator_handler_methods_spec.rb | spec/handlers/decorator_handler_methods_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe "YARD::Handlers::Ruby::DecoratorHandlerMethods" do
describe "#process_decorator" do
# Create a YARD decorator handler.
# @param name [Symbol] name of the mock decorator
def create_test_handler(name)
data[na... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/public_class_method_handler_spec.rb | spec/handlers/public_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::" : ""}PublicClassMethodHandler" do
before { Registry.clear }
let(:visibility) { :public }
incl... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/class_variable_handler_spec.rb | spec/handlers/class_variable_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}ClassVariableHandler" do
before(:all) { parse_file :class_variable_handler_001, __FILE__ }
it "does not parse class variables inside methods" do
obj = Registry.... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/processor_spec.rb | spec/handlers/processor_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe YARD::Handlers::Processor do
before do
@proc = Handlers::Processor.new(YARD::OpenStruct.new(:parser_type => :ruby))
end
it "starts with public visibility" do
expect(@proc.visibility).to eq :public
end
it "s... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/private_constant_handler_spec.rb | spec/handlers/private_constant_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}PrivateConstantHandler" do
before(:all) { parse_file :private_constant_handler_001, __FILE__ }
it "handles private_constant statement" do
expect(Registry.at('A:... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/class_method_handler_shared_examples.rb | spec/handlers/class_method_handler_shared_examples.rb | # frozen_string_literal: true
RSpec.shared_examples "class method visibility decorator" do
# Use let(:visibility) to specify the name of the x_class_method
# visibility decorator to test.
describe do
before do
StubbedSourceParser.parse_string <<-CODE
class A
def self.b; end
... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/class_handler_spec.rb | spec/handlers/class_handler_spec.rb | # frozen_string_literal: true
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
RSpec.describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}ClassHandler" do
before(:all) { parse_file :class_handler_001, __FILE__ }
it "parses a class block with docstring" do
expect(P("A").docstring)... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/module_function_handler_spec.rb | spec/handlers/module_function_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}VisibilityHandler" do
after { Registry.clear }
def assert_module_function(namespace, name)
klass = Registry.at("#{namespace}.#{name}")
instance = Registry.a... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/alias_handler_spec.rb | spec/handlers/alias_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}AliasHandler" do
before(:all) { parse_file :alias_handler_001, __FILE__ }
it "throws alias into namespace object list" do
expect(P(:A).aliases[P("A#b")]).to eq ... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/method_condition_handler_spec.rb | spec/handlers/method_condition_handler_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
RSpec.describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}MethodConditionHandler" do
before(:all) { parse_file :method_condition_handler_001, __FILE__ }
it "does not parse regular if blocks in methods" do
expect(Regist... | ruby | MIT | 34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75 | 2026-01-04T15:58:51.996173Z | false |
lsegal/yard | https://github.com/lsegal/yard/blob/34796c5bfc0ce69a5fea1b38d96435fc4f5b7a75/spec/handlers/legacy_base_spec.rb | spec/handlers/legacy_base_spec.rb | # frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'
include Parser::Ruby::Legacy
RSpec.describe YARD::Handlers::Ruby::Legacy::Base, "#tokval" do
before { @handler = Handlers::Ruby::Legacy::Base.new(nil, nil) }
def tokval(code, *types)
@handler.send(:tokval, TokenList.new(code).first... | 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.