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 |
|---|---|---|---|---|---|---|---|---|
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/stub_registry.rb | lib/webmock/stub_registry.rb | # frozen_string_literal: true
module WebMock
class StubRegistry
include Singleton
attr_accessor :request_stubs
def initialize
reset!
end
def global_stubs
@global_stubs ||= Hash.new { |h, k| h[k] = [] }
end
def reset!
self.request_stubs = []
end
def register... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/request_signature_snippet.rb | lib/webmock/request_signature_snippet.rb | # frozen_string_literal: true
require "pp"
module WebMock
class RequestSignatureSnippet
attr_reader :request_signature, :request_stub
def initialize(request_signature)
@request_signature = request_signature
@request_stub = RequestStub.from_request_signature(request_signature)
end
def ... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/api.rb | lib/webmock/api.rb | # frozen_string_literal: true
module WebMock
module API
extend self
def stub_request(method, uri)
WebMock::StubRegistry.instance.
register_request_stub(WebMock::RequestStub.new(method, uri))
end
alias_method :stub_http_request, :stub_request
def a_request(method, uri)
WebMo... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/rack_response.rb | lib/webmock/rack_response.rb | # frozen_string_literal: true
module WebMock
class RackResponse < Response
def initialize(app)
@app = app
end
def evaluate(request)
env = build_rack_env(request)
status, headers, response = @app.call(env)
Response.new(
body: body_from_rack_response(response),
he... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/minitest.rb | lib/webmock/minitest.rb | # frozen_string_literal: true
begin
require 'minitest/test'
test_class = Minitest::Test
assertions = "assertions"
rescue LoadError
require "minitest/unit"
test_class = MiniTest::Unit::TestCase
assertions = "_assertions"
end
require 'webmock'
WebMock.enable!
test_class.class_eval do
include WebMock::AP... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/request_registry.rb | lib/webmock/request_registry.rb | # frozen_string_literal: true
module WebMock
class RequestRegistry
include Singleton
attr_accessor :requested_signatures
def initialize
reset!
end
def reset!
self.requested_signatures = Util::HashCounter.new
end
def times_executed(request_pattern)
self.requested_sig... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/config.rb | lib/webmock/config.rb | # frozen_string_literal: true
module WebMock
class Config
include Singleton
def initialize
@show_stubbing_instructions = true
@show_body_diff = true
end
attr_accessor :allow_net_connect
attr_accessor :allow_localhost
attr_accessor :allow
attr_accessor :net_http_connect_on_st... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/rspec.rb | lib/webmock/rspec.rb | # frozen_string_literal: true
require 'webmock'
# RSpec 1.x and 2.x compatibility
if defined?(RSpec::Expectations::ExpectationNotMetError)
RSPEC_NAMESPACE = RSPEC_CONFIGURER = RSpec
elsif defined?(Spec) && defined?(Spec.configure)
RSPEC_NAMESPACE = Spec
RSPEC_CONFIGURER = Spec::Runner
else
begin
require '... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/callback_registry.rb | lib/webmock/callback_registry.rb | # frozen_string_literal: true
module WebMock
class CallbackRegistry
@@callbacks = []
def self.add_callback(options, block)
@@callbacks << {options: options, block: block}
end
def self.callbacks
@@callbacks
end
def self.invoke_callbacks(options, request_signature, response)
... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/webmock.rb | lib/webmock/webmock.rb | # frozen_string_literal: true
module WebMock
def self.included(clazz)
WebMock::Deprecation.warning("include WebMock is deprecated. Please include WebMock::API instead")
if clazz.instance_methods.map(&:to_s).include?('request')
warn "WebMock#request was not included in #{clazz} to avoid name collision"... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/request_pattern.rb | lib/webmock/request_pattern.rb | # frozen_string_literal: true
module WebMock
module RSpecMatcherDetector
def rSpecHashIncludingMatcher?(matcher)
matcher.class.name =~ /R?Spec::Mocks::ArgumentMatchers::HashIncludingMatcher/
end
def rSpecHashExcludingMatcher?(matcher)
matcher.class.name =~ /R?Spec::Mocks::ArgumentMatchers::... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/assertion_failure.rb | lib/webmock/assertion_failure.rb | # frozen_string_literal: true
module WebMock
class AssertionFailure
@error_class = RuntimeError
class << self
attr_accessor :error_class
def failure(message)
raise @error_class.new(message)
end
end
end
end
| ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/request_stub.rb | lib/webmock/request_stub.rb | # frozen_string_literal: true
module WebMock
class RequestStub
attr_accessor :request_pattern
def initialize(method, uri)
@request_pattern = RequestPattern.new(method, uri)
@responses_sequences = []
self
end
def with(params = {}, &block)
@request_pattern.with(params, &block... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/util/hash_validator.rb | lib/webmock/util/hash_validator.rb | # frozen_string_literal: true
module WebMock
class HashValidator
def initialize(hash)
@hash = hash
end
#This code is based on https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/hash/keys.rb
def validate_keys(*valid_keys)
valid_keys.flatten!
@hash.e... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/util/hash_counter.rb | lib/webmock/util/hash_counter.rb | # frozen_string_literal: true
require 'thread'
module WebMock
module Util
class HashCounter
attr_accessor :hash
def initialize
self.hash = Hash.new(0)
@order = {}
@max = 0
@lock = ::Mutex.new
end
def put(key, num=1)
@lock.synchronize do
... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/util/values_stringifier.rb | lib/webmock/util/values_stringifier.rb | # frozen_string_literal: true
class WebMock::Util::ValuesStringifier
def self.stringify_values(value)
case value
when String, Numeric, TrueClass, FalseClass
value.to_s
when Hash
Hash[
value.map do |k, v|
[k, stringify_values(v)]
end
]
when Array
value... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/util/uri.rb | lib/webmock/util/uri.rb | # frozen_string_literal: true
module WebMock
module Util
class URI
module CharacterClasses
USERINFO = Addressable::URI::CharacterClasses::UNRESERVED + Addressable::URI::CharacterClasses::SUB_DELIMS + "\\:"
end
ADDRESSABLE_URIS = Hash.new do |hash, key|
hash[key] = Addressable... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/util/query_mapper.rb | lib/webmock/util/query_mapper.rb | # frozen_string_literal: true
module WebMock::Util
class QueryMapper
class << self
#This class is based on Addressable::URI pre 2.3.0
##
# Converts the query component to a Hash value.
#
# @option [Symbol] notation
# May be one of <code>:flat</code>, <code>:dot</code>, or
... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/util/hash_keys_stringifier.rb | lib/webmock/util/hash_keys_stringifier.rb | # frozen_string_literal: true
module WebMock
module Util
class HashKeysStringifier
def self.stringify_keys!(arg, options = {})
case arg
when Array
arg.map { |elem|
options[:deep] ? stringify_keys!(elem, options) : elem
}
when Hash
Hash[
... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/util/headers.rb | lib/webmock/util/headers.rb | # frozen_string_literal: true
module WebMock
module Util
class Headers
STANDARD_HEADER_DELIMITER = '-'
NONSTANDARD_HEADER_DELIMITER = '_'
JOIN = ', '
def self.normalize_headers(headers)
return nil unless headers
headers.each_with_object({}) do |(name, value), new_head... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/util/version_checker.rb | lib/webmock/util/version_checker.rb | # frozen_string_literal: true
# This code was created based on https://github.com/myronmarston/vcr/blob/master/lib/vcr/util/version_checker.rb
# Thanks to @myronmarston
# Copyright (c) 2010-2012 Myron Marston
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associ... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/util/parsers/parse_error.rb | lib/webmock/util/parsers/parse_error.rb | module WebMock
module Util
module Parsers
class ParseError < StandardError; end
end
end
end | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/util/parsers/xml.rb | lib/webmock/util/parsers/xml.rb | require_relative "parse_error"
require "crack/xml"
module WebMock
module Util
module Parsers
class XML
def self.parse(xml)
::Crack::XML.parse(xml)
rescue ::REXML::ParseException => e
raise ParseError, "Invalid XML string: #{xml}, Error: #{e.inspect}"
end
en... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/util/parsers/json.rb | lib/webmock/util/parsers/json.rb | # frozen_string_literal: true
# This is a copy of https://github.com/jnunemaker/crack/blob/master/lib/crack/json.rb
# with date parsing removed
# Copyright (c) 2004-2008 David Heinemeier Hansson
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/rspec/matchers.rb | lib/webmock/rspec/matchers.rb | # frozen_string_literal: true
require 'webmock'
require 'webmock/rspec/matchers/request_pattern_matcher'
require 'webmock/rspec/matchers/webmock_matcher'
module WebMock
module Matchers
def have_been_made
WebMock::RequestPatternMatcher.new
end
def have_been_requested
WebMock::RequestPatternM... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/rspec/matchers/webmock_matcher.rb | lib/webmock/rspec/matchers/webmock_matcher.rb | # frozen_string_literal: true
module WebMock
class WebMockMatcher
def initialize(method, uri)
@request_execution_verifier = RequestExecutionVerifier.new
@request_execution_verifier.request_pattern = RequestPattern.new(method, uri)
end
def once
@request_execution_verifier.expected_time... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/rspec/matchers/request_pattern_matcher.rb | lib/webmock/rspec/matchers/request_pattern_matcher.rb | # frozen_string_literal: true
module WebMock
class RequestPatternMatcher
def initialize
@request_execution_verifier = RequestExecutionVerifier.new
end
def once
@request_execution_verifier.expected_times_executed = 1
self
end
def twice
@request_execution_verifier.expecte... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/matchers/hash_including_matcher.rb | lib/webmock/matchers/hash_including_matcher.rb | # frozen_string_literal: true
module WebMock
module Matchers
# this is a based on RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher
# https://github.com/rspec/rspec-mocks/blob/master/lib/rspec/mocks/argument_matchers.rb
class HashIncludingMatcher < HashArgumentMatcher
def ==(actual)
supe... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/matchers/any_arg_matcher.rb | lib/webmock/matchers/any_arg_matcher.rb | # frozen_string_literal: true
module WebMock
module Matchers
# this is a based on RSpec::Mocks::ArgumentMatchers::AnyArgMatcher
class AnyArgMatcher
def initialize(ignore)
end
def ==(other)
true
end
end
end
end
| ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/matchers/hash_argument_matcher.rb | lib/webmock/matchers/hash_argument_matcher.rb | # frozen_string_literal: true
module WebMock
module Matchers
# Base class for Hash matchers
# https://github.com/rspec/rspec-mocks/blob/master/lib/rspec/mocks/argument_matchers.rb
class HashArgumentMatcher
def initialize(expected)
@expected = Hash[WebMock::Util::HashKeysStringifier.stringif... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/matchers/hash_excluding_matcher.rb | lib/webmock/matchers/hash_excluding_matcher.rb | # frozen_string_literal: true
module WebMock
module Matchers
# this is a based on RSpec::Mocks::ArgumentMatchers::HashExcludingMatcher
# https://github.com/rspec/rspec-mocks/blob/master/lib/rspec/mocks/argument_matchers.rb
class HashExcludingMatcher < HashArgumentMatcher
def ==(actual)
supe... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/http_lib_adapters/async_http_client_adapter.rb | lib/webmock/http_lib_adapters/async_http_client_adapter.rb | # frozen_string_literal: true
begin
require 'async'
require 'async/http'
rescue LoadError
# async-http not found
end
if defined?(Async::HTTP)
module WebMock
module HttpLibAdapters
class AsyncHttpClientAdapter < HttpLibAdapter
adapter_for :async_http_client
OriginalAsyncHttpClient = ... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb | lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb | # frozen_string_literal: true
begin
require 'typhoeus'
rescue LoadError
# typhoeus not found
end
if defined?(Typhoeus)
WebMock::VersionChecker.new('Typhoeus', Typhoeus::VERSION, '0.3.2').check_version!
module WebMock
module HttpLibAdapters
class TyphoeusAdapter < HttpLibAdapter
adapter_for ... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/http_lib_adapters/curb_adapter.rb | lib/webmock/http_lib_adapters/curb_adapter.rb | # frozen_string_literal: true
begin
require 'curb'
rescue LoadError
# curb not found
end
if defined?(Curl)
WebMock::VersionChecker.new('Curb', Curl::CURB_VERSION, '0.7.16', '1.2.2', ['0.8.7']).check_version!
module WebMock
module HttpLibAdapters
class CurbAdapter < HttpLibAdapter
adapter_fo... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/http_lib_adapters/http_lib_adapter.rb | lib/webmock/http_lib_adapters/http_lib_adapter.rb | # frozen_string_literal: true
module WebMock
class HttpLibAdapter
def self.adapter_for(lib)
WebMock::HttpLibAdapterRegistry.instance.register(lib, self)
end
end
end | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/http_lib_adapters/net_http_response.rb | lib/webmock/http_lib_adapters/net_http_response.rb | # frozen_string_literal: true
# This code is entierly copied from VCR (http://github.com/myronmarston/vcr) by courtesy of Myron Marston
# A Net::HTTP response that has already been read raises an IOError when #read_body
# is called with a destination string or block.
#
# This causes a problem when VCR records a respo... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/http_lib_adapters/http_rb_adapter.rb | lib/webmock/http_lib_adapters/http_rb_adapter.rb | # frozen_string_literal: true
begin
require "http"
rescue LoadError
# HTTP gem not found
end
if defined?(HTTP) && defined?(HTTP::VERSION)
WebMock::VersionChecker.new("HTTP Gem", HTTP::VERSION, "0.6.0").check_version!
module WebMock
module HttpLibAdapters
class HttpRbAdapter < HttpLibAdapter
... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/http_lib_adapters/manticore_adapter.rb | lib/webmock/http_lib_adapters/manticore_adapter.rb | # frozen_string_literal: true
begin
require 'manticore'
rescue LoadError
# manticore not found
end
if defined?(Manticore)
module WebMock
module HttpLibAdapters
class ManticoreAdapter < HttpLibAdapter
adapter_for :manticore
OriginalManticoreClient = Manticore::Client
def self.... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/http_lib_adapters/patron_adapter.rb | lib/webmock/http_lib_adapters/patron_adapter.rb | # frozen_string_literal: true
begin
require 'patron'
rescue LoadError
# patron not found
end
if defined?(::Patron::Session)
module WebMock
module HttpLibAdapters
class PatronAdapter < ::WebMock::HttpLibAdapter
adapter_for :patron
OriginalPatronSession = ::Patron::Session unless const_... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/http_lib_adapters/em_http_request_adapter.rb | lib/webmock/http_lib_adapters/em_http_request_adapter.rb | # frozen_string_literal: true
begin
require 'em-http-request'
rescue LoadError
# em-http-request not found
end
if defined?(EventMachine::HttpClient)
module WebMock
module HttpLibAdapters
class EmHttpRequestAdapter < HttpLibAdapter
adapter_for :em_http_request
OriginalHttpClient = Even... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/http_lib_adapters/httpclient_adapter.rb | lib/webmock/http_lib_adapters/httpclient_adapter.rb | # frozen_string_literal: true
begin
require 'httpclient'
require 'jsonclient' # defined in 'httpclient' gem as well
rescue LoadError
# httpclient not found
# or jsonclient not defined (in old versions of httclient gem)
end
if defined?(::HTTPClient)
module WebMock
module HttpLibAdapters
class HTTP... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/http_lib_adapters/http_lib_adapter_registry.rb | lib/webmock/http_lib_adapters/http_lib_adapter_registry.rb | # frozen_string_literal: true
module WebMock
class HttpLibAdapterRegistry
include Singleton
attr_accessor :http_lib_adapters
def initialize
@http_lib_adapters = {}
end
def register(lib, adapter)
@http_lib_adapters[lib] = adapter
end
def each_adapter(&block)
@http_lib... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/http_lib_adapters/net_http.rb | lib/webmock/http_lib_adapters/net_http.rb | # frozen_string_literal: true
require 'net/http'
require 'net/https'
require 'stringio'
require File.join(File.dirname(__FILE__), 'net_http_response')
module WebMock
module HttpLibAdapters
class NetHttpAdapter < HttpLibAdapter
adapter_for :net_http
OriginalNetHTTP = Net::HTTP unless const_defined?... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/http_lib_adapters/excon_adapter.rb | lib/webmock/http_lib_adapters/excon_adapter.rb | # frozen_string_literal: true
begin
require 'excon'
rescue LoadError
# excon not found
end
if defined?(Excon)
WebMock::VersionChecker.new('Excon', Excon::VERSION, '0.27.5').check_version!
module WebMock
module HttpLibAdapters
class ExconAdapter < HttpLibAdapter
PARAMS_TO_DELETE = [:expects... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/http_lib_adapters/http_rb/streamer.rb | lib/webmock/http_lib_adapters/http_rb/streamer.rb | # frozen_string_literal: true
module HTTP
class Response
class Streamer
def initialize(str, encoding: Encoding::BINARY)
@io = StringIO.new str
@encoding = encoding
end
def readpartial(size = nil, outbuf = nil)
unless size
if defined?(HTTP::Client::BUFFER_SIZE)... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/http_lib_adapters/http_rb/response.rb | lib/webmock/http_lib_adapters/http_rb/response.rb | # frozen_string_literal: true
module HTTP
class Response
def to_webmock
webmock_response = ::WebMock::Response.new
webmock_response.status = [status.to_i, reason]
webmock_response.body = body.to_s
# This call is used to reset the body of the response to enable it to be streamed if n... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/http_lib_adapters/http_rb/client.rb | lib/webmock/http_lib_adapters/http_rb/client.rb | # frozen_string_literal: true
module HTTP
class Client
alias_method :__perform__, :perform
def perform(request, options)
return __perform__(request, options) unless webmock_enabled?
WebMockPerform.new(request, options) { __perform__(request, options) }.exec
end
def webmock_enabled?
... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/http_lib_adapters/http_rb/request.rb | lib/webmock/http_lib_adapters/http_rb/request.rb | # frozen_string_literal: true
module HTTP
class Request
def webmock_signature
request_body = nil
if defined?(HTTP::Request::Body)
request_body = String.new
first_chunk_encoding = nil
body.each do |part|
request_body << part
first_chunk_encoding ||= part.en... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
bblimke/webmock | https://github.com/bblimke/webmock/blob/8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca/lib/webmock/http_lib_adapters/http_rb/webmock.rb | lib/webmock/http_lib_adapters/http_rb/webmock.rb | # frozen_string_literal: true
module HTTP
class WebMockPerform
def initialize(request, options, &perform)
@request = request
@options = options
@perform = perform
@request_signature = nil
end
def exec
replay || perform || halt
end
def request_signature
unless... | ruby | MIT | 8c7cb8a968b90bf44c69fbda75cc184a5bfc89ca | 2026-01-04T15:47:36.658111Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/.git-hooks/pre_commit/master_hooks_match.rb | .git-hooks/pre_commit/master_hooks_match.rb | # frozen_string_literal: true
require 'fileutils'
module Overcommit::Hook::PreCommit
# Ensures all master hooks have the same content.
#
# This is necessary because we can't use symlinks to link all the hooks in the
# template directory to the master `overcommit-hook` file, since symlinks are
# not supporte... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require 'bundler'
require 'simplecov'
SimpleCov.start do
add_filter 'bin/'
add_filter 'libexec/'
add_filter 'spec/'
add_filter 'template-dir/'
if ENV['CI']
require 'simplecov-lcov'
SimpleCov::Formatter::LcovFormatter.config do |c|
c.report_with_single_file = true... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/support/output_helpers.rb | spec/support/output_helpers.rb | # frozen_string_literal: true
# Helpers for capturing output streams in tests.
module OutputHelpers
module_function
def capture_stdout
original = $stdout
$stdout = output = StringIO.new
yield
output.string
ensure
$stdout = original
end
end
| ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/support/git_spec_helpers.rb | spec/support/git_spec_helpers.rb | # frozen_string_literal: true
require 'tmpdir'
# Helpers for creating temporary repositories and directories for testing.
module GitSpecHelpers
module_function
# Creates an empty git repository, allowing you to execute a block where
# the current working directory is set to that repository's root directory.
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/support/normalize_indent.rb | spec/support/normalize_indent.rb | # frozen_string_literal: true
# Strips off excess leading indentation from each line so we can use Heredocs
# for writing code without having the leading indentation count.
module IndentNormalizer
def normalize_indent(code)
leading_indent = code[/^(\s*)/, 1]
code.lstrip.gsub(/\n#{leading_indent}/, "\n")
en... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/support/shell_helpers.rb | spec/support/shell_helpers.rb | # frozen_string_literal: true
require 'timeout'
require 'overcommit/subprocess'
# Helpers for executing shell commands in tests.
module ShellHelpers
def shell(command)
Overcommit::Subprocess.spawn(command)
end
def symlink(source, dest)
Overcommit::Utils::FileUtils.symlink(source, dest)
end
def tou... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/support/matchers/hook.rb | spec/support/matchers/hook.rb | # frozen_string_literal: true
# General spec matcher logic for checking hook status and output.
class HookMatcher
def initialize(status, args)
options = args.empty? ? {} : { message: args.first }
@expected_status = status
@expected_message = options[:message]
end
def matches?(check)
result = [ch... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/integration/installing_overcommit_spec.rb | spec/integration/installing_overcommit_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe 'installing Overcommit' do
let(:enable_verification) { true }
it 'signs the configuration file' do
repo do
`overcommit --install`
touch('some-file')
`git add some-file`
result = shell(%w[git commit --allow-empty -m Test])
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/integration/resolving_cherry_pick_conflict_spec.rb | spec/integration/resolving_cherry_pick_conflict_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe 'resolving cherry-pick conflicts' do
subject { shell(%w[git commit -m Test -i some-file]) }
let(:config) { <<-YML }
PreCommit:
TrailingWhitespace:
enabled: true
YML
around do |example|
repo do
File.open('.overcommit.yml... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/integration/hook_signing_spec.rb | spec/integration/hook_signing_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'yaml'
describe 'hook signing' do
let(:enable_verification) { true }
let(:fake_hook_config) do
{
'enabled' => true,
'requires_files' => false,
'required_executable' => script_path,
}
end
let(:script_path) do
Overcommit:... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/integration/run_flag_spec.rb | spec/integration/run_flag_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe 'overcommit --run' do
subject { shell(%w[overcommit --run]) }
context 'when using an existing pre-commit hook script' do
if Overcommit::OS.windows?
let(:script_name) { 'test-script.bat' }
let(:script_contents) { 'exit 0' }
else
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/integration/protected_branches_spec.rb | spec/integration/protected_branches_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Hook::PrePush::ProtectedBranches,
if: Overcommit::GIT_VERSION >= '2.0' do
let(:flags) { '' }
let(:pushed_ref) { remote_ref }
subject do
shell("git push #{flags} origin #{pushed_ref}:#{remote_ref}".split)
end
let(:config) ... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/integration/template_dir_spec.rb | spec/integration/template_dir_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'fileutils'
describe 'template directory' do
let(:template_dir) { File.join(Overcommit::HOME, 'template-dir') }
let(:hooks_dir) { File.join(template_dir, 'hooks') }
it 'contains a hooks directory' do
File.directory?(hooks_dir).should == true
end... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/integration/gemfile_option_spec.rb | spec/integration/gemfile_option_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe 'specifying `gemfile` option in Overcommit configuration' do
context 'given a project that uses a Gemfile' do
let(:repo_root) { File.expand_path(File.join('..', '..'), File.dirname(__FILE__)) }
let(:fake_gem_path) { File.join('lib', 'my_fake_gem')... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/integration/disable_overcommit_spec.rb | spec/integration/disable_overcommit_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe 'disabling Overcommit' do
subject { shell(%w[git commit --allow-empty -m Test]) }
around do |example|
repo do
`overcommit --install > #{File::NULL}`
Overcommit::Utils.with_environment('OVERCOMMIT_DISABLE' => overcommit_disable) do
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/integration/diff_flag_spec.rb | spec/integration/diff_flag_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe 'overcommit --diff' do
subject { shell(%w[overcommit --diff main]) }
context 'when using an existing pre-commit hook script' do
let(:script_name) { 'test-script' }
let(:script_contents) { "#!/bin/bash\nexit 0" }
let(:script_path) { ".#{Over... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/integration/configuration_signing_spec.rb | spec/integration/configuration_signing_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'yaml'
describe 'configuration file signing' do
let(:enable_verification) { true }
let(:new_verify_signatures) { verify_signatures }
let(:config) do
{
'verify_signatures' => verify_signatures,
'CommitMsg' => {
'ALL' => { 'enabl... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/integration/parallelize_spec.rb | spec/integration/parallelize_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'timeout'
describe 'running a hook with parallelism disabled' do
subject { shell(%w[git commit --allow-empty -m Test]) }
let(:config) { <<-YML }
concurrency: 20
CommitMsg:
TrailingPeriod:
enabled: true
parallelize: false
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/integration/committing_spec.rb | spec/integration/committing_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe 'commiting' do
subject { shell(%w[git commit --allow-empty -m Test]) }
let(:config) { <<-YML }
CommitMsg:
ALL:
enabled: false
PreCommit:
ALL:
enabled: false
AuthorName:
enabled: true
YML
around do ... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/integration/resolving_merge_conflict_spec.rb | spec/integration/resolving_merge_conflict_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe 'resolving merge conflicts' do
subject { shell(%w[git commit -m Test -i some-file]) }
around do |example|
repo do
echo('Master', 'some-file')
`git add some-file`
`git commit -m "Add some-file"`
`git checkout -q -b branch1`
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/configuration_loader_spec.rb | spec/overcommit/configuration_loader_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::ConfigurationLoader do
let(:output) { StringIO.new }
let(:logger) { Overcommit::Logger.new(output) }
describe '#load_repo_config' do
subject { described_class.new(logger).load_repo_config }
context 'when repo does not contain a c... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/configuration_validator_spec.rb | spec/overcommit/configuration_validator_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::ConfigurationValidator do
let(:output) { StringIO.new }
let(:logger) { Overcommit::Logger.new(output) }
let(:options) { { logger: logger } }
let(:config) { Overcommit::Configuration.new(config_hash, validate: false) }
subject { descri... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/configuration_spec.rb | spec/overcommit/configuration_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Configuration do
let(:hash) { {} }
let(:config) { described_class.new(hash) }
describe '#new' do
let(:internal_hash) { config.instance_variable_get(:@hash) }
subject { config }
context 'when no configuration exists for a hook... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/command_splitter_spec.rb | spec/overcommit/command_splitter_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::CommandSplitter do
describe '.execute' do
let(:args_prefix) { %w[cmd] }
let(:max_command_length) { 10 }
let(:options) { { args: splittable_args } }
subject { described_class.execute(args_prefix, options) }
before do
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/git_repo_spec.rb | spec/overcommit/git_repo_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::GitRepo do
describe '.submodule_statuses' do
let(:options) { {} }
subject { described_class.submodule_statuses(options) }
context 'when repo contains no submodules' do
around do |example|
repo do
example.ru... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/hook_signer_spec.rb | spec/overcommit/hook_signer_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::HookSigner do
describe '#signature_changed?' do
let(:config) { double('config') }
let(:context) { double('context') }
let(:signer) do
described_class.new('.git-hooks/pre_commit/some_path.rb', config, context)
end
le... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/utils_spec.rb | spec/overcommit/utils_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'securerandom'
describe Overcommit::Utils do
describe '.script_path' do
subject { described_class.script_path('some-script') }
it 'points to the libexec scripts directory' do
subject.should end_with File.join('libexec', 'some-script')
en... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/cli_spec.rb | spec/overcommit/cli_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'overcommit/cli'
require 'overcommit/hook_context/diff'
require 'overcommit/hook_context/run_all'
describe Overcommit::CLI do
describe '#run' do
let(:logger) { Overcommit::Logger.silent }
let(:input) { double('input') }
let(:cli) { described_cl... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/default_configuration_spec.rb | spec/overcommit/default_configuration_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe 'default configuration' do
default_config =
begin
YAML.load_file(Overcommit::ConfigurationLoader::DEFAULT_CONFIG_PATH, aliases: true).to_hash
rescue ArgumentError
YAML.load_file(Overcommit::ConfigurationLoader::DEFAULT_CONFIG_PATH).to_... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/logger_spec.rb | spec/overcommit/logger_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Logger do
let(:io) { StringIO.new }
let(:output) { io.string }
subject { described_class.new(io) }
describe '.silent' do
subject { described_class.silent }
it 'does not output anything' do
capture_stdout { subject.log('So... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/git_config_spec.rb | spec/overcommit/git_config_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::GitConfig do
describe '.comment_character' do
subject { described_class.comment_character }
context 'with no configuration' do
it 'should be "#"' do
repo do
`git config --local core.commentchar ""`
ex... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/installer_spec.rb | spec/overcommit/installer_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Installer do
let(:logger) { Overcommit::Logger.silent }
let(:installer) { described_class.new(logger) }
def hook_files_installed?(hooks_dir)
Overcommit::Utils.supported_hook_types.all? do |hook_type|
hook_file = File.join(hooks_... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/message_processor_spec.rb | spec/overcommit/message_processor_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::MessageProcessor do
# Shorthand to make writing these tests a little more sane
EMH = Overcommit::MessageProcessor::ERRORS_MODIFIED_HEADER + "\n"
WMH = Overcommit::MessageProcessor::WARNINGS_MODIFIED_HEADER + "\n"
EUH = Overcommit::Messag... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/hook/base_spec.rb | spec/overcommit/hook/base_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Hook::Base do
let(:config) { double('config') }
let(:context) { double('context') }
let(:hook) { described_class.new(config, context) }
describe '#run_and_transform' do
let(:var_name) { 'OVERCOMMIT_TEST_HOOK_VAR' }
let(:hook_con... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/hook/post_rewrite/yarn_install_spec.rb | spec/overcommit/hook/post_rewrite/yarn_install_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Hook::PostRewrite::YarnInstall do
let(:config) { Overcommit::ConfigurationLoader.default_configuration }
let(:context) { double('context') }
subject { described_class.new(config, context) }
let(:result) { double('result') }
before d... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/hook/post_rewrite/index_tags_spec.rb | spec/overcommit/hook/post_rewrite/index_tags_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Hook::PostMerge::IndexTags do
let(:config) { Overcommit::ConfigurationLoader.default_configuration }
let(:context) { double('context') }
subject { described_class.new(config, context) }
before do
subject.stub(:execute_in_background... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/hook/post_rewrite/bundle_install_spec.rb | spec/overcommit/hook/post_rewrite/bundle_install_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Hook::PostRewrite::BundleInstall do
let(:config) { Overcommit::ConfigurationLoader.default_configuration }
let(:context) { double('context') }
subject { described_class.new(config, context) }
let(:result) { double('result') }
before... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/hook/post_rewrite/composer_install_spec.rb | spec/overcommit/hook/post_rewrite/composer_install_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Hook::PostRewrite::ComposerInstall do
let(:config) { Overcommit::ConfigurationLoader.default_configuration }
let(:context) { double('context') }
subject { described_class.new(config, context) }
let(:result) { double('result') }
befo... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/hook/post_rewrite/bower_install_spec.rb | spec/overcommit/hook/post_rewrite/bower_install_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Hook::PostRewrite::BowerInstall do
let(:config) { Overcommit::ConfigurationLoader.default_configuration }
let(:context) { double('context') }
subject { described_class.new(config, context) }
let(:result) { double('result') }
before ... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/hook/post_rewrite/submodule_status_spec.rb | spec/overcommit/hook/post_rewrite/submodule_status_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Hook::PostRewrite::SubmoduleStatus do
let(:config) { Overcommit::ConfigurationLoader.default_configuration }
let(:context) { double('context') }
subject { described_class.new(config, context) }
let(:submodule_status) { double('submodul... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/hook/post_rewrite/npm_install_spec.rb | spec/overcommit/hook/post_rewrite/npm_install_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Hook::PostRewrite::NpmInstall do
let(:config) { Overcommit::ConfigurationLoader.default_configuration }
let(:context) { double('context') }
subject { described_class.new(config, context) }
let(:result) { double('result') }
before do... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/hook/post_merge/yarn_install_spec.rb | spec/overcommit/hook/post_merge/yarn_install_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Hook::PostMerge::YarnInstall do
let(:config) { Overcommit::ConfigurationLoader.default_configuration }
let(:context) { double('context') }
subject { described_class.new(config, context) }
let(:result) { double('result') }
before do
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/hook/post_merge/index_tags_spec.rb | spec/overcommit/hook/post_merge/index_tags_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Hook::PostMerge::IndexTags do
let(:config) { Overcommit::ConfigurationLoader.default_configuration }
let(:context) { double('context') }
subject { described_class.new(config, context) }
before do
subject.stub(:execute_in_background... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/hook/post_merge/bundle_install_spec.rb | spec/overcommit/hook/post_merge/bundle_install_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Hook::PostMerge::BundleInstall do
let(:config) { Overcommit::ConfigurationLoader.default_configuration }
let(:context) { double('context') }
subject { described_class.new(config, context) }
let(:result) { double('result') }
before d... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/hook/post_merge/composer_install_spec.rb | spec/overcommit/hook/post_merge/composer_install_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Hook::PostMerge::ComposerInstall do
let(:config) { Overcommit::ConfigurationLoader.default_configuration }
let(:context) { double('context') }
subject { described_class.new(config, context) }
let(:result) { double('result') }
before... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/hook/post_merge/bower_install_spec.rb | spec/overcommit/hook/post_merge/bower_install_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Hook::PostMerge::BowerInstall do
let(:config) { Overcommit::ConfigurationLoader.default_configuration }
let(:context) { double('context') }
subject { described_class.new(config, context) }
let(:result) { double('result') }
before do... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/hook/post_merge/submodule_status_spec.rb | spec/overcommit/hook/post_merge/submodule_status_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Hook::PostMerge::SubmoduleStatus do
let(:config) { Overcommit::ConfigurationLoader.default_configuration }
let(:context) { double('context') }
subject { described_class.new(config, context) }
let(:submodule_status) { double('submodule_... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/hook/post_merge/npm_install_spec.rb | spec/overcommit/hook/post_merge/npm_install_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Hook::PostMerge::NpmInstall do
let(:config) { Overcommit::ConfigurationLoader.default_configuration }
let(:context) { double('context') }
subject { described_class.new(config, context) }
let(:result) { double('result') }
before do
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/hook/commit_msg/trailing_period_spec.rb | spec/overcommit/hook/commit_msg/trailing_period_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Hook::CommitMsg::TrailingPeriod do
let(:config) { Overcommit::ConfigurationLoader.default_configuration }
let(:context) { double('context') }
subject { described_class.new(config, context) }
before do
context.stub(:commit_message_l... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/hook/commit_msg/spell_check_spec.rb | spec/overcommit/hook/commit_msg/spell_check_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Hook::CommitMsg::SpellCheck do
let(:config) { Overcommit::ConfigurationLoader.default_configuration }
let(:context) { double('context') }
subject { described_class.new(config, context) }
before do
subject.stub(:uncommented_commit_m... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/spec/overcommit/hook/commit_msg/gerrit_change_id_spec.rb | spec/overcommit/hook/commit_msg/gerrit_change_id_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Hook::CommitMsg::GerritChangeId do
let(:config) { Overcommit::ConfigurationLoader.default_configuration }
let(:context) { double('context') }
subject { described_class.new(config, context) }
let(:commit_msg_file) { Tempfile.new('commit-... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.