mirror of
https://github.com/lostisland/faraday.git
synced 2025-08-10 00:03:15 -04:00
chore: RuboCop: Support Frozen String Literals (#868)
This commit is contained in:
parent
fcc4c4043e
commit
b427091f0e
@ -603,13 +603,6 @@ Style/FormatStringToken:
|
||||
- 'test/adapters/integration.rb'
|
||||
- 'test/live_server.rb'
|
||||
|
||||
# Offense count: 96
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: when_needed, always, never
|
||||
Style/FrozenStringLiteralComment:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 2
|
||||
# Configuration parameters: AllowedVariables.
|
||||
Style/GlobalVars:
|
||||
|
2
Gemfile
2
Gemfile
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
source 'https://rubygems.org'
|
||||
|
||||
ruby RUBY_VERSION
|
||||
|
2
Rakefile
2
Rakefile
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rake/testtask'
|
||||
|
||||
task :default => :test
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'bundler/setup'
|
||||
require 'faraday'
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
lib = "faraday"
|
||||
lib_file = File.expand_path("../lib/#{lib}.rb", __FILE__)
|
||||
File.read(lib_file) =~ /\bVERSION\s*=\s*["'](.+?)["']/
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'thread'
|
||||
require 'cgi'
|
||||
require 'set'
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
# Base class for all Faraday adapters. Adapters are
|
||||
# responsible for fulfilling a Faraday request.
|
||||
@ -5,7 +7,7 @@ module Faraday
|
||||
extend MiddlewareRegistry
|
||||
extend DependencyLoader
|
||||
|
||||
CONTENT_LENGTH = 'Content-Length'.freeze
|
||||
CONTENT_LENGTH = 'Content-Length'
|
||||
|
||||
register_middleware File.expand_path('../adapter', __FILE__),
|
||||
:test => [:Test, 'test'],
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
class Adapter
|
||||
# EventMachine adapter. This adapter is useful for either asynchronous
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'openssl'
|
||||
require 'em-http'
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'uri'
|
||||
|
||||
module Faraday
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
class Adapter
|
||||
class EMSynchrony < Faraday::Adapter
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
class Adapter
|
||||
# Excon adapter.
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
class Adapter
|
||||
# HTTPClient adapter.
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
begin
|
||||
require 'net/https'
|
||||
rescue LoadError
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
class Adapter
|
||||
# Net::HTTP::Persistent adapter.
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
class Adapter
|
||||
# Patron adapter.
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
class Adapter
|
||||
# Sends requests to a Rack app.
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
class Adapter
|
||||
# Examples
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
class Adapter
|
||||
# Typhoeus adapter. This class is just a stub, the real adapter is in https://github.com/philsturgeon/typhoeus/blob/master/lib/typhoeus/adapters/faraday.rb
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
# Adds the ability for other modules to manage autoloadable
|
||||
# constants.
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
# Connection objects manage the default properties and the middleware
|
||||
# stack for fulfilling an HTTP request.
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
module DependencyLoader
|
||||
attr_accessor :load_error
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
module FlatParamsEncoder
|
||||
class << self
|
||||
@ -24,7 +26,7 @@ module Faraday
|
||||
end
|
||||
|
||||
# The params have form [['key1', 'value1'], ['key2', 'value2']].
|
||||
buffer = ''
|
||||
buffer = +""
|
||||
params.each do |key, value|
|
||||
encoded_key = escape(key)
|
||||
value = value.to_s if value == true || value == false
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
# This is the default encoder for Faraday requests.
|
||||
# Using this encoder, parameters will be encoded respecting their structure,
|
||||
@ -39,7 +41,7 @@ module Faraday
|
||||
[key, val]
|
||||
end
|
||||
value.sort!
|
||||
buffer = ""
|
||||
buffer = +""
|
||||
value.each do |key, val|
|
||||
new_parent = "#{parent}%5B#{key}%5D"
|
||||
buffer << "#{to_query.call(new_parent, val)}&"
|
||||
@ -49,7 +51,7 @@ module Faraday
|
||||
new_parent = "#{parent}%5B%5D"
|
||||
return new_parent if value.empty?
|
||||
|
||||
buffer = ""
|
||||
buffer = +""
|
||||
value.each_with_index do |val, i|
|
||||
buffer << "#{to_query.call(new_parent, val)}&"
|
||||
end
|
||||
@ -63,7 +65,7 @@ module Faraday
|
||||
end
|
||||
|
||||
# The params have form [['key1', 'value1'], ['key2', 'value2']].
|
||||
buffer = ''
|
||||
buffer = +""
|
||||
params.each do |parent, value|
|
||||
encoded_parent = escape(parent)
|
||||
buffer << "#{to_query.call(encoded_parent, value)}&"
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
# Faraday error base class.
|
||||
class Error < StandardError
|
||||
@ -27,7 +29,7 @@ module Faraday
|
||||
end
|
||||
|
||||
def inspect
|
||||
inner = ''
|
||||
inner = +""
|
||||
if @wrapped_exception
|
||||
inner << " wrapped=#{@wrapped_exception.inspect}"
|
||||
end
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
class Middleware
|
||||
extend MiddlewareRegistry
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
# Adds the ability for other modules to register and lookup
|
||||
# middleware classes.
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
# Subclasses Struct with some special helpers for converting from a Hash to
|
||||
# a Struct.
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
class ConnectionOptions < Options.new(:request, :proxy, :ssl, :builder, :url,
|
||||
:parallel_manager, :params, :headers, :builder_class)
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
# @!attribute method
|
||||
# @return [Symbol] HTTP method (`:get`, `:post`)
|
||||
@ -47,7 +49,7 @@ module Faraday
|
||||
:ssl, :parallel_manager, :params, :response, :response_headers, :status,
|
||||
:reason_phrase, :response_body)
|
||||
|
||||
ContentLength = 'Content-Length'.freeze
|
||||
ContentLength = 'Content-Length'
|
||||
StatusesWithoutBody = Set.new [204, 304]
|
||||
SuccessfulStatuses = 200..299
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
class ProxyOptions < Options.new(:uri, :user, :password)
|
||||
extend Forwardable
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
class RequestOptions < Options.new(:params_encoder, :proxy, :bind,
|
||||
:timeout, :open_timeout, :write_timeout, :boundary,
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
# SSL-related options.
|
||||
#
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'forwardable'
|
||||
require 'faraday/encoders/nested_params_encoder'
|
||||
require 'faraday/encoders/flat_params_encoder'
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
# A Builder that processes requests into responses by passing through an inner
|
||||
# middleware stack (heavily inspired by Rack).
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
# Used to setup URLs, params, headers, and the request body in a sane manner.
|
||||
#
|
||||
|
@ -1,7 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
# Request middleware for the Authorization HTTP header
|
||||
class Request::Authorization < Faraday::Middleware
|
||||
KEY = "Authorization".freeze unless defined? KEY
|
||||
KEY = "Authorization" unless defined? KEY
|
||||
|
||||
# @param type [String, Symbol]
|
||||
# @param token [String, Symbol, Hash]
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'base64'
|
||||
|
||||
module Faraday
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
# Middleware for instrumenting Requests.
|
||||
class Request::Instrumentation < Faraday::Middleware
|
||||
|
@ -1,11 +1,13 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../url_encoded", __FILE__)
|
||||
require 'securerandom'
|
||||
|
||||
module Faraday
|
||||
# Middleware for supporting multi-part requests.
|
||||
class Request::Multipart < Request::UrlEncoded
|
||||
self.mime_type = 'multipart/form-data'.freeze
|
||||
DEFAULT_BOUNDARY_PREFIX = "-----------RubyMultipartPost".freeze unless defined? DEFAULT_BOUNDARY_PREFIX
|
||||
self.mime_type = 'multipart/form-data'
|
||||
DEFAULT_BOUNDARY_PREFIX = "-----------RubyMultipartPost" unless defined? DEFAULT_BOUNDARY_PREFIX
|
||||
|
||||
# Checks for files in the payload, otherwise leaves everything untouched.
|
||||
#
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
# Catches exceptions and retries each request a limited number of times.
|
||||
#
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
class Request::TokenAuthentication < Request.load_middleware(:authorization)
|
||||
# Public
|
||||
|
@ -1,12 +1,14 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
# Middleware for supporting urlencoded requests.
|
||||
class Request::UrlEncoded < Faraday::Middleware
|
||||
CONTENT_TYPE = 'Content-Type'.freeze unless defined? CONTENT_TYPE
|
||||
CONTENT_TYPE = 'Content-Type' unless defined? CONTENT_TYPE
|
||||
|
||||
class << self
|
||||
attr_accessor :mime_type
|
||||
end
|
||||
self.mime_type = 'application/x-www-form-urlencoded'.freeze
|
||||
self.mime_type = 'application/x-www-form-urlencoded'
|
||||
|
||||
# Encodes as "application/x-www-form-urlencoded" if not already encoded or
|
||||
# of another type.
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'forwardable'
|
||||
|
||||
module Faraday
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'forwardable'
|
||||
|
||||
module Faraday
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
class Response::RaiseError < Response::Middleware
|
||||
ClientErrorStatuses = 400...500
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
begin
|
||||
require 'composite_io'
|
||||
require 'parts'
|
||||
@ -35,7 +37,7 @@ module Faraday
|
||||
# @param outbuf [String, nil]
|
||||
def read(length = nil, outbuf = nil)
|
||||
got_result = false
|
||||
outbuf = outbuf ? outbuf.replace("") : ""
|
||||
outbuf = outbuf ? (+outbuf).replace("") : +""
|
||||
|
||||
while io = current_io
|
||||
if result = io.read(length)
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'thread'
|
||||
|
||||
require 'faraday/utils/headers'
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
module Utils
|
||||
# A case-insensitive Hash that preserves the original case of a header
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
module Utils
|
||||
# A hash with stringified keys.
|
||||
|
@ -1,4 +1,6 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Usage: generate_certs
|
||||
# Generate test certs for testing Faraday with SSL
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Usage: script/proxy-server [-p PORT] [-u USER:PASSWORD]
|
||||
require 'webrick'
|
||||
require 'webrick/httpproxy'
|
||||
|
@ -1,4 +1,6 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
old_verbose, $VERBOSE = $VERBOSE, nil
|
||||
begin
|
||||
require File.expand_path('../../test/live_server', __FILE__)
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Faraday::Adapter::Excon do
|
||||
features :body_on_get, :reason_phrase_parse
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Faraday::Adapter::HTTPClient do
|
||||
features :body_on_get, :reason_phrase_parse, :compression
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Faraday::Adapter::NetHttpPersistent do
|
||||
features :body_on_get, :reason_phrase_parse, :compression
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Faraday::Adapter::NetHttp do
|
||||
features :body_on_get, :reason_phrase_parse, :compression, :streaming
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Faraday::Adapter::Patron do
|
||||
features :reason_phrase_parse
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Faraday::Adapter::Typhoeus do
|
||||
features :body_on_get, :parallel
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'stringio'
|
||||
|
||||
RSpec.describe Faraday::CompositeReadIO do
|
||||
@ -67,11 +69,11 @@ RSpec.describe Faraday::CompositeReadIO do
|
||||
context 'with utf8 multibyte part' do
|
||||
subject { composite_io(part("\x86"), part("ファイル")) }
|
||||
|
||||
it { expect(subject.read).to eq("\x86\xE3\x83\x95\xE3\x82\xA1\xE3\x82\xA4\xE3\x83\xAB".force_encoding("BINARY"))}
|
||||
it { expect(subject.read).to eq(String.new("\x86\xE3\x83\x95\xE3\x82\xA1\xE3\x82\xA4\xE3\x83\xAB", encoding: "BINARY"))}
|
||||
it 'allows to read in chunks' do
|
||||
expect(subject.read(3)).to eq("\x86\xE3\x83".force_encoding("BINARY"))
|
||||
expect(subject.read(3)).to eq("\x95\xE3\x82".force_encoding("BINARY"))
|
||||
expect(subject.read(8)).to eq("\xA1\xE3\x82\xA4\xE3\x83\xAB".force_encoding("BINARY"))
|
||||
expect(subject.read(3)).to eq(String.new("\x86\xE3\x83", encoding: "BINARY"))
|
||||
expect(subject.read(3)).to eq(String.new("\x95\xE3\x82", encoding: "BINARY"))
|
||||
expect(subject.read(8)).to eq(String.new("\xA1\xE3\x82\xA4\xE3\x83\xAB", encoding: "BINARY"))
|
||||
expect(subject.read(3)).to be_nil
|
||||
end
|
||||
end
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
shared_examples 'initializer with url' do
|
||||
context 'with simple url' do
|
||||
let(:address) { 'http://sushi.com' }
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Faraday::ClientError do
|
||||
describe '.initialize' do
|
||||
subject { described_class.new(exception, response) }
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Faraday::Env do
|
||||
subject(:env) { described_class.new }
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Faraday::Options do
|
||||
SubOptions = Class.new(Faraday::Options.new(:sub_a, :sub_b))
|
||||
class ParentOptions < Faraday::Options.new(:a, :b, :c)
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Faraday::ProxyOptions do
|
||||
describe '#from' do
|
||||
it 'works with string' do
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Faraday::RequestOptions do
|
||||
it 'allows to set the request proxy' do
|
||||
options = Faraday::RequestOptions.new
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rack/utils'
|
||||
|
||||
RSpec.describe Faraday::FlatParamsEncoder do
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rack/utils'
|
||||
|
||||
RSpec.describe Faraday::NestedParamsEncoder do
|
||||
|
@ -1,8 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Faraday::RackBuilder do
|
||||
# mock handler classes
|
||||
class Handler < Struct.new(:app)
|
||||
def call(env)
|
||||
(env[:request_headers]['X-Middleware'] ||= '') << ":#{self.class.name.split('::').last}"
|
||||
env[:request_headers]['X-Middleware'] ||= ''
|
||||
env[:request_headers]['X-Middleware'] += ":#{self.class.name.split('::').last}"
|
||||
app.call(env)
|
||||
end
|
||||
end
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Faraday::Request::Authorization do
|
||||
let(:conn) do
|
||||
Faraday.new do |b|
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Faraday::Request::Instrumentation do
|
||||
class FakeInstrumenter
|
||||
attr_reader :instrumentations
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
Faraday::CompositeReadIO.class_eval { attr_reader :ios }
|
||||
|
||||
RSpec.describe Faraday::Request::Multipart do
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Faraday::Request::Retry do
|
||||
let(:calls) { [] }
|
||||
let(:times_called) { calls.size }
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Faraday::Request::UrlEncoded do
|
||||
let(:conn) do
|
||||
Faraday.new do |b|
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Faraday::Request do
|
||||
let(:conn) do
|
||||
Faraday.new(url: 'http://sushi.com/api',
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'stringio'
|
||||
require 'logger'
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Faraday::Response::Middleware do
|
||||
let(:conn) do
|
||||
Faraday.new do |b|
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Faraday::Response::RaiseError do
|
||||
let(:conn) do
|
||||
Faraday.new do |b|
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Faraday::Response do
|
||||
subject { Faraday::Response.new(env) }
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Faraday::Utils::Headers do
|
||||
subject { Faraday::Utils::Headers.new }
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Faraday::Utils do
|
||||
describe 'headers parsing' do
|
||||
let(:multi_response_headers) {
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Faraday do
|
||||
it 'has a version number' do
|
||||
expect(Faraday::VERSION).not_to be nil
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# This file was generated by the `rspec --init` command. Conventionally, all
|
||||
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
||||
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# emulates ActiveSupport::SafeBuffer#gsub
|
||||
FakeSafeBuffer = Struct.new(:string) do
|
||||
def to_s; self end
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
module HelperMethods
|
||||
def self.included(base)
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
shared_examples 'an adapter' do |**options|
|
||||
before { skip } if options[:skip]
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
shared_examples 'a params encoder' do
|
||||
it 'escapes safe buffer' do
|
||||
monies = FakeSafeBuffer.new('$32,000.00')
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
shared_examples 'a request method' do |http_method|
|
||||
let(:query_or_body) { method_with_body?(http_method) ? :body : :query }
|
||||
let(:response) { conn.public_send(http_method, '/') }
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
module StreamingResponseChecker
|
||||
def check_streaming_response(streamed, options = {})
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path('../integration', __FILE__)
|
||||
|
||||
module Adapters
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path('../integration', __FILE__)
|
||||
|
||||
module Adapters
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'forwardable'
|
||||
require File.expand_path("../../helper", __FILE__)
|
||||
require File.expand_path("../../shared", __FILE__)
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path("../integration", __FILE__)
|
||||
require File.expand_path('../../live_server', __FILE__)
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require File.expand_path('../../helper', __FILE__)
|
||||
|
||||
module Adapters
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'simplecov'
|
||||
require 'coveralls'
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'sinatra/base'
|
||||
require_relative 'shared'
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Faraday
|
||||
module Shared
|
||||
def self.big_string
|
||||
|
Loading…
x
Reference in New Issue
Block a user