mirror of
https://github.com/lostisland/faraday.git
synced 2025-10-03 00:02:48 -04:00
Enables and fixes all new cops. (#1443)
This commit is contained in:
parent
5e01af3828
commit
43d6797770
212
.rubocop.yml
212
.rubocop.yml
@ -9,196 +9,188 @@ AllCops:
|
|||||||
DisplayStyleGuide: true
|
DisplayStyleGuide: true
|
||||||
TargetRubyVersion: 2.6
|
TargetRubyVersion: 2.6
|
||||||
|
|
||||||
Metrics/BlockLength:
|
# Custom config
|
||||||
Exclude:
|
Gemspec/RequireMFA: # we don't know if this works with auto-deployments yet
|
||||||
- spec/**/*.rb
|
Enabled: false
|
||||||
- examples/**/*.rb
|
|
||||||
|
|
||||||
Metrics/ParameterLists:
|
|
||||||
Max: 6
|
|
||||||
|
|
||||||
Layout/EmptyLinesAroundAttributeAccessor: # (0.83)
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
Layout/LineLength:
|
Layout/LineLength:
|
||||||
Exclude:
|
Exclude:
|
||||||
- spec/**/*.rb
|
- spec/**/*.rb
|
||||||
- examples/**/*.rb
|
- examples/**/*.rb
|
||||||
|
Metrics/BlockLength:
|
||||||
Layout/SpaceAroundMethodCallOperator:
|
Exclude:
|
||||||
Enabled: true
|
- spec/**/*.rb
|
||||||
|
- examples/**/*.rb
|
||||||
Lint/DeprecatedOpenSSLConstant: # (0.84)
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
Lint/RaiseException:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
Lint/StructNewOverride:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
Style/DoubleNegation:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
Style/Documentation:
|
Style/Documentation:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/**/*'
|
- 'spec/**/*'
|
||||||
- 'examples/**/*'
|
- 'examples/**/*'
|
||||||
|
Style/DoubleNegation:
|
||||||
Style/ExponentialNotation:
|
Enabled: false
|
||||||
Enabled: true
|
|
||||||
Style/HashEachMethods:
|
|
||||||
Enabled: true
|
|
||||||
Style/HashTransformKeys:
|
|
||||||
Enabled: true
|
|
||||||
Style/HashTransformValues:
|
|
||||||
Enabled: true
|
|
||||||
Style/IfUnlessModifier:
|
Style/IfUnlessModifier:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/SlicingWithRange: # (0.83)
|
# New cops
|
||||||
|
Gemspec/DeprecatedAttributeAssignment: # new in 1.30
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
Layout/LineContinuationLeadingSpace: # new in 1.31
|
||||||
Layout/BeginEndAlignment: # (new in 0.91)
|
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/BinaryOperatorWithIdenticalOperands: # (new in 0.89)
|
Layout/LineContinuationSpacing: # new in 1.31
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/ConstantDefinitionInBlock: # (new in 0.91)
|
Layout/LineEndStringConcatenationIndentation: # new in 1.18
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/DuplicateElsifCondition: # (new in 0.88)
|
Layout/SpaceBeforeBrackets: # new in 1.7
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/DuplicateRequire: # (new in 0.90)
|
Lint/AmbiguousAssignment: # new in 1.7
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/DuplicateRescueException: # (new in 0.89)
|
Lint/AmbiguousOperatorPrecedence: # new in 1.21
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/EmptyConditionalBody: # (new in 0.89)
|
Lint/AmbiguousRange: # new in 1.19
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/EmptyFile: # (new in 0.90)
|
Lint/ConstantOverwrittenInRescue: # new in 1.31
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/FloatComparison: # (new in 0.89)
|
Lint/DeprecatedConstants: # new in 1.8
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/HashCompareByIdentity: # (new in 0.93)
|
Lint/DuplicateBranch: # new in 1.3
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/IdentityComparison: # (new in 0.91)
|
Lint/DuplicateRegexpCharacterClassElement: # new in 1.1
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/MissingSuper: # (new in 0.89)
|
Lint/EmptyBlock: # new in 1.1
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/MixedRegexpCaptureTypes: # (new in 0.85)
|
Lint/EmptyClass: # new in 1.3
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/OutOfRangeRegexpRef: # (new in 0.89)
|
Lint/EmptyInPattern: # new in 1.16
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/RedundantSafeNavigation: # (new in 0.93)
|
Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/SelfAssignment: # (new in 0.89)
|
Lint/LambdaWithoutLiteralBlock: # new in 1.8
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/TopLevelReturnWithArgument: # (new in 0.89)
|
Lint/NoReturnInBeginEndBlocks: # new in 1.2
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/TrailingCommaInAttributeDeclaration: # (new in 0.90)
|
Lint/NonAtomicFileOperation: # new in 1.31
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Performance/BlockGivenWithExplicitBlock: # (new in 1.9)
|
Lint/NumberedParameterAssignment: # new in 1.9
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Performance/CollectionLiteralInLoop: # (new in 1.8)
|
Lint/OrAssignmentToConstant: # new in 1.9
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Performance/ConstantRegexp: # (new in 1.9)
|
Lint/RedundantDirGlobSort: # new in 1.8
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Performance/MethodObjectAsBlock: # (new in 1.9)
|
Lint/RefinementImportMethods: # new in 1.27
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Performance/RedundantEqualityComparisonBlock: # (new in 1.10)
|
Lint/RequireRangeParentheses: # new in 1.32
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Performance/RedundantSortBlock: # (new in 1.7)
|
Lint/RequireRelativeSelfPath: # new in 1.22
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Performance/RedundantSplitRegexpArgument: # (new in 1.10)
|
Lint/SymbolConversion: # new in 1.9
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Performance/RedundantStringChars: # (new in 1.7)
|
Lint/ToEnumArguments: # new in 1.1
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Performance/ReverseFirst: # (new in 1.7)
|
Lint/TripleQuotes: # new in 1.9
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Performance/SortReverse: # (new in 1.7)
|
Lint/UnexpectedBlockArity: # new in 1.5
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Performance/Squeeze: # (new in 1.7)
|
Lint/UnmodifiedReduceAccumulator: # new in 1.1
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Performance/StringInclude: # (new in 1.7)
|
Lint/UselessRuby2Keywords: # new in 1.23
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Performance/Sum: # (new in 1.8)
|
Naming/BlockForwarding: # new in 1.24
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
Security/CompoundHash: # new in 1.28
|
||||||
Gemspec/DeprecatedAttributeAssignment:
|
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Layout/LineEndStringConcatenationIndentation: # (new in 1.18)
|
Security/IoMethods: # new in 1.22
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Layout/SpaceBeforeBrackets: # (new in 1.7)
|
Style/ArgumentsForwarding: # new in 1.1
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/AmbiguousAssignment: # (new in 1.7)
|
Style/CollectionCompact: # new in 1.2
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/AmbiguousRange: # (new in 1.19)
|
Style/DocumentDynamicEvalDefinition: # new in 1.1
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/DeprecatedConstants: # (new in 1.8)
|
Style/EmptyHeredoc: # new in 1.32
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/DuplicateBranch: # (new in 1.3)
|
Style/EndlessMethod: # new in 1.8
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
|
Style/EnvHome: # new in 1.29
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/EmptyBlock: # (new in 1.1)
|
Style/FetchEnvVar: # new in 1.28
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/EmptyClass: # (new in 1.3)
|
Style/FileRead: # new in 1.24
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/EmptyInPattern: # (new in 1.16)
|
Style/FileWrite: # new in 1.24
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/LambdaWithoutLiteralBlock: # (new in 1.8)
|
Style/HashConversion: # new in 1.10
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
|
Style/HashExcept: # new in 1.7
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/NumberedParameterAssignment: # (new in 1.9)
|
Style/IfWithBooleanLiteralBranches: # new in 1.9
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/OrAssignmentToConstant: # (new in 1.9)
|
Style/InPatternThen: # new in 1.16
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/RedundantDirGlobSort: # (new in 1.8)
|
Style/MapCompactWithConditionalBlock: # new in 1.30
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/SymbolConversion: # (new in 1.9)
|
Style/MapToHash: # new in 1.24
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/ToEnumArguments: # (new in 1.1)
|
Style/MultilineInPatternThen: # new in 1.16
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/TripleQuotes: # (new in 1.9)
|
Style/NegatedIfElseCondition: # new in 1.2
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/UnexpectedBlockArity: # (new in 1.5)
|
Style/NestedFileDirname: # new in 1.26
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
|
Style/NilLambda: # new in 1.3
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Naming/InclusiveLanguage: # (new in 1.18)
|
Style/NumberedParameters: # new in 1.22
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Style/ArgumentsForwarding: # (new in 1.1)
|
Style/NumberedParametersLimit: # new in 1.22
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Style/CollectionCompact: # (new in 1.2)
|
Style/ObjectThen: # new in 1.28
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Style/DocumentDynamicEvalDefinition: # (new in 1.1)
|
Style/OpenStructUse: # new in 1.23
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Style/EndlessMethod: # (new in 1.8)
|
Style/QuotedSymbols: # new in 1.16
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Style/HashConversion: # (new in 1.10)
|
Style/RedundantArgument: # new in 1.4
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Style/HashExcept: # (new in 1.7)
|
Style/RedundantInitialize: # new in 1.27
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Style/IfWithBooleanLiteralBranches: # (new in 1.9)
|
Style/RedundantSelfAssignmentBranch: # new in 1.19
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Style/InPatternThen: # (new in 1.16)
|
Style/SelectByRegexp: # new in 1.22
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Style/MultilineInPatternThen: # (new in 1.16)
|
Style/StringChars: # new in 1.12
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Style/NegatedIfElseCondition: # (new in 1.2)
|
Style/SwapValues: # new in 1.1
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Style/NilLambda: # (new in 1.3)
|
Performance/AncestorsInclude: # new in 1.7
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Style/QuotedSymbols: # (new in 1.16)
|
Performance/BigDecimalWithNumericArgument: # new in 1.7
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Style/RedundantArgument: # (new in 1.4)
|
Performance/BlockGivenWithExplicitBlock: # new in 1.9
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Style/RedundantSelfAssignmentBranch: # (new in 1.19)
|
Performance/CollectionLiteralInLoop: # new in 1.8
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Style/StringChars: # (new in 1.12)
|
Performance/ConcurrentMonotonicTime: # new in 1.12
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Style/SwapValues: # (new in 1.1)
|
Performance/ConstantRegexp: # new in 1.9
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Performance/AncestorsInclude: # (new in 1.7)
|
Performance/MapCompact: # new in 1.11
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Performance/BigDecimalWithNumericArgument: # (new in 1.7)
|
Performance/MethodObjectAsBlock: # new in 1.9
|
||||||
|
Enabled: true
|
||||||
|
Performance/RedundantEqualityComparisonBlock: # new in 1.10
|
||||||
|
Enabled: true
|
||||||
|
Performance/RedundantSortBlock: # new in 1.7
|
||||||
|
Enabled: true
|
||||||
|
Performance/RedundantSplitRegexpArgument: # new in 1.10
|
||||||
|
Enabled: true
|
||||||
|
Performance/RedundantStringChars: # new in 1.7
|
||||||
|
Enabled: true
|
||||||
|
Performance/ReverseFirst: # new in 1.7
|
||||||
|
Enabled: true
|
||||||
|
Performance/SortReverse: # new in 1.7
|
||||||
|
Enabled: true
|
||||||
|
Performance/Squeeze: # new in 1.7
|
||||||
|
Enabled: true
|
||||||
|
Performance/StringIdentifierArgument: # new in 1.13
|
||||||
|
Enabled: true
|
||||||
|
Performance/StringInclude: # new in 1.7
|
||||||
|
Enabled: true
|
||||||
|
Performance/Sum: # new in 1.8
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
# This configuration was generated by
|
# This configuration was generated by
|
||||||
# `rubocop --auto-gen-config`
|
# `rubocop --auto-gen-config`
|
||||||
# on 2021-08-16 15:31:43 UTC using RuboCop version 1.19.0.
|
# on 2022-08-08 14:26:32 UTC using RuboCop version 1.33.0.
|
||||||
# The point is for the user to remove these configuration records
|
# The point is for the user to remove these configuration records
|
||||||
# one by one as the offenses are removed from the code base.
|
# one by one as the offenses are removed from the code base.
|
||||||
# Note that changes in the inspected code, or installation of new
|
# Note that changes in the inspected code, or installation of new
|
||||||
# versions of RuboCop, may require this file to be generated again.
|
# versions of RuboCop, may require this file to be generated again.
|
||||||
|
|
||||||
# Offense count: 7
|
# Offense count: 6
|
||||||
# Configuration parameters: AllowedMethods.
|
# Configuration parameters: AllowedMethods.
|
||||||
# AllowedMethods: enums
|
# AllowedMethods: enums
|
||||||
Lint/ConstantDefinitionInBlock:
|
Lint/ConstantDefinitionInBlock:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/faraday/composite_read_io_spec.rb'
|
|
||||||
- 'spec/faraday/options/options_spec.rb'
|
- 'spec/faraday/options/options_spec.rb'
|
||||||
- 'spec/faraday/rack_builder_spec.rb'
|
- 'spec/faraday/rack_builder_spec.rb'
|
||||||
- 'spec/faraday/request/instrumentation_spec.rb'
|
- 'spec/faraday/request/instrumentation_spec.rb'
|
||||||
@ -24,28 +23,33 @@ Lint/EmptyBlock:
|
|||||||
- 'spec/faraday/rack_builder_spec.rb'
|
- 'spec/faraday/rack_builder_spec.rb'
|
||||||
- 'spec/faraday/response_spec.rb'
|
- 'spec/faraday/response_spec.rb'
|
||||||
|
|
||||||
# Offense count: 16
|
# Offense count: 12
|
||||||
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
|
||||||
Metrics/AbcSize:
|
Metrics/AbcSize:
|
||||||
Max: 42
|
Max: 42
|
||||||
|
|
||||||
# Offense count: 3
|
# Offense count: 4
|
||||||
# Configuration parameters: CountComments, CountAsOne.
|
# Configuration parameters: CountComments, CountAsOne.
|
||||||
Metrics/ClassLength:
|
Metrics/ClassLength:
|
||||||
Max: 230
|
Max: 230
|
||||||
|
|
||||||
# Offense count: 12
|
# Offense count: 9
|
||||||
# Configuration parameters: IgnoredMethods.
|
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
|
||||||
Metrics/CyclomaticComplexity:
|
Metrics/CyclomaticComplexity:
|
||||||
Max: 13
|
Max: 13
|
||||||
|
|
||||||
# Offense count: 27
|
# Offense count: 26
|
||||||
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
||||||
Metrics/MethodLength:
|
Metrics/MethodLength:
|
||||||
Max: 33
|
Max: 33
|
||||||
|
|
||||||
# Offense count: 8
|
# Offense count: 1
|
||||||
# Configuration parameters: IgnoredMethods.
|
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
|
||||||
|
Metrics/ParameterLists:
|
||||||
|
Max: 6
|
||||||
|
|
||||||
|
# Offense count: 6
|
||||||
|
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
|
||||||
Metrics/PerceivedComplexity:
|
Metrics/PerceivedComplexity:
|
||||||
Max: 14
|
Max: 14
|
||||||
|
|
||||||
@ -54,4 +58,3 @@ Style/DocumentDynamicEvalDefinition:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/faraday/connection.rb'
|
- 'lib/faraday/connection.rb'
|
||||||
- 'lib/faraday/options.rb'
|
- 'lib/faraday/options.rb'
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ module Faraday
|
|||||||
stub, meta = stubs.match(env)
|
stub, meta = stubs.match(env)
|
||||||
|
|
||||||
unless stub
|
unless stub
|
||||||
raise Stubs::NotFound, "no stubbed request for #{env[:method]} "\
|
raise Stubs::NotFound, "no stubbed request for #{env[:method]} " \
|
||||||
"#{env[:url]} #{env[:body]}"
|
"#{env[:url]} #{env[:body]}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -537,7 +537,7 @@ module Faraday
|
|||||||
end
|
end
|
||||||
|
|
||||||
def find_default_proxy
|
def find_default_proxy
|
||||||
uri = ENV['http_proxy']
|
uri = ENV.fetch('http_proxy', nil)
|
||||||
return unless uri && !uri.empty?
|
return unless uri && !uri.empty?
|
||||||
|
|
||||||
uri = "http://#{uri}" unless uri.match?(/^http/i)
|
uri = "http://#{uri}" unless uri.match?(/^http/i)
|
||||||
|
@ -6,7 +6,7 @@ class CustomEncoder
|
|||||||
end
|
end
|
||||||
|
|
||||||
def decode(params)
|
def decode(params)
|
||||||
params.split(',').map { |pair| pair.split('-') }.to_h
|
params.split(',').to_h { |pair| pair.split('-') }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -511,7 +511,7 @@ RSpec.describe Faraday::Connection do
|
|||||||
it 'uses env http_proxy' do
|
it 'uses env http_proxy' do
|
||||||
with_env 'http_proxy' => 'http://proxy.com' do
|
with_env 'http_proxy' => 'http://proxy.com' do
|
||||||
conn = Faraday.new
|
conn = Faraday.new
|
||||||
expect(conn.instance_variable_get('@manual_proxy')).to be_falsey
|
expect(conn.instance_variable_get(:@manual_proxy)).to be_falsey
|
||||||
expect(conn.proxy_for_request('http://google.co.uk').host).to eq('proxy.com')
|
expect(conn.proxy_for_request('http://google.co.uk').host).to eq('proxy.com')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -519,7 +519,7 @@ RSpec.describe Faraday::Connection do
|
|||||||
it 'uses processes no_proxy before http_proxy' do
|
it 'uses processes no_proxy before http_proxy' do
|
||||||
with_env 'http_proxy' => 'http://proxy.com', 'no_proxy' => 'google.co.uk' do
|
with_env 'http_proxy' => 'http://proxy.com', 'no_proxy' => 'google.co.uk' do
|
||||||
conn = Faraday.new
|
conn = Faraday.new
|
||||||
expect(conn.instance_variable_get('@manual_proxy')).to be_falsey
|
expect(conn.instance_variable_get(:@manual_proxy)).to be_falsey
|
||||||
expect(conn.proxy_for_request('http://google.co.uk')).to be_nil
|
expect(conn.proxy_for_request('http://google.co.uk')).to be_nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -527,7 +527,7 @@ RSpec.describe Faraday::Connection do
|
|||||||
it 'uses env https_proxy' do
|
it 'uses env https_proxy' do
|
||||||
with_env 'https_proxy' => 'https://proxy.com' do
|
with_env 'https_proxy' => 'https://proxy.com' do
|
||||||
conn = Faraday.new
|
conn = Faraday.new
|
||||||
expect(conn.instance_variable_get('@manual_proxy')).to be_falsey
|
expect(conn.instance_variable_get(:@manual_proxy)).to be_falsey
|
||||||
expect(conn.proxy_for_request('https://google.co.uk').host).to eq('proxy.com')
|
expect(conn.proxy_for_request('https://google.co.uk').host).to eq('proxy.com')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -535,7 +535,7 @@ RSpec.describe Faraday::Connection do
|
|||||||
it 'uses processes no_proxy before https_proxy' do
|
it 'uses processes no_proxy before https_proxy' do
|
||||||
with_env 'https_proxy' => 'https://proxy.com', 'no_proxy' => 'google.co.uk' do
|
with_env 'https_proxy' => 'https://proxy.com', 'no_proxy' => 'google.co.uk' do
|
||||||
conn = Faraday.new
|
conn = Faraday.new
|
||||||
expect(conn.instance_variable_get('@manual_proxy')).to be_falsey
|
expect(conn.instance_variable_get(:@manual_proxy)).to be_falsey
|
||||||
expect(conn.proxy_for_request('https://google.co.uk')).to be_nil
|
expect(conn.proxy_for_request('https://google.co.uk')).to be_nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -545,7 +545,7 @@ RSpec.describe Faraday::Connection do
|
|||||||
conn = Faraday.new
|
conn = Faraday.new
|
||||||
conn.proxy = 'http://proxy2.com'
|
conn.proxy = 'http://proxy2.com'
|
||||||
|
|
||||||
expect(conn.instance_variable_get('@manual_proxy')).to be_truthy
|
expect(conn.instance_variable_get(:@manual_proxy)).to be_truthy
|
||||||
expect(conn.proxy_for_request('https://google.co.uk').host).to eq('proxy2.com')
|
expect(conn.proxy_for_request('https://google.co.uk').host).to eq('proxy2.com')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -580,7 +580,7 @@ RSpec.describe Faraday::Connection do
|
|||||||
end
|
end
|
||||||
|
|
||||||
conn.get(url)
|
conn.get(url)
|
||||||
expect(conn.instance_variable_get('@temp_proxy')).to be_nil
|
expect(conn.instance_variable_get(:@temp_proxy)).to be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'dynamically check no proxy' do
|
it 'dynamically check no proxy' do
|
||||||
|
@ -37,7 +37,7 @@ shared_examples 'adapter examples' do |**options|
|
|||||||
|
|
||||||
let(:conn) do
|
let(:conn) do
|
||||||
conn_options[:ssl] ||= {}
|
conn_options[:ssl] ||= {}
|
||||||
conn_options[:ssl][:ca_file] ||= ENV['SSL_FILE']
|
conn_options[:ssl][:ca_file] ||= ENV.fetch('SSL_FILE', nil)
|
||||||
conn_options[:ssl][:verify_hostname] ||= ENV['SSL_VERIFY_HOSTNAME'] == 'yes'
|
conn_options[:ssl][:verify_hostname] ||= ENV['SSL_VERIFY_HOSTNAME'] == 'yes'
|
||||||
|
|
||||||
Faraday.new(remote, conn_options) do |conn|
|
Faraday.new(remote, conn_options) do |conn|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user