source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/easy_factory.rb
Ruby
mit
4,132
master
5,980
# frozen_string_literal: true require 'set' module Typhoeus # This is a Factory for easies to be used in the hydra. # Before an easy is ready to be added to a multi the # on_complete callback to be set. # This is done by this class. # # @api private class EasyFactory RENAMED_OPTIONS = { ...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/hydra.rb
Ruby
mit
4,132
master
3,147
# frozen_string_literal: true require 'typhoeus/hydra/addable' require 'typhoeus/hydra/before' require 'typhoeus/hydra/cacheable' require 'typhoeus/hydra/block_connection' require 'typhoeus/hydra/memoizable' require 'typhoeus/hydra/queueable' require 'typhoeus/hydra/runnable' require 'typhoeus/hydra/stubbable' module...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/request.rb
Ruby
mit
4,132
master
6,395
# frozen_string_literal: true require 'zlib' require 'digest/sha1' require 'typhoeus/request/actions' require 'typhoeus/request/before' require 'typhoeus/request/block_connection' require 'typhoeus/request/cacheable' require 'typhoeus/request/callbacks' require 'typhoeus/request/marshal' require 'typhoeus/request/memo...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/response.rb
Ruby
mit
4,132
master
1,683
# frozen_string_literal: true require 'typhoeus/response/header' require 'typhoeus/response/informations' require 'typhoeus/response/status' require 'typhoeus/response/cacheable' module Typhoeus # This class represents the response. class Response include Response::Informations include Response::Status ...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/expectation.rb
Ruby
mit
4,132
master
5,936
# frozen_string_literal: true module Typhoeus # This class represents an expectation. It is part # of the stubbing mechanism. An expectation contains # a url and options, like a request. They are compared # to the request url and options in order to evaluate # whether they match. If that's the case, the att...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/config.rb
Ruby
mit
4,132
master
2,435
# frozen_string_literal: true module Typhoeus # The Typhoeus configuration used to set global # options. # @example Set the configuration options within a block. # Typhoeus.configure do |config| # config.verbose = true # end # # @example Set the configuration directly. # Typhoeus::Config.v...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/railtie.rb
Ruby
mit
4,132
master
326
# frozen_string_literal: true require "typhoeus" module Rails module Typhoeus class Railtie < Rails::Railtie # Need to include the Typhoeus middleware. initializer "include the identity map" do |app| app.config.middleware.use "Rack::Typhoeus::Middleware::ParamsDecoder" end end en...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/request/before.rb
Ruby
mit
4,132
master
824
# frozen_string_literal: true module Typhoeus class Request # This module provides a way to hook into before # a request runs. This is very powerful # and you should be careful because when you accidently # return a falsy value the request won't be executed. # # @api private module Befor...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/request/memoizable.rb
Ruby
mit
4,132
master
1,010
# frozen_string_literal: true module Typhoeus class Request # This module handles the GET request memoization # on the request side. Memoization needs to be turned # on: # Typhoeus.configure do |config| # config.memoize = true # end # # @api private module Memoizable ...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/request/block_connection.rb
Ruby
mit
4,132
master
1,373
# frozen_string_literal: true module Typhoeus class Request # This module handles the blocked connection request mode on # the request side, where only stubbed requests # are allowed. # Connection blocking needs to be turned on: # Typhoeus.configure do |config| # config.block_connectio...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/request/cacheable.rb
Ruby
mit
4,132
master
709
# frozen_string_literal: true module Typhoeus class Request module Cacheable def response=(response) cache.set(self, response) if cacheable? && !response.cached? super end def cacheable? cache end def run if response = cached_response resp...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/request/stubbable.rb
Ruby
mit
4,132
master
885
# frozen_string_literal: true module Typhoeus class Request # This module handles stubbing on the request side. # It plays well with the block_connection configuration, # which raises when you make a request which is not stubbed. # # @api private module Stubbable # Override run in ord...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/request/marshal.rb
Ruby
mit
4,132
master
725
# frozen_string_literal: true module Typhoeus class Request # This module contains custom serializer. module Marshal # Return the important data needed to serialize this Request, except the # request callbacks and `hydra`, since they cannot be marshalled. def marshal_dump unmarsha...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/request/streamable.rb
Ruby
mit
4,132
master
997
# frozen_string_literal: true module Typhoeus class Request # This module contians the logic for response streaming. module Streamable # Set on_body callback. # # This callback will be called each time a portion of the body is read from the socket. # Setting an on_body callback will...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/request/actions.rb
Ruby
mit
4,132
master
3,644
# frozen_string_literal: true module Typhoeus class Request # Module containing logic about shortcuts to # http methods. Like # Typhoeus.get("www.example.com") module Actions # Make a get request. # # @example Make get request. # Typhoeus.get("www.example.com") # ...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/request/operations.rb
Ruby
mit
4,132
master
1,068
# frozen_string_literal: true module Typhoeus class Request # This module contains everything what is necessary # to make a single request. module Operations # Run a request. # # @example Run a request. # Typhoeus::Request.new("www.example.com").run # # @return [ Re...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/request/callbacks.rb
Ruby
mit
4,132
master
4,451
# frozen_string_literal: true module Typhoeus class Request # This module contains the logic for the response callbacks. # # You can set multiple callbacks, which are then executed # in the same order. # # request.on_complete { |response| p 1 } # request.on_complete { |response| p 2 ...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/request/responseable.rb
Ruby
mit
4,132
master
620
# frozen_string_literal: true module Typhoeus class Request # This module contains logic for having a response # getter and setter. module Responseable # Set the response. # # @example Set response. # request.response = response # # @param [ Response ] value The res...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/errors/no_stub.rb
Ruby
mit
4,132
master
315
# frozen_string_literal: true module Typhoeus module Errors # Raises when block connection is turned on # and making a real request. class NoStub < TyphoeusError def initialize(request) super("The connection is blocked and no stub defined: #{request.url}") end end end end
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/adapters/faraday.rb
Ruby
mit
4,132
master
5,842
# frozen_string_literal: true require 'faraday' module Faraday # :nodoc: class Adapter # :nodoc: # Adapter to use Faraday with Typhoeus. # # @example Use Typhoeus. # require 'faraday' # require 'typhoeus' # require 'typhoeus/adapters/faraday' # # conn = Faraday.new(url: "www...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/response/header.rb
Ruby
mit
4,132
master
2,564
# frozen_string_literal: true require 'delegate' module Typhoeus class Response # This class represents the response header. # It can be accessed like a hash. # Values can be strings (normal case) or arrays of strings (for duplicates headers) # # @api private class Header < DelegateClass(Ha...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/response/informations.rb
Ruby
mit
4,132
master
9,382
# frozen_string_literal: true module Typhoeus class Response # This module contains logic about informations # on a response. module Informations # Return libcurls return value. # # @example Get return_code. # response.return_code # # @return [ Symbol ] The return_...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/response/cacheable.rb
Ruby
mit
4,132
master
302
# frozen_string_literal: true module Typhoeus class Response module Cacheable # Set the cache status, if we got response from cache # it will have cached? == true attr_writer :cached def cached? defined?(@cached) ? !!@cached : false end end end end
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/response/status.rb
Ruby
mit
4,132
master
3,336
# frozen_string_literal: true module Typhoeus class Response # This module contains logic about the http # status. module Status # Return the status message if present. # # @example Return status message. # reesponse.status_message # # @return [ String ] The messag...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/cache/dalli.rb
Ruby
mit
4,132
master
962
# frozen_string_literal: true module Typhoeus module Cache # This module provides a simple way to cache HTTP responses using Dalli. class Dalli # @example Set Dalli as the Typhoeus cache backend # Typhoeus::Config.cache = Typhoeus::Cache::Dalli.new # # @param [ Dalli::Client ] clien...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/cache/rails.rb
Ruby
mit
4,132
master
982
# frozen_string_literal: true module Typhoeus module Cache # This module provides a simple way to cache HTTP responses in using the Rails cache. class Rails # @example Use the Rails cache setup to cache Typhoeus responses. # Typhoeus::Config.cache = Typhoeus::Cache::Rails.new # # @p...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/cache/redis.rb
Ruby
mit
4,132
master
1,228
# frozen_string_literal: true module Typhoeus module Cache # This module provides a simple way to cache HTTP responses in Redis. class Redis # @example Set Redis as the Typhoeus cache backend # Typhoeus::Config.cache = Typhoeus::Cache::Redis.new # # @param [ Redis ] redis # ...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/hydra/block_connection.rb
Ruby
mit
4,132
master
919
# frozen_string_literal: true module Typhoeus class Hydra # This module handles the blocked connection request mode on # the hydra side, where only stubbed requests # are allowed. # Connection blocking needs to be turned on: # Typhoeus.configure do |config| # config.block_connection = ...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/hydra/queueable.rb
Ruby
mit
4,132
master
2,148
# frozen_string_literal: true module Typhoeus class Hydra # This module handles the request queueing on # hydra. # # @api private module Queueable # Return the queued requests. # # @example Return queued requests. # hydra.queued_requests # # @return [ Array...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/hydra/cacheable.rb
Ruby
mit
4,132
master
328
# frozen_string_literal: true module Typhoeus class Hydra module Cacheable def add(request) if request.cacheable? && response = request.cached_response response.cached = true request.finish(response) dequeue else super end end end ...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/hydra/stubbable.rb
Ruby
mit
4,132
master
866
# frozen_string_literal: true module Typhoeus class Hydra # This module handles stubbing on the hydra side. # It plays well with the block_connection configuration, # which raises when you make a request which is not stubbed. # # @api private module Stubbable # Override add in order t...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/hydra/before.rb
Ruby
mit
4,132
master
886
# frozen_string_literal: true module Typhoeus class Hydra # This module provides a way to hook into before # a request gets queued in hydra. This is very powerful # and you should be careful because when you accidently # return a falsy value the request won't be executed. # # @api private ...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/hydra/addable.rb
Ruby
mit
4,132
master
465
# frozen_string_literal: true module Typhoeus class Hydra # This module handles the request adding on # hydra. # # @api private module Addable # Adds request to multi. # # @example Add request. # hydra.add(request) # # @param [ Typhoeus::Request ] request t...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/hydra/memoizable.rb
Ruby
mit
4,132
master
1,360
# frozen_string_literal: true module Typhoeus class Hydra # This module handles the GET request memoization # on the hydra side. Memoization needs to be turned # on: # Typhoeus.configure do |config| # config.memoize = true # end # # @api private module Memoizable #...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
lib/typhoeus/hydra/runnable.rb
Ruby
mit
4,132
master
376
# frozen_string_literal: true module Typhoeus class Hydra # This module contains logic to run a hydra. module Runnable # Start the hydra run. # # @example Start hydra run. # hydra.run # # @return [ Symbol ] Return value from multi.perform. def run dequeue...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/spec_helper.rb
Ruby
mit
4,132
master
746
# frozen_string_literal: true $LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib")) require "bundler" Bundler.setup require "typhoeus" require "rspec" Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each { |f| require f } RSpec.configure do |config| ...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus_spec.rb
Ruby
mit
4,132
master
3,278
# frozen_string_literal: true require 'spec_helper' describe Typhoeus do before(:each) do Typhoeus.configure { |config| config.verbose = false; config.block_connection = false } end describe ".configure" do it "yields config" do Typhoeus.configure do |config| expect(config).to be_a(Typhoe...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/rack/typhoeus/middleware/params_decoder_spec.rb
Ruby
mit
4,132
master
563
# frozen_string_literal: true require 'spec_helper' describe "Rack::Typhoeus::Middleware::ParamsDecoder" do before(:all) do require "rack/typhoeus" end let(:app) do double end let(:env) do double end let(:klass) do Rack::Typhoeus::Middleware::ParamsDecoder end describe "#call" d...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/rack/typhoeus/middleware/params_decoder/helper_spec.rb
Ruby
mit
4,132
master
3,847
# frozen_string_literal: true require 'spec_helper' require "rack/typhoeus" describe "Rack::Typhoeus::Middleware::ParamsDecoder::Helper" do let(:klass) do Class.new do include Rack::Typhoeus::Middleware::ParamsDecoder::Helper end.new end describe "#decode" do let(:decoded) { klass.decode(par...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/support/localhost_server.rb
Ruby
mit
4,132
master
2,318
# frozen_string_literal: true require 'rack' require 'rack/handler/webrick' require 'net/http' # The code for this is inspired by Capybara's server: # http://github.com/jnicklas/capybara/blob/0.3.9/lib/capybara/server.rb class LocalhostServer READY_MESSAGE = "Server ready" class Identify def initialize(app...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/support/memory_cache.rb
Ruby
mit
4,132
master
229
# frozen_string_literal: true class MemoryCache attr_reader :memory def initialize @memory = {} end def get(request) memory[request] end def set(request, response) memory[request] = response end end
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/support/server.rb
Ruby
mit
4,132
master
2,986
#!/usr/bin/env ruby # frozen_string_literal: true require 'json' require 'zlib' require 'sinatra/base' require 'rack/typhoeus' TESTSERVER = Sinatra.new do set :logging, false use Rack::Typhoeus::Middleware::ParamsDecoder fail_count = 0 post '/file' do { 'content-type' => params[:file][:type], ...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/pool_spec.rb
Ruby
mit
4,132
master
3,668
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Pool do let(:easy) { Ethon::Easy.new } after { Typhoeus::Pool.clear } describe "#easies" do it "returns array" do expect(Typhoeus::Pool.send(:easies)).to be_a(Array) end end describe "#release" do it "resets easy" do ...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/expectation_spec.rb
Ruby
mit
4,132
master
7,767
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Expectation do let(:options) { {} } let(:base_url) { "www.example.com" } let(:expectation) { described_class.new(base_url, options) } describe ".new" do it "sets base_url" do expect(expectation.instance_variable_get(:@base_url))...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/easy_factory_spec.rb
Ruby
mit
4,132
master
4,847
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::EasyFactory do let(:base_url) { "http://localhost:3001" } let(:hydra) { Typhoeus::Hydra.new(:max_concurrency => 1) } let(:options) { {} } let(:request) { Typhoeus::Request.new(base_url, options) } let(:easy_factory) { described_class.new...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/config_spec.rb
Ruby
mit
4,132
master
386
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Config do let(:config) { Typhoeus::Config } [:block_connection, :memoize, :verbose, :cache, :user_agent, :proxy].each do |name| it "responds to #{name}" do expect(config).to respond_to(name) end it "responds to #{name}=" do...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/request_spec.rb
Ruby
mit
4,132
master
7,088
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Request do let(:base_url) { "localhost:3001" } let(:options) do { verbose: true, headers: { "User-Agent" => "Fubar", "Expect" => "" }, maxredirs: 50 } end let(:request) { Typhoeus::Request.new(base_url, options) }...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/hydra_spec.rb
Ruby
mit
4,132
master
553
# frozen_string_literal: true require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe Typhoeus::Hydra do let(:base_url) { "localhost:3001" } let(:options) { {} } let(:hydra) { Typhoeus::Hydra.new(options) } describe "#new" do let(:options) { {:pipeling => true} } it "passes opt...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/response_spec.rb
Ruby
mit
4,132
master
2,358
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Response do let(:response) { Typhoeus::Response.new(options) } let(:options) { {} } describe ".new" do context "when options" do context "when return_code" do let(:options) { {:return_code => 2} } it "stores" do ...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/response/informations_spec.rb
Ruby
mit
4,132
master
8,550
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Response::Informations do let(:options) { {} } let(:response) { Typhoeus::Response.new(options) } describe "#return_code" do let(:options) { { :return_code => :ok } } it "returns return_code from options" do expect(response.r...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/response/header_spec.rb
Ruby
mit
4,132
master
4,716
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Response::Header do let(:raw) { nil } let(:header) { Typhoeus::Response::Header.new(raw) } describe ".new" do context "when string" do let(:raw) { 'Date: Fri, 29 Jun 2012 10:09:23 GMT' } it "sets Date" do expect(hea...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/response/status_spec.rb
Ruby
mit
4,132
master
6,329
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Response::Status do let(:response) { Typhoeus::Response.new(options) } let(:options) { {} } describe "timed_out?" do context "when return code is operation_timedout" do let(:options) { {:return_code => :operation_timedout} } ...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/errors/no_stub_spec.rb
Ruby
mit
4,132
master
423
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Errors::NoStub do let(:base_url) { "localhost:3001" } let(:request) { Typhoeus::Request.new(base_url) } let(:message) { "The connection is blocked and no stub defined: " } subject { Typhoeus::Errors::NoStub } it "displays the request u...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/cache/dalli_spec.rb
Ruby
mit
4,132
master
1,432
# frozen_string_literal: true if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("1.9.0") require 'dalli' require 'typhoeus/cache/dalli' require 'spec_helper' describe Typhoeus::Cache::Dalli do let(:dalli) { instance_double(Dalli::Client) } let(:cache) { Typhoeus::Cache::Dalli.new(dalli) } let...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/cache/redis_spec.rb
Ruby
mit
4,132
master
1,461
# frozen_string_literal: true require 'redis' require 'typhoeus/cache/redis' require 'spec_helper' describe Typhoeus::Cache::Redis do let(:redis) { instance_double(Redis) } let(:cache) { Typhoeus::Cache::Redis.new(redis) } let(:base_url) { "localhost:3001" } let(:request) { Typhoeus::Request.new(base_url, {:...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/request/marshal_spec.rb
Ruby
mit
4,132
master
1,701
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Request::Marshal do let(:base_url) { "localhost:3001" } let(:request) { Typhoeus::Request.new(base_url) } describe "#marshal_dump" do %w(on_complete on_success on_failure on_progress).each do |name| context "when #{name} handler" ...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/request/responseable_spec.rb
Ruby
mit
4,132
master
355
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Request::Responseable do let(:request) { Typhoeus::Request.new("base_url", {}) } let(:response) { Typhoeus::Response.new } describe "#response=" do it "stores response" do request.response = response expect(request.response)...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/request/before_spec.rb
Ruby
mit
4,132
master
2,655
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Request::Before do let(:request) { Typhoeus::Request.new("") } let(:receive_counter) { double :mark => :twain } describe "#queue" do context "when before" do context "when one" do it "executes" do Typhoeus.before...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/request/cacheable_spec.rb
Ruby
mit
4,132
master
2,447
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Request::Cacheable do let(:cache) { MemoryCache.new } let(:options) { {} } let(:request) { Typhoeus::Request.new("http://localhost:3001", options) } let(:response) { Typhoeus::Response.new } before { Typhoeus::Config.cache = cache } a...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/request/memoizable_spec.rb
Ruby
mit
4,132
master
962
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Request::Memoizable do let(:options) { {} } let(:request) { Typhoeus::Request.new("fu", options) } let(:response) { Typhoeus::Response.new } let(:hydra) { Typhoeus::Hydra.new } describe "#response=" do context "when memoization acti...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/request/block_connection_spec.rb
Ruby
mit
4,132
master
1,881
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Request::BlockConnection do let(:base_url) { "localhost:3001" } let(:request) { Typhoeus::Request.new(base_url, {:method => :get}) } describe "run" do context "when blocked" do before { request.block_connection = true } it ...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/request/callbacks_spec.rb
Ruby
mit
4,132
master
2,750
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Request::Callbacks do let(:request) { Typhoeus::Request.new("fubar") } [:on_complete, :on_success, :on_failure, :on_progress].each do |callback| describe "##{callback}" do it "responds" do expect(request).to respond_to(callb...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/request/actions_spec.rb
Ruby
mit
4,132
master
577
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Request::Actions do [:get, :post, :put, :delete, :head, :patch, :options].each do |name| describe ".#{name}" do let(:response) { Typhoeus::Request.method(name).call("http://localhost:3001") } it "returns ok" do expect(re...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/request/operations_spec.rb
Ruby
mit
4,132
master
2,874
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Request::Operations do let(:base_url) { "localhost:3001" } let(:options) { {} } let(:request) { Typhoeus::Request.new(base_url, options) } describe "#run" do let(:easy) { Ethon::Easy.new } before { expect(Typhoeus::Pool).to receiv...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/request/stubbable_spec.rb
Ruby
mit
4,132
master
1,059
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Request::Stubbable do let(:base_url) { "localhost:3001" } let(:request) { Typhoeus::Request.new(base_url) } let(:response) { Typhoeus::Response.new } before { Typhoeus.stub(base_url).and_return(response) } describe "#run" do it "ch...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/hydra/before_spec.rb
Ruby
mit
4,132
master
2,845
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Hydra::Before do let(:request) { Typhoeus::Request.new("") } let(:hydra) { Typhoeus::Hydra.new } let(:receive_counter) { double :mark => :twain } describe "#add" do context "when before" do context "when one" do it "exec...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/hydra/memoizable_spec.rb
Ruby
mit
4,132
master
1,472
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Hydra::Memoizable do let(:base_url) { "localhost:3001" } let(:hydra) { Typhoeus::Hydra.new() } let(:request) { Typhoeus::Request.new(base_url) } describe "add" do context "when memoization activated" do before { Typhoeus::Config...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/hydra/addable_spec.rb
Ruby
mit
4,132
master
781
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Hydra::Addable do let(:hydra) { Typhoeus::Hydra.new() } let(:request) { Typhoeus::Request.new("localhost:3001", {:method => :get}) } it "asks easy factory for an easy" do multi = double expect(Typhoeus::EasyFactory).to receive(:new)...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/hydra/cacheable_spec.rb
Ruby
mit
4,132
master
2,761
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Hydra::Cacheable do let(:base_url) { "localhost:3001" } let(:hydra) { Typhoeus::Hydra.new() } let(:request) { Typhoeus::Request.new(base_url, {:method => :get}) } let(:response) { Typhoeus::Response.new } let(:cache) { MemoryCache.new } ...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/hydra/stubbable_spec.rb
Ruby
mit
4,132
master
1,155
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Hydra::Stubbable do let(:base_url) { "localhost:3001" } let(:request) { Typhoeus::Request.new(base_url) } let(:response) { Typhoeus::Response.new } let(:hydra) { Typhoeus::Hydra.new } before { Typhoeus.stub(base_url).and_return(response...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/hydra/runnable_spec.rb
Ruby
mit
4,132
master
3,712
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Hydra::Runnable do let(:base_url) { "localhost:3001" } let(:options) { {} } let(:hydra) { Typhoeus::Hydra.new(options) } let(:receive_counter) { double :mark => :twain } describe "#run" do let(:requests) { [] } before do ...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/hydra/queueable_spec.rb
Ruby
mit
4,132
master
2,756
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Hydra::Queueable do let(:base_url) { "localhost:3001" } let(:options) { {} } let(:hydra) { Typhoeus::Hydra.new(options) } describe "#queue" do let(:request) { Typhoeus::Request.new("") } it "accepts requests" do hydra.queue...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/hydra/block_connection_spec.rb
Ruby
mit
4,132
master
562
# frozen_string_literal: true require 'spec_helper' describe Typhoeus::Hydra::BlockConnection do let(:base_url) { "localhost:3001" } let(:hydra) { Typhoeus::Hydra.new() } let(:request) { Typhoeus::Request.new(base_url, {:method => :get}) } describe "add" do context "when block_connection activated" do ...
github
typhoeus/typhoeus
https://github.com/typhoeus/typhoeus
spec/typhoeus/adapters/faraday_spec.rb
Ruby
mit
4,132
master
9,470
# frozen_string_literal: true if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("1.9.0") require 'spec_helper' require 'typhoeus/adapters/faraday' describe Faraday::Adapter::Typhoeus do let(:base_url) { "http://localhost:3001" } let(:adapter) { described_class.new(nil) } let(:request) { Typhoeus...
github
troessner/reek
https://github.com/troessner/reek
Gemfile
Ruby
mit
4,125
master
627
# frozen_string_literal: true source 'https://rubygems.org' gemspec gem 'aruba', '~> 2.3' gem 'codeclimate-engine-rb', '~> 0.4.0' gem 'cucumber', '~> 10.0' gem 'rake', '~> 13.0' gem 'rspec', '~> 3.0' gem 'rspec-benchmark', '~> 0.6.0' gem 'rubocop', ...
github
troessner/reek
https://github.com/troessner/reek
Rakefile
Ruby
mit
4,125
master
443
# frozen_string_literal: true require 'bundler/gem_tasks' require 'rake/clean' Dir['tasks/**/*.rake'].each { |t| load t } task :ci do [ 'test:spec', 'test:performance', 'configuration:update_default_configuration', 'test:features', :rubocop, 'test:quality' ].each do |name| puts "\n===...
github
troessner/reek
https://github.com/troessner/reek
reek.gemspec
Ruby
mit
4,125
master
1,698
# frozen_string_literal: true require_relative 'lib/reek/version' Gem::Specification.new do |spec| spec.name = 'reek' spec.version = Reek::Version::STRING spec.authors = ['Kevin Rutherford', 'Timo Roessner', 'Matijs van Zuijlen', 'Piotr Szotkowski'] spec.email = ['timo.roessner@googlemail.com'] spec.summar...
github
troessner/reek
https://github.com/troessner/reek
lib/reek.rb
Ruby
mit
4,125
master
413
# frozen_string_literal: true # # Reek's core functionality # require_relative 'reek/version' require_relative 'reek/examiner' require_relative 'reek/report' module Reek DEFAULT_SMELL_CONFIGURATION = File.join(__dir__, '../docs/defaults.reek.yml').freeze DEFAULT_CONFIGURATION_FILE_NAME = '.reek.yml' DETECTORS_K...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/logging_error_handler.rb
Ruby
mit
4,125
master
342
# frozen_string_literal: true require_relative 'errors/base_error' module Reek # Handles errors by logging to stderr class LoggingErrorHandler def handle(exception) case exception when Errors::BaseError warn exception.long_message else warn exception.message end t...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_warning.rb
Ruby
mit
4,125
master
2,366
# frozen_string_literal: true require 'forwardable' require_relative 'documentation_link' module Reek # # Reports a warning that a smell has been found. # # @public # # @quality :reek:TooManyInstanceVariables { max_instance_variables: 6 } class SmellWarning include Comparable extend Forwardable ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/context_builder.rb
Ruby
mit
4,125
master
14,892
# frozen_string_literal: true require_relative 'context/attribute_context' require_relative 'context/class_context' require_relative 'context/ghost_context' require_relative 'context/method_context' require_relative 'context/module_context' require_relative 'context/refinement_context' require_relative 'context/root_c...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/code_comment.rb
Ruby
mit
4,125
master
7,565
# frozen_string_literal: true require 'yaml' require_relative 'smell_detectors/base_detector' require_relative 'errors/bad_detector_in_comment_error' require_relative 'errors/bad_detector_configuration_key_in_comment_error' require_relative 'errors/garbage_detector_configuration_in_comment_error' require_relative 'er...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/report.rb
Ruby
mit
4,125
master
2,690
# frozen_string_literal: true require_relative 'report/github_report' require_relative 'report/html_report' require_relative 'report/json_report' require_relative 'report/text_report' require_relative 'report/xml_report' require_relative 'report/yaml_report' require_relative 'report/heading_formatter' require_relativ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/examiner.rb
Ruby
mit
4,125
master
3,579
# frozen_string_literal: true require_relative 'context_builder' require_relative 'detector_repository' require_relative 'errors/incomprehensible_source_error' require_relative 'errors/encoding_error' require_relative 'errors/syntax_error' require_relative 'source/source_code' module Reek # # Applies all availabl...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/spec.rb
Ruby
mit
4,125
master
4,203
# frozen_string_literal: true require_relative 'spec/should_reek' require_relative 'spec/should_reek_of' require_relative 'spec/should_reek_only_of' module Reek # # Provides matchers for RSpec, making it easy to check code quality. # # If you require this module somewhere within your spec (or in your spec_hel...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/documentation_link.rb
Ruby
mit
4,125
master
955
# frozen_string_literal: true module Reek # Generate versioned links to our documentation module DocumentationLink HELP_LINK_TEMPLATE = 'https://github.com/troessner/reek/blob/v%<version>s/docs/%<item>s.md' module_function # Build link to the documentation about the given subject for the current ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/detector_repository.rb
Ruby
mit
4,125
master
2,234
# frozen_string_literal: true require_relative 'smell_detectors' require_relative 'smell_detectors/base_detector' require_relative 'configuration/app_configuration' module Reek # # Contains all the existing smell detectors and exposes operations on them. # class DetectorRepository # @return [Array<Reek::S...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/tree_dresser.rb
Ruby
mit
4,125
master
1,889
# frozen_string_literal: true require_relative 'ast/ast_node_class_map' module Reek # # Adorns an abstract syntax tree with mix-in modules to make accessing # the tree more understandable and less implementation-dependent. # class TreeDresser def initialize(klass_map: AST::ASTNodeClassMap.new) @kl...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_configuration.rb
Ruby
mit
4,125
master
1,518
# frozen_string_literal: true module Reek # # Represents a single set of configuration options for a smell detector # class SmellConfiguration # The name of the config field that specifies whether a smell is # enabled. Set to +true+ or +false+. ENABLED_KEY = 'enabled' # The name of the config ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors.rb
Ruby
mit
4,125
master
1,626
# frozen_string_literal: true require_relative 'smell_detectors/attribute' require_relative 'smell_detectors/boolean_parameter' require_relative 'smell_detectors/class_variable' require_relative 'smell_detectors/control_parameter' require_relative 'smell_detectors/data_clump' require_relative 'smell_detectors/duplicat...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/base_detector.rb
Ruby
mit
4,125
master
3,947
# frozen_string_literal: true require 'set' require_relative '../smell_warning' require_relative '../smell_configuration' module Reek module SmellDetectors # # Shared responsibilities of all smell detectors. # # See # - {file:docs/Basic-Smell-Options.md} # - {file:docs/Code-Smells.md} ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/class_variable.rb
Ruby
mit
4,125
master
1,445
# frozen_string_literal: true require 'set' require_relative 'base_detector' module Reek module SmellDetectors # # Class variables form part of the global runtime state, and as such make # it easy for one part of the system to accidentally or inadvertently # depend on another part of the system. So ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/instance_variable_assumption.rb
Ruby
mit
4,125
master
1,583
# frozen_string_literal: true require_relative 'base_detector' module Reek module SmellDetectors # # The +InstanceVariableAssumption+ class is responsible for # detecting directly access of instance variables in a class # that does not define them in its initialize method. # class InstanceVa...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/data_clump.rb
Ruby
mit
4,125
master
3,318
# frozen_string_literal: true require_relative 'base_detector' module Reek module SmellDetectors # # A Data Clump occurs when the same two or three items frequently # appear together in classes and parameter lists, or when a group # of instance variable names start or end with similar substrings. ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/too_many_methods.rb
Ruby
mit
4,125
master
1,520
# frozen_string_literal: true require_relative 'base_detector' module Reek module SmellDetectors # # A Large Class is a class or module that has a large number of # instance variables, methods or lines of code. # # +TooManyMethods+ reports classes having more than a configurable number # of ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/long_yield_list.rb
Ruby
mit
4,125
master
1,318
# frozen_string_literal: true require_relative 'base_detector' module Reek module SmellDetectors # # A variant on LongParameterList that checks the number of items # passed to a block by a +yield+ call. # # See {file:docs/Long-Yield-List.md} for details. class LongYieldList < BaseDetector ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/missing_safe_method.rb
Ruby
mit
4,125
master
2,864
# frozen_string_literal: true require_relative 'base_detector' module Reek module SmellDetectors # Excerpt from: # http://dablog.rubypal.com/2007/8/15/bang-methods-or-danger-will-rubyist # since this sums it up really well: # # The ! in method names that end with ! means, "This method is dange...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/nested_iterators.rb
Ruby
mit
4,125
master
4,511
# frozen_string_literal: true require_relative 'base_detector' module Reek module SmellDetectors # # A Nested Iterator occurs when a block contains another block. # # +NestedIterators+ reports failing methods only once. # # See {file:docs/Nested-Iterators.md} for details. class NestedIte...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/utility_function.rb
Ruby
mit
4,125
master
2,749
# frozen_string_literal: true require_relative '../ast/reference_collector' require_relative 'base_detector' module Reek module SmellDetectors # # A Utility Function is any instance method that has no # dependency on the state of the instance. # # Currently +UtilityFunction+ will warn about any ...
github
troessner/reek
https://github.com/troessner/reek
lib/reek/smell_detectors/too_many_constants.rb
Ruby
mit
4,125
master
1,525
# frozen_string_literal: true require_relative 'base_detector' module Reek module SmellDetectors # # A Large Class is a class or module that has a large number of # instance variables, methods, constants or lines of code. # # +TooManyConstants' reports classes having more than a # configurab...