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 |
|---|---|---|---|---|---|---|---|---|
jnunemaker/httparty | https://github.com/jnunemaker/httparty/blob/55ec76e8d1df7903eab3f7c2367991400d3cf65e/lib/httparty/headers_processor.rb | lib/httparty/headers_processor.rb | # frozen_string_literal: true
module HTTParty
class HeadersProcessor
attr_reader :headers, :options
def initialize(headers, options)
@headers = headers
@options = options
end
def call
return unless options[:headers]
options[:headers] = headers.merge(options[:headers]) if he... | ruby | MIT | 55ec76e8d1df7903eab3f7c2367991400d3cf65e | 2026-01-04T15:41:22.900579Z | false |
jnunemaker/httparty | https://github.com/jnunemaker/httparty/blob/55ec76e8d1df7903eab3f7c2367991400d3cf65e/lib/httparty/version.rb | lib/httparty/version.rb | # frozen_string_literal: true
module HTTParty
VERSION = '0.24.0'
end
| ruby | MIT | 55ec76e8d1df7903eab3f7c2367991400d3cf65e | 2026-01-04T15:41:22.900579Z | false |
jnunemaker/httparty | https://github.com/jnunemaker/httparty/blob/55ec76e8d1df7903eab3f7c2367991400d3cf65e/lib/httparty/exceptions.rb | lib/httparty/exceptions.rb | # frozen_string_literal: true
module HTTParty
COMMON_NETWORK_ERRORS = [
EOFError,
Errno::ECONNABORTED,
Errno::ECONNREFUSED,
Errno::ECONNRESET,
Errno::EHOSTUNREACH,
Errno::EINVAL,
Errno::ENETUNREACH,
Errno::ENOTSOCK,
Errno::EPIPE,
Errno::ETIMEDOUT,
Net::HTTPBadResponse,
... | ruby | MIT | 55ec76e8d1df7903eab3f7c2367991400d3cf65e | 2026-01-04T15:41:22.900579Z | false |
jnunemaker/httparty | https://github.com/jnunemaker/httparty/blob/55ec76e8d1df7903eab3f7c2367991400d3cf65e/lib/httparty/response_fragment.rb | lib/httparty/response_fragment.rb | # frozen_string_literal: true
require 'delegate'
module HTTParty
# Allow access to http_response and code by delegation on fragment
class ResponseFragment < SimpleDelegator
attr_reader :http_response, :connection
def code
@http_response.code.to_i
end
def initialize(fragment, http_response,... | ruby | MIT | 55ec76e8d1df7903eab3f7c2367991400d3cf65e | 2026-01-04T15:41:22.900579Z | false |
jnunemaker/httparty | https://github.com/jnunemaker/httparty/blob/55ec76e8d1df7903eab3f7c2367991400d3cf65e/lib/httparty/hash_conversions.rb | lib/httparty/hash_conversions.rb | # frozen_string_literal: true
require 'erb'
module HTTParty
module HashConversions
# @return <String> This hash as a query string
#
# @example
# { name: "Bob",
# address: {
# street: '111 Ruby Ave.',
# city: 'Ruby Central',
# phones: ['111-111-1111', '222-222-... | ruby | MIT | 55ec76e8d1df7903eab3f7c2367991400d3cf65e | 2026-01-04T15:41:22.900579Z | false |
jnunemaker/httparty | https://github.com/jnunemaker/httparty/blob/55ec76e8d1df7903eab3f7c2367991400d3cf65e/lib/httparty/decompressor.rb | lib/httparty/decompressor.rb | # frozen_string_literal: true
module HTTParty
# Decompresses the response body based on the Content-Encoding header.
#
# Net::HTTP automatically decompresses Content-Encoding values "gzip" and "deflate".
# This class will handle "br" (Brotli) and "compress" (LZW) if the requisite
# gems are installed. Otherw... | ruby | MIT | 55ec76e8d1df7903eab3f7c2367991400d3cf65e | 2026-01-04T15:41:22.900579Z | false |
jnunemaker/httparty | https://github.com/jnunemaker/httparty/blob/55ec76e8d1df7903eab3f7c2367991400d3cf65e/lib/httparty/utils.rb | lib/httparty/utils.rb | # frozen_string_literal: true
module HTTParty
module Utils
def self.stringify_keys(hash)
return hash.transform_keys(&:to_s) if hash.respond_to?(:transform_keys)
hash.each_with_object({}) do |(key, value), new_hash|
new_hash[key.to_s] = value
end
end
end
end
| ruby | MIT | 55ec76e8d1df7903eab3f7c2367991400d3cf65e | 2026-01-04T15:41:22.900579Z | false |
jnunemaker/httparty | https://github.com/jnunemaker/httparty/blob/55ec76e8d1df7903eab3f7c2367991400d3cf65e/lib/httparty/response.rb | lib/httparty/response.rb | # frozen_string_literal: true
module HTTParty
class Response < Object
def self.underscore(string)
string.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').gsub(/([a-z])([A-Z])/, '\1_\2').downcase
end
def self._load(data)
req, resp, parsed_resp, resp_body = Marshal.load(data)
new(req, resp, -> { p... | ruby | MIT | 55ec76e8d1df7903eab3f7c2367991400d3cf65e | 2026-01-04T15:41:22.900579Z | false |
jnunemaker/httparty | https://github.com/jnunemaker/httparty/blob/55ec76e8d1df7903eab3f7c2367991400d3cf65e/lib/httparty/parser.rb | lib/httparty/parser.rb | # frozen_string_literal: true
module HTTParty
# The default parser used by HTTParty, supports xml, json, html, csv and
# plain text.
#
# == Custom Parsers
#
# If you'd like to do your own custom parsing, subclassing HTTParty::Parser
# will make that process much easier. There are a few different ways you... | ruby | MIT | 55ec76e8d1df7903eab3f7c2367991400d3cf65e | 2026-01-04T15:41:22.900579Z | false |
jnunemaker/httparty | https://github.com/jnunemaker/httparty/blob/55ec76e8d1df7903eab3f7c2367991400d3cf65e/lib/httparty/connection_adapter.rb | lib/httparty/connection_adapter.rb | # frozen_string_literal: true
module HTTParty
# Default connection adapter that returns a new Net::HTTP each time
#
# == Custom Connection Factories
#
# If you like to implement your own connection adapter, subclassing
# HTTParty::ConnectionAdapter will make it easier. Just override
# the #connection met... | ruby | MIT | 55ec76e8d1df7903eab3f7c2367991400d3cf65e | 2026-01-04T15:41:22.900579Z | false |
jnunemaker/httparty | https://github.com/jnunemaker/httparty/blob/55ec76e8d1df7903eab3f7c2367991400d3cf65e/lib/httparty/cookie_hash.rb | lib/httparty/cookie_hash.rb | # frozen_string_literal: true
class HTTParty::CookieHash < Hash #:nodoc:
CLIENT_COOKIES = %w(path expires domain path secure httponly samesite)
def add_cookies(data)
case data
when Hash
merge!(data)
when String
data.split('; ').each do |cookie|
key, value = cookie.split('=', 2)
... | ruby | MIT | 55ec76e8d1df7903eab3f7c2367991400d3cf65e | 2026-01-04T15:41:22.900579Z | false |
jnunemaker/httparty | https://github.com/jnunemaker/httparty/blob/55ec76e8d1df7903eab3f7c2367991400d3cf65e/lib/httparty/module_inheritable_attributes.rb | lib/httparty/module_inheritable_attributes.rb | # frozen_string_literal: true
module HTTParty
module ModuleInheritableAttributes #:nodoc:
def self.included(base)
base.extend(ClassMethods)
end
# borrowed from Rails 3.2 ActiveSupport
def self.hash_deep_dup(hash)
duplicate = hash.dup
duplicate.each_pair do |key, value|
if ... | ruby | MIT | 55ec76e8d1df7903eab3f7c2367991400d3cf65e | 2026-01-04T15:41:22.900579Z | false |
jnunemaker/httparty | https://github.com/jnunemaker/httparty/blob/55ec76e8d1df7903eab3f7c2367991400d3cf65e/lib/httparty/request.rb | lib/httparty/request.rb | # frozen_string_literal: true
require 'erb'
module HTTParty
class Request #:nodoc:
SupportedHTTPMethods = [
Net::HTTP::Get,
Net::HTTP::Post,
Net::HTTP::Patch,
Net::HTTP::Put,
Net::HTTP::Delete,
Net::HTTP::Head,
Net::HTTP::Options,
Net::HTTP::Move,
Net::HTTP:... | ruby | MIT | 55ec76e8d1df7903eab3f7c2367991400d3cf65e | 2026-01-04T15:41:22.900579Z | false |
jnunemaker/httparty | https://github.com/jnunemaker/httparty/blob/55ec76e8d1df7903eab3f7c2367991400d3cf65e/lib/httparty/net_digest_auth.rb | lib/httparty/net_digest_auth.rb | # frozen_string_literal: true
require 'digest/md5'
require 'net/http'
module Net
module HTTPHeader
def digest_auth(username, password, response)
authenticator = DigestAuthenticator.new(
username,
password,
@method,
@path,
response
)
authenticator.author... | ruby | MIT | 55ec76e8d1df7903eab3f7c2367991400d3cf65e | 2026-01-04T15:41:22.900579Z | false |
jnunemaker/httparty | https://github.com/jnunemaker/httparty/blob/55ec76e8d1df7903eab3f7c2367991400d3cf65e/lib/httparty/text_encoder.rb | lib/httparty/text_encoder.rb | # frozen_string_literal: true
module HTTParty
class TextEncoder
attr_reader :text, :content_type, :assume_utf16_is_big_endian
def initialize(text, assume_utf16_is_big_endian: true, content_type: nil)
@text = +text
@content_type = content_type
@assume_utf16_is_big_endian = assume_utf16_is_b... | ruby | MIT | 55ec76e8d1df7903eab3f7c2367991400d3cf65e | 2026-01-04T15:41:22.900579Z | false |
jnunemaker/httparty | https://github.com/jnunemaker/httparty/blob/55ec76e8d1df7903eab3f7c2367991400d3cf65e/lib/httparty/logger/logger.rb | lib/httparty/logger/logger.rb | # frozen_string_literal: true
require 'httparty/logger/apache_formatter'
require 'httparty/logger/curl_formatter'
require 'httparty/logger/logstash_formatter'
module HTTParty
module Logger
def self.formatters
@formatters ||= {
:curl => Logger::CurlFormatter,
:apache => Logger::ApacheFormat... | ruby | MIT | 55ec76e8d1df7903eab3f7c2367991400d3cf65e | 2026-01-04T15:41:22.900579Z | false |
jnunemaker/httparty | https://github.com/jnunemaker/httparty/blob/55ec76e8d1df7903eab3f7c2367991400d3cf65e/lib/httparty/logger/curl_formatter.rb | lib/httparty/logger/curl_formatter.rb | # frozen_string_literal: true
module HTTParty
module Logger
class CurlFormatter #:nodoc:
TAG_NAME = HTTParty.name
OUT = '>'
IN = '<'
attr_accessor :level, :logger
def initialize(logger, level)
@logger = logger
@level = level.to_sym
@messages... | ruby | MIT | 55ec76e8d1df7903eab3f7c2367991400d3cf65e | 2026-01-04T15:41:22.900579Z | false |
jnunemaker/httparty | https://github.com/jnunemaker/httparty/blob/55ec76e8d1df7903eab3f7c2367991400d3cf65e/lib/httparty/logger/logstash_formatter.rb | lib/httparty/logger/logstash_formatter.rb | # frozen_string_literal: true
module HTTParty
module Logger
class LogstashFormatter #:nodoc:
TAG_NAME = HTTParty.name
attr_accessor :level, :logger
def initialize(logger, level)
@logger = logger
@level = level.to_sym
end
def format(request, response)
@req... | ruby | MIT | 55ec76e8d1df7903eab3f7c2367991400d3cf65e | 2026-01-04T15:41:22.900579Z | false |
jnunemaker/httparty | https://github.com/jnunemaker/httparty/blob/55ec76e8d1df7903eab3f7c2367991400d3cf65e/lib/httparty/logger/apache_formatter.rb | lib/httparty/logger/apache_formatter.rb | # frozen_string_literal: true
module HTTParty
module Logger
class ApacheFormatter #:nodoc:
TAG_NAME = HTTParty.name
attr_accessor :level, :logger
def initialize(logger, level)
@logger = logger
@level = level.to_sym
end
def format(request, response)
@reque... | ruby | MIT | 55ec76e8d1df7903eab3f7c2367991400d3cf65e | 2026-01-04T15:41:22.900579Z | false |
jnunemaker/httparty | https://github.com/jnunemaker/httparty/blob/55ec76e8d1df7903eab3f7c2367991400d3cf65e/lib/httparty/response/headers.rb | lib/httparty/response/headers.rb | # frozen_string_literal: true
require 'delegate'
module HTTParty
class Response #:nodoc:
class Headers < ::SimpleDelegator
include ::Net::HTTPHeader
def initialize(header_values = nil)
@header = {}
if header_values
header_values.each_pair do |k,v|
if v.is_a?(Ar... | ruby | MIT | 55ec76e8d1df7903eab3f7c2367991400d3cf65e | 2026-01-04T15:41:22.900579Z | false |
jnunemaker/httparty | https://github.com/jnunemaker/httparty/blob/55ec76e8d1df7903eab3f7c2367991400d3cf65e/lib/httparty/request/body.rb | lib/httparty/request/body.rb | # frozen_string_literal: true
require_relative 'multipart_boundary'
require_relative 'streaming_multipart_body'
module HTTParty
class Request
class Body
NEWLINE = "\r\n"
private_constant :NEWLINE
def initialize(params, query_string_normalizer: nil, force_multipart: false)
@params = pa... | ruby | MIT | 55ec76e8d1df7903eab3f7c2367991400d3cf65e | 2026-01-04T15:41:22.900579Z | false |
jnunemaker/httparty | https://github.com/jnunemaker/httparty/blob/55ec76e8d1df7903eab3f7c2367991400d3cf65e/lib/httparty/request/multipart_boundary.rb | lib/httparty/request/multipart_boundary.rb | # frozen_string_literal: true
require 'securerandom'
module HTTParty
class Request
class MultipartBoundary
def self.generate
"------------------------#{SecureRandom.urlsafe_base64(12)}"
end
end
end
end
| ruby | MIT | 55ec76e8d1df7903eab3f7c2367991400d3cf65e | 2026-01-04T15:41:22.900579Z | false |
jnunemaker/httparty | https://github.com/jnunemaker/httparty/blob/55ec76e8d1df7903eab3f7c2367991400d3cf65e/lib/httparty/request/streaming_multipart_body.rb | lib/httparty/request/streaming_multipart_body.rb | # frozen_string_literal: true
module HTTParty
class Request
class StreamingMultipartBody
NEWLINE = "\r\n"
CHUNK_SIZE = 64 * 1024 # 64 KB chunks
def initialize(parts, boundary)
@parts = parts
@boundary = boundary
@part_index = 0
@state = :header
@current_... | ruby | MIT | 55ec76e8d1df7903eab3f7c2367991400d3cf65e | 2026-01-04T15:41:22.900579Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/.github/workflows/actions/memprof.rb | .github/workflows/actions/memprof.rb | # frozen_string_literal: true
require 'jekyll'
require 'memory_profiler'
MemoryProfiler.report(allow_files: ['lib/jekyll/', 'lib/jekyll.rb']) do
Jekyll::PluginManager.require_from_bundler
Jekyll::Commands::Build.process({
"source" => File.expand_path(ARGV[0]),
"destination" => File.expa... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/rubocop/jekyll.rb | rubocop/jekyll.rb | # frozen_string_literal: true
Dir[File.join(File.expand_path("jekyll", __dir__), "*.rb")].each do |ruby_file|
require ruby_file
end
| ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/rubocop/jekyll/no_puts_allowed.rb | rubocop/jekyll/no_puts_allowed.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Jekyll
class NoPutsAllowed < Base
MSG = "Avoid using `puts` to print things. Use `Jekyll.logger` instead."
RESTRICT_ON_SEND = %i[puts].freeze
def_node_search :puts_called?, <<-PATTERN
(send nil? :puts _)
... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/rubocop/jekyll/no_p_allowed.rb | rubocop/jekyll/no_p_allowed.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Jekyll
class NoPAllowed < Base
MSG = "Avoid using `p` to print things. Use `Jekyll.logger` instead."
RESTRICT_ON_SEND = %i[p].freeze
def_node_search :p_called?, <<-PATTERN
(send _ :p _)
PATTERN
... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/rubocop/jekyll/assert_equal_literal_actual.rb | rubocop/jekyll/assert_equal_literal_actual.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Jekyll
# Checks for `assert_equal(exp, act, msg = nil)` calls containing literal values as
# second argument. The second argument should ideally be a method called on the tested
# instance.
#
# @example
# # bad
... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/benchmark/conditional_liquid.rb | benchmark/conditional_liquid.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
require "liquid"
require "benchmark/ips"
# Test if processing content string without any Liquid constructs, via Liquid,
# is slower than checking whether constructs exist ( using `String#include?` )
# and return-ing the "plaintext" content string as is..
#
# Ref: http... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/benchmark/path-manager.rb | benchmark/path-manager.rb | # frozen_string_literal: true
require 'benchmark/ips'
require 'jekyll'
class FooPage
def initialize(dir:, name:)
@dir = dir
@name = name
end
def slow_path
File.join(*[@dir, @name].map(&:to_s).reject(&:empty?)).sub(%r!\A/!, "")
end
def fast_path
Jekyll::PathManager.join(@dir, @name).sub(%r!... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/benchmark/find-filter-vs-where-first-filters.rb | benchmark/find-filter-vs-where-first-filters.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
require 'benchmark/ips'
require_relative '../lib/jekyll'
puts ''
print 'Setting up... '
SITE = Jekyll::Site.new(
Jekyll.configuration({
"source" => File.expand_path("../docs", __dir__),
"destination" => File.expand_path("../docs/_site", _... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/benchmark/capture-assign.rb | benchmark/capture-assign.rb | #!/usr/bin/env ruby
require "liquid"
require "benchmark/ips"
puts "Ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
puts "Liquid #{Liquid::VERSION}"
template1 = '{% capture foobar %}foo{{ bar }}{% endcapture %}{{ foo }}{{ foobar }}'
template2 = '{% assign foobar = "foo" | append: bar %}{{ foobar }}'
def render(template)
... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/benchmark/static-drop-vs-forwarded.rb | benchmark/static-drop-vs-forwarded.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
require "forwardable"
require "colorator"
require "liquid"
require "benchmark/ips"
require "memory_profiler"
# Set up (memory) profiler
class Profiler
def self.run
yield new(ARGV[0] || 10_000)
end
def initialize(count)
@count = count.to_i
end
def ... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/benchmark/parse-include-tag-params.rb | benchmark/parse-include-tag-params.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
# For pull request: https://github.com/jekyll/jekyll/pull/8192
require 'benchmark/ips'
require 'bundler/setup'
require 'memory_profiler'
require 'jekyll'
CONTEXT = {"bar"=>"The quick brown fox"}
MARKUP_1 = %Q(foo=bar lorem="ipsum \\"dolor\\"" alpha='beta \\'gamma\\''... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/benchmark/schwartzian_transform.rb | benchmark/schwartzian_transform.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
#
# The Ruby documentation for #sort_by describes what's called a Schwartzian transform:
#
# > A more efficient technique is to cache the sort keys (modification times in this case)
# > before the sort. Perl users often call this approach a Schwartzian transform, afte... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/benchmark/sanitize-url.rb | benchmark/sanitize-url.rb | #!/usr/bin/env ruby
require "benchmark/ips"
PATH = "/../../..../...//.....//lorem/ipsum//dolor///sit.xyz"
def sanitize_with_regex
"/" + PATH.gsub(%r!/{2,}!, "/").gsub(%r!\.+/|\A/+!, "")
end
def sanitize_with_builtin
"/#{PATH}".gsub("..", "/").gsub("./", "").squeeze("/")
end
if sanitize_with_regex == sanitize_w... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/benchmark/regexp-vs-include.rb | benchmark/regexp-vs-include.rb | #!/usr/bin/env ruby
require 'benchmark/ips'
# For this pull request, which changes Page#dir
# https://github.com/jekyll/jekyll/pull/4403
CONTENT_CONTAINING = <<-HTML.freeze
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_page.rb | test/test_page.rb | # frozen_string_literal: true
require "helper"
class TestPage < JekyllUnitTest
def setup_page(*args)
dir, file = args
if file.nil?
file = dir
dir = ""
end
@page = Page.new(@site, source_dir, dir, file)
end
def do_render(page)
layouts = {
"default" => Layout.new(@site, sour... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_entry_filter.rb | test/test_entry_filter.rb | # frozen_string_literal: true
require "helper"
class TestEntryFilter < JekyllUnitTest
context "Filtering entries" do
setup do
@site = fixture_site
end
should "filter entries" do
ent1 = %w(foo.markdown bar.markdown baz.markdown #baz.markdown#
.baz.markdown foo.markdown~ .htac... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_kramdown.rb | test/test_kramdown.rb | # frozen_string_literal: true
require "helper"
require "rouge"
class TestKramdown < JekyllUnitTest
def fixture_converter(config)
site = fixture_site(
Utils.deep_merge_hashes(
{
"markdown" => "kramdown",
},
config
)
)
Jekyll::Cache.clear
site.find_convert... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_theme.rb | test/test_theme.rb | # frozen_string_literal: true
require "helper"
class TestTheme < JekyllUnitTest
def setup
@theme = Theme.new("test-theme")
end
context "initializing" do
should "normalize the theme name" do
theme = Theme.new(" Test-Theme ")
assert_equal "test-theme", theme.name
end
should "know the... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_log_adapter.rb | test/test_log_adapter.rb | # frozen_string_literal: true
require "helper"
class TestLogAdapter < JekyllUnitTest
class LoggerDouble
attr_accessor :level
def debug(*); end
def info(*); end
def warn(*); end
def error(*); end
end
context "#log_level=" do
should "set the writers logging level" do
subject = J... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_collections.rb | test/test_collections.rb | # frozen_string_literal: true
require "helper"
class TestCollections < JekyllUnitTest
context "an evil collection" do
setup do
@collection = Jekyll::Collection.new(fixture_site, "../../etc/password")
end
should "sanitize the label name" do
assert_equal "....etcpassword", @collection.label
... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_doctor_command.rb | test/test_doctor_command.rb | # frozen_string_literal: true
require "helper"
require "jekyll/commands/doctor"
class TestDoctorCommand < JekyllUnitTest
context "URLs only differ by case" do
setup do
clear_dest
end
should "return success on a valid site/page" do
@site = Site.new(Jekyll.configuration(
... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_liquid_renderer.rb | test/test_liquid_renderer.rb | # frozen_string_literal: true
require "helper"
class TestLiquidRenderer < JekyllUnitTest
context "profiler" do
setup do
@site = Site.new(site_configuration)
@renderer = @site.liquid_renderer
end
should "return a table with profiling results" do
@site.process
output = @renderer.... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_site.rb | test/test_site.rb | # frozen_string_literal: true
require "helper"
class TestSite < JekyllUnitTest
def with_image_as_post
tmp_image_path = File.join(source_dir, "_posts", "2017-09-01-jekyll-sticker.jpg")
FileUtils.cp File.join(Dir.pwd, "docs", "img", "jekyll-sticker.jpg"), tmp_image_path
yield
ensure
FileUtils.rm tmp... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_sass.rb | test/test_sass.rb | # frozen_string_literal: true
require "helper"
class TestSass < JekyllUnitTest
context "importing partials" do
setup do
@site = Jekyll::Site.new(Jekyll.configuration(
"source" => source_dir,
"destination" => dest_dir
... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_tag_link.rb | test/test_tag_link.rb | # frozen_string_literal: true
require "helper"
class TestTagLink < TagUnitTest
def render_content_with_collection(content, collection_label)
render_content(
content,
"collections" => { collection_label => { "output" => true } },
"read_collections" => true
)
end
context "post cont... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_cleaner.rb | test/test_cleaner.rb | # frozen_string_literal: true
require "helper"
class TestCleaner < JekyllUnitTest
context "directory in keep_files" do
setup do
clear_dest
FileUtils.mkdir_p(dest_dir("to_keep/child_dir"))
FileUtils.touch(File.join(dest_dir("to_keep"), "index.html"))
FileUtils.touch(File.join(dest_dir("t... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_excerpt_drop.rb | test/test_excerpt_drop.rb | # frozen_string_literal: true
require "helper"
class TestExcerptDrop < JekyllUnitTest
context "an excerpt drop" do
setup do
@site = fixture_site
@site.read
@doc = @site.docs_to_write.find { |d| !d.data["layout"].nil? }
@doc_drop = @doc.to_liquid
@excerpt = @doc.data["excerpt"]
... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_tag_post_url.rb | test/test_tag_post_url.rb | # frozen_string_literal: true
require "helper"
class TestTagPostUrl < TagUnitTest
context "simple page with post linking" do
setup do
content = <<~CONTENT
---
title: Post linking
---
{% post_url 2008-11-21-complex %}
CONTENT
render_content(content, "permalink"... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_plugin_manager.rb | test/test_plugin_manager.rb | # frozen_string_literal: true
require "helper"
class TestPluginManager < JekyllUnitTest
def with_no_gemfile
FileUtils.mv "Gemfile", "Gemfile.old"
yield
ensure
FileUtils.mv "Gemfile.old", "Gemfile"
end
def with_bundle_gemfile
FileUtils.mv "Gemfile", "AlternateGemfile"
yield
ensure
Fi... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_convertible.rb | test/test_convertible.rb | # frozen_string_literal: true
require "helper"
require "ostruct"
class TestConvertible < JekyllUnitTest
context "YAML front matter" do
setup do
@convertible = OpenStruct.new(
"site" => Site.new(Jekyll.configuration(
"source" => File.expand_path("fixtures", __dir__)
... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_path_manager.rb | test/test_path_manager.rb | # frozen_string_literal: true
require "helper"
class TestPathManager < JekyllUnitTest
context "PathManager" do
setup do
@source = Dir.pwd
end
should "return frozen copy of base if questionable path is nil" do
assert_equal @source, Jekyll::PathManager.sanitized_path(@source, nil)
asser... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_ansi.rb | test/test_ansi.rb | # frozen_string_literal: true
require "helper"
class TestAnsi < JekyllUnitTest
context nil do
setup do
@subject = Jekyll::Utils::Ansi
end
Jekyll::Utils::Ansi::COLORS.each_key do |color|
should "respond_to? #{color}" do
assert_respond_to(@subject, color)
end
end
should... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_related_posts.rb | test/test_related_posts.rb | # frozen_string_literal: true
require "helper"
class TestRelatedPosts < JekyllUnitTest
context "building related posts without lsi" do
setup do
@site = fixture_site
end
should "use the most recent posts for related posts" do
@site.reset
@site.read
last_post = @site.posts.la... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_generated_site.rb | test/test_generated_site.rb | # frozen_string_literal: true
require "helper"
class TestGeneratedSite < JekyllUnitTest
context "generated sites" do
setup do
clear_dest
@site = fixture_site
@site.process
@index = File.read(
dest_dir("index.html"),
**Utils.merged_file_read_opts(@site, {})
)
en... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_theme_data_reader.rb | test/test_theme_data_reader.rb | # frozen_string_literal: true
require "helper"
class TestThemeDataReader < JekyllUnitTest
context "site without a theme" do
setup do
@site = fixture_site("theme" => nil)
@site.reader.read_data
assert @site.data["greetings"]
assert @site.data["categories"]["dairy"]
end
should "sh... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_path_sanitization.rb | test/test_path_sanitization.rb | # frozen_string_literal: true
require "helper"
class TestPathSanitization < JekyllUnitTest
context "on Windows with absolute source" do
setup do
@source = "C:/Users/xmr/Desktop/mpc-hc.org"
@dest = "./_site/"
allow(Dir).to receive(:pwd).and_return("C:/Users/xmr/Desktop/mpc-hc.org")
end
... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_static_file.rb | test/test_static_file.rb | # frozen_string_literal: true
require "helper"
class TestStaticFile < JekyllUnitTest
def make_dummy_file(filename)
File.write(source_dir(filename), "some content")
end
def modify_dummy_file(filename)
string = "some content"
offset = string.size
File.write(source_dir(filename), "more content", o... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_tag_include_relative.rb | test/test_tag_include_relative.rb | # frozen_string_literal: true
require "helper"
class TestTagIncludeRelative < TagUnitTest
context "include_relative tag with variable and liquid filters" do
setup do
site = fixture_site.tap do |s|
s.read
s.render
end
post = site.posts.docs.find do |p|
p.basename.eql? "... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_tag_highlight.rb | test/test_tag_highlight.rb | # frozen_string_literal: true
require "helper"
class TestTagHighlight < TagUnitTest
def render_content_with_text_to_highlight(code)
content = <<~CONTENT
---
title: This is a test
---
This document has some highlighted code in it.
{% highlight text %}
#{code}
{% endhig... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_coffeescript.rb | test/test_coffeescript.rb | # frozen_string_literal: true
require "helper"
class TestCoffeeScript < JekyllUnitTest
context "converting CoffeeScript" do
setup do
External.require_with_graceful_fail("jekyll-coffeescript")
@site = fixture_site
@site.process
@test_coffeescript_file = dest_dir("js/coffeescript.js")
... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_theme_drop.rb | test/test_theme_drop.rb | # frozen_string_literal: true
require "helper"
class TestThemeDrop < JekyllUnitTest
should "be initialized only for gem-based themes" do
assert_nil fixture_site.to_liquid.theme
end
context "a theme drop" do
setup do
@drop = fixture_site("theme" => "test-theme").to_liquid.theme
end
should... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_document.rb | test/test_document.rb | # frozen_string_literal: true
require "helper"
class TestDocument < JekyllUnitTest
def assert_equal_value(key, one, other)
assert_equal(one[key], other[key])
end
def setup_encoded_document(filename)
site = fixture_site("collections" => ["encodings"])
site.process
Document.new(site.in_source_dir... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_page_without_a_file.rb | test/test_page_without_a_file.rb | # frozen_string_literal: true
require "helper"
class TestPageWithoutAFile < JekyllUnitTest
def setup_page(*args, base: source_dir, klass: PageWithoutAFile)
dir, file = args
if file.nil?
file = dir
dir = ""
end
klass.new(@site, base, dir, file)
end
def render_and_write
@site.rend... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_liquid_extensions.rb | test/test_liquid_extensions.rb | # frozen_string_literal: true
require "helper"
class TestLiquidExtensions < JekyllUnitTest
context "looking up a variable in a Liquid context" do
class SayHi < Liquid::Tag
include Jekyll::LiquidExtensions
def initialize(_tag_name, markup, _tokens)
@markup = markup.strip
end
def... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_post_reader.rb | test/test_post_reader.rb | # frozen_string_literal: true
require "helper"
class TestPostReader < JekyllUnitTest
context "#read_publishable" do
setup do
@site = Site.new(site_configuration)
@post_reader = PostReader.new(@site)
@dir = ""
@magic_dir = "_posts"
@matcher = Document::DATE_FILENAME_MATCHER
end
... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_filters.rb | test/test_filters.rb | # frozen_string_literal: true
require "helper"
class TestFilters < JekyllUnitTest
class JekyllFilter
include Jekyll::Filters
attr_accessor :site, :context
def initialize(opts = {})
@site = Jekyll::Site.new(opts.merge("skip_config_files" => true))
@context = Liquid::Context.new(@site.site_pa... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | true |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_layout_reader.rb | test/test_layout_reader.rb | # frozen_string_literal: true
require "helper"
class TestLayoutReader < JekyllUnitTest
context "reading layouts" do
setup do
config = Jekyll::Configuration::DEFAULTS.merge("source" => source_dir,
"destination" => dest_dir)
@site = fixture_sit... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_utils.rb | test/test_utils.rb | # frozen_string_literal: true
require "helper"
class TestUtils < JekyllUnitTest
context "The `Utils.deep_merge_hashes` method" do
setup do
clear_dest
@site = fixture_site
@site.process
end
should "merge a drop into a hash" do
data = { "page" => {} }
merged = Utils.deep_mer... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_url.rb | test/test_url.rb | # frozen_string_literal: true
require "helper"
class TestURL < JekyllUnitTest
context "The URL class" do
should "throw an exception if neither permalink or template is specified" do
assert_raises ArgumentError do
URL.new(:placeholders => {})
end
end
should "replace placeholders in t... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/helper.rb | test/helper.rb | # frozen_string_literal: true
$stdout.puts "# -------------------------------------------------------------"
$stdout.puts "# SPECS AND TESTS ARE RUNNING WITH WARNINGS OFF."
$stdout.puts "# SEE: https://github.com/Shopify/liquid/issues/730"
$stdout.puts "# SEE: https://github.com/jekyll/jekyll/issues/4719"
$stdout.puts... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_excerpt.rb | test/test_excerpt.rb | # frozen_string_literal: true
require "helper"
class TestExcerpt < JekyllUnitTest
def setup_post(file)
Document.new(@site.in_source_dir(File.join("_posts", file)),
:site => @site,
:collection => @site.posts).tap(&:read)
end
def do_render(document)
@site.layouts =... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_command.rb | test/test_command.rb | # frozen_string_literal: true
require "helper"
class TestCommand < JekyllUnitTest
context "when calling .add_build_options" do
should "add common options" do
cmd = Object.new
mocks_expect(cmd).to receive(:option).at_least(:once)
Command.add_build_options(cmd)
end
end
context "when cal... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_site_drop.rb | test/test_site_drop.rb | # frozen_string_literal: true
require "helper"
class TestSiteDrop < JekyllUnitTest
context "a site drop" do
setup do
@site = fixture_site(
"collections" => ["thanksgiving"]
)
@site.process
@drop = @site.to_liquid.site
end
should "respond to `key?`" do
assert_respon... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/simplecov_custom_profile.rb | test/simplecov_custom_profile.rb | # frozen_string_literal: true
require "simplecov"
SimpleCov.profiles.define "gem" do
add_filter "/test/"
add_filter "/features/"
add_filter "/autotest/"
add_group "Binaries", "/bin/"
add_group "Libraries", "/lib/"
end
| ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_tag_include.rb | test/test_tag_include.rb | # frozen_string_literal: true
require "helper"
class TestTagInclude < TagUnitTest
context "include tag with parameters" do
context "with symlink'd include" do
should "not allow symlink includes" do
FileUtils.mkdir_p("tmp")
File.write("tmp/pages-test", "SYMLINK TEST")
assert_raises ... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_regenerator.rb | test/test_regenerator.rb | # frozen_string_literal: true
require "helper"
class TestRegenerator < JekyllUnitTest
context "The site regenerator" do
setup do
FileUtils.rm_rf(source_dir(".jekyll-metadata"))
@site = fixture_site(
"collections" => {
"methods" => {
"output" => true,
},
... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_data_reader.rb | test/test_data_reader.rb | # frozen_string_literal: true
require "helper"
class TestDataReader < JekyllUnitTest
context "#sanitize_filename" do
setup do
@reader = DataReader.new(fixture_site)
end
should "remove evil characters" do
assert_equal "helpwhathaveIdone", @reader.sanitize_filename(
"help/what^&$^#*(!... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_theme_assets_reader.rb | test/test_theme_assets_reader.rb | # frozen_string_literal: true
require "helper"
class TestThemeAssetsReader < JekyllUnitTest
def setup
@site = fixture_site(
"theme" => "test-theme",
"theme-color" => "black"
)
assert @site.theme
end
def assert_file_with_relative_path(haystack, relative_path)
assert haystack.an... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_front_matter_defaults.rb | test/test_front_matter_defaults.rb | # frozen_string_literal: true
require "helper"
class TestFrontMatterDefaults < JekyllUnitTest
context "A site with full front matter defaults" do
setup do
@site = fixture_site(
"defaults" => [{
"scope" => {
"path" => "contacts",
"type" => "page",
},
... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_win_tz.rb | test/test_win_tz.rb | # frozen_string_literal: true
require "helper"
class TestWinTz < JekyllUnitTest
[["America/New_York", "WTZ+05:00"], ["Europe/Paris", "WTZ-01:00"]].each do |tz, expected|
should "use base offset in winter for #{tz}" do
result = Jekyll::Utils::WinTZ.calculate(tz, Time.utc(2021, 1, 1))
assert_equal exp... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_configuration.rb | test/test_configuration.rb | # frozen_string_literal: true
require "helper"
require "colorator"
class TestConfiguration < JekyllUnitTest
test_config = {
"source" => new(nil).source_dir,
"destination" => dest_dir,
}
context ".from" do
should "create a Configuration object" do
assert_instance_of Configuration, Configu... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_new_command.rb | test/test_new_command.rb | # frozen_string_literal: true
require "helper"
require "jekyll/commands/new"
class TestNewCommand < JekyllUnitTest
def dir_contents(path)
Dir["#{path}/**/*"].each do |file|
file.gsub! path, ""
end
end
def site_template
File.expand_path("../lib/site_template", __dir__)
end
def blank_templ... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_commands_serve_servlet.rb | test/test_commands_serve_servlet.rb | # frozen_string_literal: true
require "webrick"
require "helper"
require "net/http"
class TestCommandsServeServlet < JekyllUnitTest
def get(path)
TestWEBrick.mount_server do |_server, addr, port|
http = Net::HTTP.new(addr, port)
req = Net::HTTP::Get.new(path)
http.request(req) { |response| yi... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_drop.rb | test/test_drop.rb | # frozen_string_literal: true
require "helper"
class DropFixture < Jekyll::Drops::Drop
mutable true
attr_accessor :lipsum
def foo
"bar"
end
def fallback_data
@fallback_data ||= { "baz" => "buzz" }
end
end
class TestDrop < JekyllUnitTest
context "Drops" do
setup do
@site = fixture_s... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/test_commands_serve.rb | test/test_commands_serve.rb | # frozen_string_literal: true
require "webrick"
require "mercenary"
require "helper"
require "httpclient"
require "openssl"
require "tmpdir"
class TestCommandsServe < JekyllUnitTest
def custom_opts(what)
@cmd.send(
:webrick_opts, what
)
end
def start_server(opts)
@thread = Thread.new do
... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/source/_plugins/dummy.rb | test/source/_plugins/dummy.rb | # frozen_string_literal: true
module Jekyll
class Dummy < Generator
priority :high
def generate(site) end
end
end
| ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/test/source/_plugins/custom_block.rb | test/source/_plugins/custom_block.rb | # frozen_string_literal: true
# For testing excerpt handling of custom tags
module Jekyll
class DoNothingBlock < Liquid::Block
end
class DoNothingOther < Liquid::Tag
end
end
Liquid::Template.register_tag("do_nothing", Jekyll::DoNothingBlock)
Liquid::Template.register_tag("do_nothing_other", Jekyll::DoNothin... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/features/step_definitions.rb | features/step_definitions.rb | # frozen_string_literal: true
Before do
FileUtils.rm_rf(Paths.test_dir) if Paths.test_dir.exist?
FileUtils.mkdir_p(Paths.test_dir) unless Paths.test_dir.directory?
Dir.chdir(Paths.test_dir)
@timezone_before_scenario = ENV["TZ"]
end
#
After do
FileUtils.rm_rf(Paths.test_dir) if Paths.test_dir.exist?
Paths... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/features/support/helpers.rb | features/support/helpers.rb | # frozen_string_literal: true
require "jekyll"
class Paths
SOURCE_DIR = Pathname.new(File.expand_path("../..", __dir__))
def self.test_dir; source_dir.join("tmp", "jekyll"); end
def self.theme_gem_dir; source_dir.join("tmp", "jekyll", "my-cool-theme"); end
def self.output_file; test_dir.join("jekyll_output... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/features/support/formatter.rb | features/support/formatter.rb | # frozen_string_literal: true
require "cucumber/formatter/io"
module Jekyll
module Cucumber
class Formatter
include ::Cucumber::Formatter::Io
def initialize(path_or_io, error_stream)
@io = ensure_io(path_or_io, error_stream)
@timings = {}
end
def before_test_case(test_c... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/rake/task_utils/rubocop_config_formatter.rb | rake/task_utils/rubocop_config_formatter.rb | # frozen_string_literal: true
require "yaml"
module Jekyll
module TaskUtils
class RuboCopConfigFormatter
def initialize(config_file)
@registry = Hash.new { |hsh, k| hsh[k] = [] }
@buffer = +""
@config = sort_hash_by_key(YAML.safe_load_file(config_file))
@config... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/lib/jekyll.rb | lib/jekyll.rb | # frozen_string_literal: true
$LOAD_PATH.unshift __dir__ # For use/testing when no gem is installed
# Require all of the Ruby files in the given directory.
#
# path - The String relative path from here to the directory.
#
# Returns nothing.
def require_all(path)
glob = File.join(__dir__, path, "*.rb")
Dir[glob].s... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/lib/jekyll/command.rb | lib/jekyll/command.rb | # frozen_string_literal: true
module Jekyll
class Command
class << self
# A list of subclasses of Jekyll::Command
def subclasses
@subclasses ||= []
end
# Keep a list of subclasses of Jekyll::Command every time it's inherited
# Called automatically.
#
# base - th... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/lib/jekyll/convertible.rb | lib/jekyll/convertible.rb | # frozen_string_literal: true
# Convertible provides methods for converting a pagelike item
# from a certain type of markup into actual content
#
# Requires
# self.site -> Jekyll::Site
# self.content
# self.content=
# self.data=
# self.ext=
# self.output=
# self.name
# self.path
# self.type -> :page,... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/lib/jekyll/collection.rb | lib/jekyll/collection.rb | # frozen_string_literal: true
module Jekyll
class Collection
attr_reader :site, :label, :metadata
attr_writer :docs
# Create a new Collection.
#
# site - the site to which this collection belongs.
# label - the name of the collection
#
# Returns nothing.
def initialize(site, labe... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/lib/jekyll/external.rb | lib/jekyll/external.rb | # frozen_string_literal: true
module Jekyll
module External
class << self
#
# Gems that, if installed, should be loaded.
# Usually contain subcommands.
#
def blessed_gems
%w(
jekyll-compose
jekyll-docs
jekyll-import
)
end
#
... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
jekyll/jekyll | https://github.com/jekyll/jekyll/blob/4d3db3a83d8eaa2a844bef3f6222fd30b987af05/lib/jekyll/liquid_renderer.rb | lib/jekyll/liquid_renderer.rb | # frozen_string_literal: true
require_relative "liquid_renderer/file"
require_relative "liquid_renderer/table"
module Jekyll
class LiquidRenderer
def initialize(site)
@site = site
Liquid::Template.error_mode = @site.config["liquid"]["error_mode"].to_sym
reset
end
def reset
@stat... | ruby | MIT | 4d3db3a83d8eaa2a844bef3f6222fd30b987af05 | 2026-01-04T15:37:27.237281Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.