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
infosimples/deathbycaptcha
https://github.com/infosimples/deathbycaptcha/blob/888ad2b25ef2c90796a6d5ff2f24b6e54063b0e0/lib/deathbycaptcha/version.rb
lib/deathbycaptcha/version.rb
module DeathByCaptcha VERSION = "6.0.0" API_VERSION = "DBC/Ruby v#{VERSION}" end
ruby
MIT
888ad2b25ef2c90796a6d5ff2f24b6e54063b0e0
2026-01-04T17:38:58.878868Z
false
infosimples/deathbycaptcha
https://github.com/infosimples/deathbycaptcha/blob/888ad2b25ef2c90796a6d5ff2f24b6e54063b0e0/lib/deathbycaptcha/exceptions.rb
lib/deathbycaptcha/exceptions.rb
module DeathByCaptcha # This is the base DeathByCaptcha exception class. Rescue it if you want to # catch any exception that might be raised. # class Error < Exception end class InvalidClientConnection < Error def initialize super('You have specified an invalid client connection (valid connectio...
ruby
MIT
888ad2b25ef2c90796a6d5ff2f24b6e54063b0e0
2026-01-04T17:38:58.878868Z
false
infosimples/deathbycaptcha
https://github.com/infosimples/deathbycaptcha/blob/888ad2b25ef2c90796a6d5ff2f24b6e54063b0e0/lib/deathbycaptcha/models.rb
lib/deathbycaptcha/models.rb
module DeathByCaptcha # Base class of a model object returned by DeathByCaptcha API. # class Model def initialize(values = {}) values.each do |key, value| self.send("#{key}=", value) if self.respond_to?("#{key}=") end end end end require 'deathbycaptcha/models/captcha' require 'dea...
ruby
MIT
888ad2b25ef2c90796a6d5ff2f24b6e54063b0e0
2026-01-04T17:38:58.878868Z
false
infosimples/deathbycaptcha
https://github.com/infosimples/deathbycaptcha/blob/888ad2b25ef2c90796a6d5ff2f24b6e54063b0e0/lib/deathbycaptcha/client.rb
lib/deathbycaptcha/client.rb
module DeathByCaptcha # Create a DeathByCaptcha API client. This is a shortcut to # DeathByCaptcha::Client.create. # def self.new(*args) DeathByCaptcha::Client.create(*args) end # DeathByCaptcha::Client is a common interface inherited by DBC clients like # DeathByCaptcha::Client::HTTP and DeathByCap...
ruby
MIT
888ad2b25ef2c90796a6d5ff2f24b6e54063b0e0
2026-01-04T17:38:58.878868Z
false
infosimples/deathbycaptcha
https://github.com/infosimples/deathbycaptcha/blob/888ad2b25ef2c90796a6d5ff2f24b6e54063b0e0/lib/deathbycaptcha/patches.rb
lib/deathbycaptcha/patches.rb
# Patches are added so older versions of Ruby work with this gem # unless ''.respond_to?(:empty?) class String def empty? self.length == 0 end end end
ruby
MIT
888ad2b25ef2c90796a6d5ff2f24b6e54063b0e0
2026-01-04T17:38:58.878868Z
false
infosimples/deathbycaptcha
https://github.com/infosimples/deathbycaptcha/blob/888ad2b25ef2c90796a6d5ff2f24b6e54063b0e0/lib/deathbycaptcha/models/server_status.rb
lib/deathbycaptcha/models/server_status.rb
module DeathByCaptcha # Model of a server status returned by DeathByCaptcha API. # class ServerStatus < DeathByCaptcha::Model attr_accessor :todays_accuracy, :solved_in, :is_service_overloaded def todays_accuracy=(value) @todays_accuracy = value.to_f end def solved_in=(value) @solve...
ruby
MIT
888ad2b25ef2c90796a6d5ff2f24b6e54063b0e0
2026-01-04T17:38:58.878868Z
false
infosimples/deathbycaptcha
https://github.com/infosimples/deathbycaptcha/blob/888ad2b25ef2c90796a6d5ff2f24b6e54063b0e0/lib/deathbycaptcha/models/captcha.rb
lib/deathbycaptcha/models/captcha.rb
module DeathByCaptcha # Model of a Captcha returned by DeathByCaptcha API. # class Captcha < DeathByCaptcha::Model attr_accessor :captcha, :is_correct, :text def id @captcha end def is_correct=(value) @is_correct = ['1', true].include?(value) end def captcha=(value) @...
ruby
MIT
888ad2b25ef2c90796a6d5ff2f24b6e54063b0e0
2026-01-04T17:38:58.878868Z
false
infosimples/deathbycaptcha
https://github.com/infosimples/deathbycaptcha/blob/888ad2b25ef2c90796a6d5ff2f24b6e54063b0e0/lib/deathbycaptcha/models/user.rb
lib/deathbycaptcha/models/user.rb
module DeathByCaptcha # Model of a User returned by DeathByCaptcha API. # class User < DeathByCaptcha::Model attr_accessor :is_banned, :balance, :rate, :user def id @user end def is_banned=(value) @is_banned = ['1', true].include?(value) end def balance=(value) @balan...
ruby
MIT
888ad2b25ef2c90796a6d5ff2f24b6e54063b0e0
2026-01-04T17:38:58.878868Z
false
infosimples/deathbycaptcha
https://github.com/infosimples/deathbycaptcha/blob/888ad2b25ef2c90796a6d5ff2f24b6e54063b0e0/lib/deathbycaptcha/client/socket.rb
lib/deathbycaptcha/client/socket.rb
module DeathByCaptcha # Socket client for DeathByCaptcha API. # class Client::Socket < Client PORTS = (8123..8130).to_a # Retrieve information from an uploaded captcha. # # @param [Integer] captcha_id Numeric ID of the captcha. # # @return [DeathByCaptcha::Captcha] The captcha object. ...
ruby
MIT
888ad2b25ef2c90796a6d5ff2f24b6e54063b0e0
2026-01-04T17:38:58.878868Z
false
infosimples/deathbycaptcha
https://github.com/infosimples/deathbycaptcha/blob/888ad2b25ef2c90796a6d5ff2f24b6e54063b0e0/lib/deathbycaptcha/client/http.rb
lib/deathbycaptcha/client/http.rb
module DeathByCaptcha # HTTP client for DeathByCaptcha API. # class Client::HTTP < Client # Retrieve information from an uploaded captcha. # # @param [Integer] captcha_id Numeric ID of the captcha. # # @return [DeathByCaptcha::Captcha] The captcha object. # def captcha(captcha_id) ...
ruby
MIT
888ad2b25ef2c90796a6d5ff2f24b6e54063b0e0
2026-01-04T17:38:58.878868Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/spec/spec_helper.rb
spec/spec_helper.rb
require 'coveralls' Coveralls.wear! require 'possible_email' RSpec.configure do |config| config.before do allow(PossibleEmail::ResponseGetter).to receive(:request_url) do JSON.parse(File.read(File.expand_path('spec/fixtures/rapportive_example_data.json'))) end end end
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/spec/PossibleEmail/possible_email_spec.rb
spec/PossibleEmail/possible_email_spec.rb
require 'spec_helper' describe PossibleEmail do describe '.search' do let(:find_any_email_search) { PossibleEmail.search('kevin', 'rose', 'gmail.com') } context 'when only one domain is given' do it 'returns an Response of Profiles' do expect(find_any_email_search).to be_instance_of(PossibleEm...
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/spec/PossibleEmail/possible_email/response_spec.rb
spec/PossibleEmail/possible_email/response_spec.rb
require 'spec_helper' describe PossibleEmail::Response do let(:response) { PossibleEmail.search('kevin', 'rose', 'gmail.com') } it 'returns an instance of Response' do expect(response).to be_instance_of(PossibleEmail::Response) end it 'returns entries' do expect(response.first).to be_instance_of(Poss...
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/spec/PossibleEmail/possible_email/rapportive_requester_spec.rb
spec/PossibleEmail/possible_email/rapportive_requester_spec.rb
require 'spec_helper' describe PossibleEmail::RapportiveRequester do describe '.request' do context 'when one email is passed in' do let(:rapportive_requester) { PossibleEmail::RapportiveRequester.request('bob@gmail.com') } it 'does not return an error' do expect { rapportive_requester }.no...
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/spec/PossibleEmail/possible_email/response_getter_spec.rb
spec/PossibleEmail/possible_email/response_getter_spec.rb
require 'spec_helper' describe PossibleEmail::ResponseGetter do describe '.create_session_token' do context 'when valid response' do it 'returns a session token' do expect(PossibleEmail::ResponseGetter.create_session_token('bob@gmail.com')).to be_instance_of(String) end end context ...
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/spec/PossibleEmail/possible_email/permutator_spec.rb
spec/PossibleEmail/possible_email/permutator_spec.rb
require 'spec_helper' describe PossibleEmail::Permutator do describe '.call' do context 'when one domain is given' do let(:permutations) { PossibleEmail::Permutator.call('kevin', 'rose', 'gmail.com') } it 'returns an array' do expect(permutations).to be_instance_of(Array) end ...
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/spec/PossibleEmail/possible_email/profile/phone_spec.rb
spec/PossibleEmail/possible_email/profile/phone_spec.rb
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/spec/PossibleEmail/possible_email/profile/membership_spec.rb
spec/PossibleEmail/possible_email/profile/membership_spec.rb
require 'spec_helper' describe PossibleEmail::Membership do let(:membership) do PossibleEmail::Membership.new('profile_url' => 'http://www.facebook.com/profile', 'profile_id' => '1234', 'username' => 'profile', 'si...
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/spec/PossibleEmail/possible_email/profile/occupation_spec.rb
spec/PossibleEmail/possible_email/profile/occupation_spec.rb
require 'spec_helper' describe PossibleEmail::Occupation do let(:occupation) do PossibleEmail::Occupation.new('job_title' => 'entrepreneur', 'company' => 'startup') end it 'returns the associated job_title' do expect(occupation.job_title).to eq('entrepreneur') end it 'returns the associated company...
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/spec/PossibleEmail/possible_email/profile/profile_spec.rb
spec/PossibleEmail/possible_email/profile/profile_spec.rb
require 'spec_helper' describe PossibleEmail::Profile do let(:data) { JSON.parse(File.read(File.expand_path('spec/fixtures/rapportive_example_data.json'))) } let(:profile) { PossibleEmail::Profile.new(data) } it 'returns an error if no data is given' do expect { PossibleEmail::Profile.new({}) }.to raise_err...
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/spec/PossibleEmail/possible_email/profile/image_spec.rb
spec/PossibleEmail/possible_email/profile/image_spec.rb
require 'spec_helper' describe PossibleEmail::Image do let(:image) do PossibleEmail::Image.new('url' => 'image_url', 'service' => 'Facebook', 'url_proxied' => 'url_proxied') end it 'returns the associated url' do expect(image....
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/lib/possible_email.rb
lib/possible_email.rb
require 'possible_email/error' require 'possible_email/version' require 'possible_email/permutator' require 'possible_email/rapportive_requester' require 'httpi' require 'json' HTTPI.log = false EMAIL_REGEX = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i DOMAIN_REGEX = /^([\w\-]+\.)+([\w]{2,})$/ NAME_REGEX = /^\b[a-zA-...
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/lib/possible_email/version.rb
lib/possible_email/version.rb
module PossibleEmail VERSION = "0.0.3" end
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/lib/possible_email/patterns.rb
lib/possible_email/patterns.rb
PATTERNS = <<PATTERNS {first_name}@{domain} {last_name}@{domain} {first_initial}@{domain} {last_initial}@{domain} {first_name}{last_name}@{domain} {first_name}.{last_name}@{domain} {first_initial}{last_name}@{domain} {first_initial}.{last_name}@{domain} {first_name}{last_initial}@{domain} {first_name}.{last_initial}@{d...
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/lib/possible_email/response_getter.rb
lib/possible_email/response_getter.rb
STATUS_URL = 'https://rapportive.com/login_status?user_email=' PROFILE_URL = 'https://profiles.rapportive.com/contacts/email/' module PossibleEmail class ResponseGetter class << self def create_session_token(email) status_url = STATUS_URL + email response = request_url status_url v...
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/lib/possible_email/response.rb
lib/possible_email/response.rb
module PossibleEmail class Response include Enumerable def initialize(profiles) # remove nils created by ResponseGetter @profiles = profiles.compact end def each(&block) @profiles.each(&block) end def [](*args) @profiles[*args] end def method_missing(method,...
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/lib/possible_email/permutator.rb
lib/possible_email/permutator.rb
require 'possible_email/patterns' module PossibleEmail class Permutator def self.call(first_name, last_name, *domain) new(first_name, last_name, domain).call end def initialize(first_name, last_name, domain) @first_name = first_name @last_name = last_name @domain = domain.flatten...
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/lib/possible_email/cli.rb
lib/possible_email/cli.rb
require 'thor' module PossibleEmail class CLI < Thor # possible_email search desc 'search', 'Search for valid emails using first name, last name, and domain name' long_desc <<-LONGDESC Takes in a first name, last name, and domain name. Domain name can be a single domain like 'gmail.com', or multiple do...
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/lib/possible_email/error.rb
lib/possible_email/error.rb
module PossibleEmail end
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/lib/possible_email/rapportive_requester.rb
lib/possible_email/rapportive_requester.rb
require 'possible_email/response' require 'possible_email/response_getter' require 'possible_email/profile/profile' module PossibleEmail class RapportiveRequester def self.request(*emails) new(emails).request end def initialize(emails) @emails = emails.flatten end def request ...
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/lib/possible_email/profile/membership.rb
lib/possible_email/profile/membership.rb
module PossibleEmail class Membership attr_reader :profile_url, :profile_id, :username, :site_name def initialize(data) @profile_url = data['profile_url'] @profile_id = data['profile_id'] @username = data['username'] @site_name = data['site_name'] end end end
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/lib/possible_email/profile/occupation.rb
lib/possible_email/profile/occupation.rb
module PossibleEmail class Occupation attr_reader :job_title, :company def initialize(data) @job_title = data['job_title'] @company = data['company'] end end end
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/lib/possible_email/profile/profile.rb
lib/possible_email/profile/profile.rb
require 'possible_email/profile/membership' require 'possible_email/profile/occupation' require 'possible_email/profile/image' require 'possible_email/profile/phone' module PossibleEmail class NoDataError < ArgumentError; end class Profile attr_reader :data, :email, :name, :first_name, :last_name, :friendly_n...
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/lib/possible_email/profile/phone.rb
lib/possible_email/profile/phone.rb
module PossibleEmail class Phone end end
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
the4dpatrick/possible-email
https://github.com/the4dpatrick/possible-email/blob/15522b5f20a670d4a47029d4c6c1260ba7e79c03/lib/possible_email/profile/image.rb
lib/possible_email/profile/image.rb
module PossibleEmail class Image attr_reader :url, :service, :url_proxied def initialize(data) @url = data['url'] @service = data['service'] @url_proxied = data['url_proxied'] end end end
ruby
MIT
15522b5f20a670d4a47029d4c6c1260ba7e79c03
2026-01-04T17:39:01.900462Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/test/test_helper.rb
test/test_helper.rb
# frozen_string_literal: true require 'rubygems' require 'test/unit' require 'stringio' require 'timeout' $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib') require 'bane' require_relative 'bane/launchable_role_tests' IRRELEVANT_PORT = 4001 IRRELEVANT_BEHAVIOR = 'CloseImmediately' class FakeConnection < S...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/test/bane/naive_http_response_test.rb
test/bane/naive_http_response_test.rb
# frozen_string_literal: true require_relative '../test_helper' class NaiveHttpResponseTest < Test::Unit::TestCase IRRELEVANT_RESPONSE_CODE = "999" IRRELEVANT_RESPONSE_DESCRIPTION = "Irrelevant description" IRRELEVANT_CONTENT_TYPE = "irrelevant content type" IRRELEVANT_BODY = "irrelevant body" def test_sh...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/test/bane/bane_test.rb
test/bane/bane_test.rb
# frozen_string_literal: true require_relative '../test_helper' class BaneTest < Test::Unit::TestCase def test_includes_responders_and_servers_in_all_makeables all_names = Bane.find_makeables.keys assert all_names.include?('NeverRespond'), "Expected 'NeverRespond' responder to be in #{all_names}" asse...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/test/bane/fake_connection_test.rb
test/bane/fake_connection_test.rb
# frozen_string_literal: true require_relative '../test_helper' class FakeConnectionTest < Test::Unit::TestCase def setup @fake_connection = FakeConnection.new end def test_fake_connection_returns_nil_if_no_commands_to_read assert_nil @fake_connection.gets end def test_fake_connection_reports_whe...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/test/bane/launchable_role_tests.rb
test/bane/launchable_role_tests.rb
# frozen_string_literal: true module LaunchableRoleTests # Verify the contract required for Launcher def test_responds_to_start assert_respond_to(@object, :start) end def test_responds_to_stop assert_respond_to(@object, :stop) end def test_responds_to_join assert_respond_to(@object, :join) ...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/test/bane/arguments_parser_test.rb
test/bane/arguments_parser_test.rb
# frozen_string_literal: true require_relative '../test_helper' class ArgumentsParserTest < Test::Unit::TestCase include Bane # Parsing arguments (uses the isolated ArgumentsParser object) def test_parses_the_port config = parse(["3000", IRRELEVANT_BEHAVIOR]) assert_equal 3000, config.port end de...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/test/bane/extensions_test.rb
test/bane/extensions_test.rb
# frozen_string_literal: true require_relative '../test_helper' class ExtensionsTest < Test::Unit::TestCase def test_unqualified_name_removes_module_path assert_equal 'String', String.unqualified_name assert_equal 'NestedClass', TopModule::NestedClass.unqualified_name assert_equal 'DoublyNestedClass', T...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/test/bane/command_line_configuration_test.rb
test/bane/command_line_configuration_test.rb
# frozen_string_literal: true require_relative '../test_helper' require 'mocha/test_unit' class CommandLineConfigurationTest < Test::Unit::TestCase include Bane # Creation tests (uses a cluster of objects starting at the top-level CommandLineConfiguration) def test_creates_specified_makeable_on_given_port ...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/test/bane/acceptance_test.rb
test/bane/acceptance_test.rb
# frozen_string_literal: true require_relative '../test_helper' require 'mocha/test_unit' require 'net/http' class BaneAcceptanceTest < Test::Unit::TestCase include ServerTestHelpers TEST_PORT = 4000 def test_uses_specified_port_and_server run_server_with(TEST_PORT, Bane::Behaviors::Responders::FixedResp...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/test/bane/behaviors/responders/echo_response_test.rb
test/bane/behaviors/responders/echo_response_test.rb
# frozen_string_literal: true require_relative '../../../test_helper' class EchoResponseTest < Test::Unit::TestCase include Bane::Behaviors::Responders include BehaviorTestHelpers def test_returns_received_characters fake_connection.will_send("Hello, echo!") query_server(EchoResponse.new) assert...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/test/bane/behaviors/responders/newline_response_test.rb
test/bane/behaviors/responders/newline_response_test.rb
# frozen_string_literal: true require_relative '../../../test_helper' class NewlineResponseTest < Test::Unit::TestCase include Bane::Behaviors::Responders include BehaviorTestHelpers def test_sends_only_a_newline_character query_server(NewlineResponse.new) assert_equal "\n", response end end
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/test/bane/behaviors/responders/random_response_test.rb
test/bane/behaviors/responders/random_response_test.rb
# frozen_string_literal: true require_relative '../../../test_helper' class RandomResponseTest < Test::Unit::TestCase include Bane::Behaviors::Responders include BehaviorTestHelpers def test_sends_a_nonempty_response query_server(RandomResponse.new) assert (!response.empty?), "Should have served a no...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/test/bane/behaviors/responders/never_respond_test.rb
test/bane/behaviors/responders/never_respond_test.rb
# frozen_string_literal: true require_relative '../../../test_helper' class NeverRespondTest < Test::Unit::TestCase include Bane::Behaviors::Responders include BehaviorTestHelpers include ServerTestHelpers LONG_MESSAGE = 'x'*(1024*5) def test_does_not_send_a_response server = NeverRespond.new qu...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/test/bane/behaviors/responders/for_each_line_test.rb
test/bane/behaviors/responders/for_each_line_test.rb
# frozen_string_literal: true require_relative '../../../test_helper' require 'mocha/test_unit' class ForEachLineTest < Test::Unit::TestCase include Bane::Behaviors::Responders include BehaviorTestHelpers def test_reads_a_line_before_responding_with_parent_behavior server = SayHelloForEachLineBehavior.new...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/test/bane/behaviors/responders/close_after_pause_test.rb
test/bane/behaviors/responders/close_after_pause_test.rb
# frozen_string_literal: true require_relative '../../../test_helper' require 'mocha/test_unit' class CloseAfterPauseTest < Test::Unit::TestCase include Bane::Behaviors::Responders include BehaviorTestHelpers def test_sleeps_30_seconds_by_default server = CloseAfterPause.new server.expects(:sleep).wit...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/test/bane/behaviors/responders/http_refuse_all_credentials_test.rb
test/bane/behaviors/responders/http_refuse_all_credentials_test.rb
# frozen_string_literal: true require_relative '../../../test_helper' class HttpRefuseAllCredentialsTest < Test::Unit::TestCase include Bane::Behaviors::Responders include BehaviorTestHelpers def test_sends_401_response_code fake_connection.will_send("GET /some/irrelevant/path HTTP/1.1") server = Htt...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/test/bane/behaviors/responders/fixed_response_test.rb
test/bane/behaviors/responders/fixed_response_test.rb
# frozen_string_literal: true require_relative '../../../test_helper' class FixedResponseTest < Test::Unit::TestCase include Bane::Behaviors::Responders include BehaviorTestHelpers def test_sends_the_specified_message query_server(FixedResponse.new(message: "Test Message")) assert_equal "Test Message...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/test/bane/behaviors/responders/close_immediately_test.rb
test/bane/behaviors/responders/close_immediately_test.rb
# frozen_string_literal: true require_relative '../../../test_helper' class CloseImmediatelyTest < Test::Unit::TestCase include Bane::Behaviors::Responders include BehaviorTestHelpers def test_sends_no_response query_server(CloseImmediately.new) assert_empty_response end end
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/test/bane/behaviors/responders/slow_response_test.rb
test/bane/behaviors/responders/slow_response_test.rb
# frozen_string_literal: true require_relative '../../../test_helper' require 'mocha/test_unit' class SlowResponseTest < Test::Unit::TestCase include Bane::Behaviors::Responders include BehaviorTestHelpers def test_pauses_between_sending_each_character message = "Hi!" delay = 0.5 server = SlowRes...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/test/bane/behaviors/responders/deluge_response_test.rb
test/bane/behaviors/responders/deluge_response_test.rb
# frozen_string_literal: true require_relative '../../../test_helper' class DelugeResponseTest < Test::Unit::TestCase include Bane::Behaviors::Responders include BehaviorTestHelpers def test_sends_one_million_bytes_by_default query_server(DelugeResponse.new) assert_response_length 1_000_000 end ...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/test/bane/behaviors/servers/timeout_in_listen_queue_test.rb
test/bane/behaviors/servers/timeout_in_listen_queue_test.rb
# frozen_string_literal: true require_relative '../../../test_helper' require 'socket' class TimeoutInListenQueueTest < Test::Unit::TestCase include LaunchableRoleTests include ServerTestHelpers def setup @object = Bane::Behaviors::Servers::TimeoutInListenQueue.make(IRRELEVANT_PORT, Bane::Behaviors::Serve...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/test/bane/behaviors/servers/responder_server_test.rb
test/bane/behaviors/servers/responder_server_test.rb
# frozen_string_literal: true require_relative '../../../test_helper' require 'mocha/test_unit' class ResponderServerTest < Test::Unit::TestCase include LaunchableRoleTests include Bane include Bane::Behaviors::Servers IRRELEVANT_IO_STREAM = nil IRRELEVANT_OPTIONS = {} IRRELEVANT_HOST = '1.1.1.1' def...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/examples/single_behavior.rb
examples/single_behavior.rb
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib' require 'bane' include Bane include Behaviors # This example creates a single behavior listening on port 3000. # Note that the behavior, CloseAfterPause, specifies a default duration to pause - 60 seconds. behavior = Servers::ResponderServer.new(3000, Responders:...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/examples/multiple_behaviors.rb
examples/multiple_behaviors.rb
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib' require 'bane' include Bane include Behaviors # This example creates several behavior listening on distinct ports. # Note the FixedResponse port specifies to listen to all hosts (0.0.0.0), all # other servers listen to localhost only by default (127.0.0.1). close...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/examples/readme_example.rb
examples/readme_example.rb
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib' require 'bane' include Bane include Behaviors launcher = Launcher.new( [Servers::ResponderServer.new(3000, Responders::FixedResponse.new(message: "Shall we play a game?"))]) launcher.start launcher.join
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/lib/bane.rb
lib/bane.rb
# frozen_string_literal: true require 'bane/extensions' require 'bane/behavior_maker' require 'bane/behaviors/responders/for_each_line' require 'bane/behaviors/responders/close_after_pause' require 'bane/behaviors/responders/close_immediately' require 'bane/behaviors/responders/deluge_response' require 'bane/behaviors...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/lib/bane/version.rb
lib/bane/version.rb
# frozen_string_literal: true module Bane VERSION = '1.0.0' end
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/lib/bane/extensions.rb
lib/bane/extensions.rb
# frozen_string_literal: true unless Class.respond_to?(:unqualified_name) class Class def unqualified_name self.name.split("::").last end end end
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/lib/bane/arguments_parser.rb
lib/bane/arguments_parser.rb
# frozen_string_literal: true require 'optparse' module Bane class ArgumentsParser def initialize(makeable_names) @makeable_names = makeable_names @options = {host: default_host} @option_parser = init_option_parser end def parse(args) @option_parser.parse!(args) raise Con...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/lib/bane/command_line_configuration.rb
lib/bane/command_line_configuration.rb
# frozen_string_literal: true module Bane def self.find_makeables Hash[Bane::Behaviors::Responders::EXPORTED.map { |responder| [responder.unqualified_name, ResponderMaker.new(responder)] }] .merge(Hash[Bane::Behaviors::Servers::EXPORTED.map { |server| [server.unqualified_name, server] }]) end class Com...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/lib/bane/naive_http_response.rb
lib/bane/naive_http_response.rb
# frozen_string_literal: true class NaiveHttpResponse CRLF = "\r\n" class HttpHeader def initialize(headers) @headers = headers end def to_s @headers.map { |k, v| "#{k}: #{v}" }.join(CRLF) end end def initialize(response_code, response_description, content_type, body) ...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/lib/bane/behavior_maker.rb
lib/bane/behavior_maker.rb
# frozen_string_literal: true module Bane class BehaviorMaker def initialize(makeables) @makeables = makeables end def create(behavior_names, starting_port, host) behavior_names .map { |behavior| makeables.fetch(behavior) { raise UnknownBehaviorError.new(behavior) } } .map.w...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/lib/bane/launcher.rb
lib/bane/launcher.rb
# frozen_string_literal: true module Bane class Launcher def initialize(servers, logger = $stderr) @servers = servers @servers.each { |server| server.stdlog = logger } end def start @servers.each { |server| server.start } end def join @servers.each { |server| server.jo...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/lib/bane/behaviors/responders/deluge_response.rb
lib/bane/behaviors/responders/deluge_response.rb
# frozen_string_literal: true module Bane module Behaviors module Responders # Sends a large response. Response consists of a repeated 'x' character. # # Options # - length: The size in bytes of the response to send. Default: 1,000,000 bytes class DelugeResponse def initi...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/lib/bane/behaviors/responders/fixed_response.rb
lib/bane/behaviors/responders/fixed_response.rb
# frozen_string_literal: true module Bane module Behaviors module Responders # Sends a static response. # # Options: # - message: The response message to send. Default: "Hello, world!" class FixedResponse def initialize(options = {}) @options = {message: "Hello,...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/lib/bane/behaviors/responders/newline_response.rb
lib/bane/behaviors/responders/newline_response.rb
# frozen_string_literal: true module Bane module Behaviors module Responders # Sends a newline character as the only response class NewlineResponse def serve(io) io.write "\n" end end class NewlineResponseForEachLine < NewlineResponse include ForEachLin...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/lib/bane/behaviors/responders/close_after_pause.rb
lib/bane/behaviors/responders/close_after_pause.rb
# frozen_string_literal: true module Bane module Behaviors module Responders # Accepts a connection, pauses a fixed duration, then closes the connection. # # Options: # - duration: The number of seconds to wait before disconnect. Default: 30 class CloseAfterPause def ini...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/lib/bane/behaviors/responders/echo_response.rb
lib/bane/behaviors/responders/echo_response.rb
# frozen_string_literal: true module Bane module Behaviors module Responders class EchoResponse def serve(io) while (input = io.gets) io.write(input) end io.close end end end end end
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/lib/bane/behaviors/responders/random_response.rb
lib/bane/behaviors/responders/random_response.rb
# frozen_string_literal: true module Bane module Behaviors module Responders # Sends a random response. class RandomResponse def serve(io) io.write random_string end private def random_string (1..rand(26)+1).map { |i| ('a'..'z').to_a[rand(26)] }.j...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/lib/bane/behaviors/responders/slow_response.rb
lib/bane/behaviors/responders/slow_response.rb
# frozen_string_literal: true module Bane module Behaviors module Responders # Sends a fixed response character-by-character, pausing between each character. # # Options: # - message: The response to send. Default: "Hello, world!" # - pause_duration: The number of seconds to paus...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/lib/bane/behaviors/responders/exported.rb
lib/bane/behaviors/responders/exported.rb
# frozen_string_literal: true module Bane module Behaviors module Responders EXPORTED = self.constants.map { |name| self.const_get(name) }.grep(Class) end end end
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/lib/bane/behaviors/responders/for_each_line.rb
lib/bane/behaviors/responders/for_each_line.rb
# frozen_string_literal: true module Bane module Behaviors module Responders # This module can be used to wrap another behavior with # a "while(io.gets)" loop, which reads a line from the input and # then performs the given behavior. module ForEachLine def serve(io) whi...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/lib/bane/behaviors/responders/close_immediately.rb
lib/bane/behaviors/responders/close_immediately.rb
# frozen_string_literal: true module Bane module Behaviors module Responders # Closes the connection immediately after a connection is made. class CloseImmediately def serve(io) # do nothing end end end end end
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/lib/bane/behaviors/responders/http_refuse_all_credentials.rb
lib/bane/behaviors/responders/http_refuse_all_credentials.rb
# frozen_string_literal: true module Bane module Behaviors module Responders # Sends an HTTP 401 response (Unauthorized) for every request. This # attempts to mimic an HTTP server by reading a line (the request) # and then sending the response. This behavior responds to all # incoming ...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/lib/bane/behaviors/responders/never_respond.rb
lib/bane/behaviors/responders/never_respond.rb
# frozen_string_literal: true module Bane module Behaviors module Responders # Accepts a connection and never sends a byte of data. The connection is # left open indefinitely. class NeverRespond READ_TIMEOUT_IN_SECONDS = 2 MAXIMUM_BYTES_TO_READ = 4096 def serve(io) ...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/lib/bane/behaviors/servers/exported.rb
lib/bane/behaviors/servers/exported.rb
# frozen_string_literal: true module Bane module Behaviors module Servers EXPORTED = [TimeoutInListenQueue] # Listen only on localhost LOCALHOST = '127.0.0.1' # Deprecated - use LOCALHOST - Listen only on localhost DEFAULT_HOST = LOCALHOST # Listen on all interfaces ...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/lib/bane/behaviors/servers/timeout_in_listen_queue.rb
lib/bane/behaviors/servers/timeout_in_listen_queue.rb
# frozen_string_literal: true require 'socket' module Bane module Behaviors module Servers class TimeoutInListenQueue def initialize(port, host = Servers::LOCALHOST) @port = port @host = host self.stdlog= $stderr end def start @server = So...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
danielwellman/bane
https://github.com/danielwellman/bane/blob/96631be3c124c71facaef46331b28e40ac084b93/lib/bane/behaviors/servers/responder_server.rb
lib/bane/behaviors/servers/responder_server.rb
# frozen_string_literal: true require 'gserver' module Bane module Behaviors module Servers class ResponderServer < GServer def initialize(port, behavior, host = Servers::LOCALHOST) super(port, host) @behavior = behavior self.audit = true end def se...
ruby
BSD-2-Clause
96631be3c124c71facaef46331b28e40ac084b93
2026-01-04T17:39:04.088834Z
false
ryanb/mustard
https://github.com/ryanb/mustard/blob/559b418e5ed094d74ad7e305028597dfc7873674/minitest_test.rb
minitest_test.rb
require "rubygems" require "minitest/autorun" require "mustard" describe Mustard::Failure do it "inherits from MiniTest::Assertion" do (Mustard::Failure < MiniTest::Assertion).must.be_true end end
ruby
MIT
559b418e5ed094d74ad7e305028597dfc7873674
2026-01-04T17:39:04.476182Z
false
ryanb/mustard
https://github.com/ryanb/mustard/blob/559b418e5ed094d74ad7e305028597dfc7873674/spec/mustard_spec.rb
spec/mustard_spec.rb
require 'spec_helper' describe Mustard do it "fails when calling fail with message" do failure { fail } failure("something went wrong") { fail "something went wrong" } end it "raises an exception when match fails" do failure { 5.must.equal 4 } end it "raises an RSpec::Mustard::Failure exception...
ruby
MIT
559b418e5ed094d74ad7e305028597dfc7873674
2026-01-04T17:39:04.476182Z
false
ryanb/mustard
https://github.com/ryanb/mustard/blob/559b418e5ed094d74ad7e305028597dfc7873674/spec/spec_helper.rb
spec/spec_helper.rb
require 'rubygems' require 'bundler/setup' require 'mustard' RSpec.configure do |config| config.expect_with Mustard end
ruby
MIT
559b418e5ed094d74ad7e305028597dfc7873674
2026-01-04T17:39:04.476182Z
false
ryanb/mustard
https://github.com/ryanb/mustard/blob/559b418e5ed094d74ad7e305028597dfc7873674/lib/mustard.rb
lib/mustard.rb
require "mustard/version" require "mustard/object_extension" require "mustard/failure" require "mustard/must" require "mustard/matchers/default_matcher" require "mustard/matchers/be_matcher" require "mustard/matchers/close_matcher" require "mustard/matchers/have_matcher" module Mustard def self.matcher(*args, &block...
ruby
MIT
559b418e5ed094d74ad7e305028597dfc7873674
2026-01-04T17:39:04.476182Z
false
ryanb/mustard
https://github.com/ryanb/mustard/blob/559b418e5ed094d74ad7e305028597dfc7873674/lib/mustard/version.rb
lib/mustard/version.rb
module Mustard VERSION = "0.1.0" end
ruby
MIT
559b418e5ed094d74ad7e305028597dfc7873674
2026-01-04T17:39:04.476182Z
false
ryanb/mustard
https://github.com/ryanb/mustard/blob/559b418e5ed094d74ad7e305028597dfc7873674/lib/mustard/object_extension.rb
lib/mustard/object_extension.rb
module Mustard module ObjectExtension def must Must.new(self) end def must_not Must.new(self, true) end end end Object.send(:include, Mustard::ObjectExtension)
ruby
MIT
559b418e5ed094d74ad7e305028597dfc7873674
2026-01-04T17:39:04.476182Z
false
ryanb/mustard
https://github.com/ryanb/mustard/blob/559b418e5ed094d74ad7e305028597dfc7873674/lib/mustard/failure.rb
lib/mustard/failure.rb
module Mustard if defined?(MiniTest::Assertion) class Failure < MiniTest::Assertion; end elsif defined?(Test::Unit::AssertionFailedError) class Failure < Test::Unit::AssertionFailedError; end else class Failure < StandardError; end end end # Kind of silly but the failure class must start with "RSpe...
ruby
MIT
559b418e5ed094d74ad7e305028597dfc7873674
2026-01-04T17:39:04.476182Z
false
ryanb/mustard
https://github.com/ryanb/mustard/blob/559b418e5ed094d74ad7e305028597dfc7873674/lib/mustard/must.rb
lib/mustard/must.rb
module Mustard class Must def self.matcher(name, *other_names, &block) if block matcher_class = DefaultMatcher.subclass_for(name, block) else matcher_class = other_names.pop end define_method(name) do |*args| _assert matcher_class.new(@subject, *args) end ...
ruby
MIT
559b418e5ed094d74ad7e305028597dfc7873674
2026-01-04T17:39:04.476182Z
false
ryanb/mustard
https://github.com/ryanb/mustard/blob/559b418e5ed094d74ad7e305028597dfc7873674/lib/mustard/matchers/have_matcher.rb
lib/mustard/matchers/have_matcher.rb
module Mustard class HaveMatcher def initialize(subject, method, *args) @subject = subject @method = method @args = args end def match? @subject.send(@method, *@args) end def failure_message "expected #{@subject.inspect} to have #{message_action}" end def n...
ruby
MIT
559b418e5ed094d74ad7e305028597dfc7873674
2026-01-04T17:39:04.476182Z
false
ryanb/mustard
https://github.com/ryanb/mustard/blob/559b418e5ed094d74ad7e305028597dfc7873674/lib/mustard/matchers/default_matcher.rb
lib/mustard/matchers/default_matcher.rb
module Mustard class DefaultMatcher # This will genereate a subclass of DefaultMatcher to # act as the matcher class. This way we can persist the # name of the matcher and the block of behavior. def self.subclass_for(name, behavior) klass = Class.new(self) class << klass attr_acces...
ruby
MIT
559b418e5ed094d74ad7e305028597dfc7873674
2026-01-04T17:39:04.476182Z
false
ryanb/mustard
https://github.com/ryanb/mustard/blob/559b418e5ed094d74ad7e305028597dfc7873674/lib/mustard/matchers/close_matcher.rb
lib/mustard/matchers/close_matcher.rb
module Mustard class CloseMatcher def initialize(subject, expected, delta = 0.001) @subject = subject @expected = expected @delta = delta end def match? @delta >= (@subject - @expected).abs end def failure_message "expected #{@subject.inspect} to #{message_expected}...
ruby
MIT
559b418e5ed094d74ad7e305028597dfc7873674
2026-01-04T17:39:04.476182Z
false
ryanb/mustard
https://github.com/ryanb/mustard/blob/559b418e5ed094d74ad7e305028597dfc7873674/lib/mustard/matchers/be_matcher.rb
lib/mustard/matchers/be_matcher.rb
module Mustard class BeMatcher def initialize(subject, method, *args) @subject = subject @method = method @args = args end def match? @subject.send(@method, *@args) end def failure_message "expected #{@subject.inspect} to be #{message_action}" end def negat...
ruby
MIT
559b418e5ed094d74ad7e305028597dfc7873674
2026-01-04T17:39:04.476182Z
false
ostinelli/net-http2
https://github.com/ostinelli/net-http2/blob/87c96dd3da77adf2172458fb027abc0469122a7c/spec/spec_helper.rb
spec/spec_helper.rb
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'net-http2' require 'rspec' Dir[File.expand_path("../support/**/*.rb", __FILE__)].each { |f| require f } RSpec.configure do |config| config.order = :random config.include NetHttp2::ApiHelpers end
ruby
MIT
87c96dd3da77adf2172458fb027abc0469122a7c
2026-01-04T17:39:10.487005Z
false
ostinelli/net-http2
https://github.com/ostinelli/net-http2/blob/87c96dd3da77adf2172458fb027abc0469122a7c/spec/support/dummy_server.rb
spec/support/dummy_server.rb
module NetHttp2 module Dummy class Request attr_accessor :body attr_reader :headers def initialize @body = '' end def import_headers(h) @headers = Hash[*h.flatten] end end class Server DRAFT = 'h2' attr_accessor :on_req def initi...
ruby
MIT
87c96dd3da77adf2172458fb027abc0469122a7c
2026-01-04T17:39:10.487005Z
false
ostinelli/net-http2
https://github.com/ostinelli/net-http2/blob/87c96dd3da77adf2172458fb027abc0469122a7c/spec/support/api_helpers.rb
spec/support/api_helpers.rb
module NetHttp2 module ApiHelpers WAIT_INTERVAL = 1 def wait_for(seconds=2, &block) count = 1 / WAIT_INTERVAL (0..(count * seconds)).each do break if block.call sleep WAIT_INTERVAL end end end end
ruby
MIT
87c96dd3da77adf2172458fb027abc0469122a7c
2026-01-04T17:39:10.487005Z
false
ostinelli/net-http2
https://github.com/ostinelli/net-http2/blob/87c96dd3da77adf2172458fb027abc0469122a7c/spec/support/shared_examples/callbacks.rb
spec/support/shared_examples/callbacks.rb
shared_examples_for "a class that implements events subscription & emission" do |options={}| describe "Events subscription & emission" do [ :headers, :body_chunk, :close ].each do |event| it "subscribes and emits for event #{event}" do calls = [] subject.on(event) { c...
ruby
MIT
87c96dd3da77adf2172458fb027abc0469122a7c
2026-01-04T17:39:10.487005Z
false
ostinelli/net-http2
https://github.com/ostinelli/net-http2/blob/87c96dd3da77adf2172458fb027abc0469122a7c/spec/http2-client/response_spec.rb
spec/http2-client/response_spec.rb
require 'spec_helper' describe NetHttp2::Response do describe "attributes" do let(:headers) { double(:headers) } let(:body) { double(:body) } let(:response) { NetHttp2::Response.new(headers: headers, body: body) } subject { response } it { is_expected.to have_attributes(headers: headers) } ...
ruby
MIT
87c96dd3da77adf2172458fb027abc0469122a7c
2026-01-04T17:39:10.487005Z
false