mirror of
https://github.com/lostisland/faraday.git
synced 2025-10-17 00:05:28 -04:00
Fix "method redefined" warnings introduced in Faraday 2.7.5 (#1506)
* Print Ruby warnings when running specs * Fix 'method redefined' warnings
This commit is contained in:
parent
d40f3dbb99
commit
86298d0c45
4
Rakefile
4
Rakefile
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
require 'rspec/core/rake_task'
|
require 'rspec/core/rake_task'
|
||||||
|
|
||||||
RSpec::Core::RakeTask.new(:spec)
|
RSpec::Core::RakeTask.new(:spec) do |task|
|
||||||
|
task.ruby_opts = %w[-W]
|
||||||
|
end
|
||||||
|
|
||||||
task default: :spec
|
task default: :spec
|
||||||
|
@ -174,6 +174,7 @@ module Faraday
|
|||||||
|
|
||||||
memoized_attributes[key.to_sym] = block
|
memoized_attributes[key.to_sym] = block
|
||||||
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
||||||
|
remove_method(key) if method_defined?(key, false)
|
||||||
def #{key}() self[:#{key}]; end
|
def #{key}() self[:#{key}]; end
|
||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
|
@ -42,6 +42,7 @@ module Faraday
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
remove_method :params=
|
||||||
# Replace params, preserving the existing hash type.
|
# Replace params, preserving the existing hash type.
|
||||||
#
|
#
|
||||||
# @param hash [Hash] new params
|
# @param hash [Hash] new params
|
||||||
@ -53,6 +54,7 @@ module Faraday
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
remove_method :headers=
|
||||||
# Replace request headers, preserving the existing hash type.
|
# Replace request headers, preserving the existing hash type.
|
||||||
#
|
#
|
||||||
# @param hash [Hash] new headers
|
# @param hash [Hash] new headers
|
||||||
|
@ -6,11 +6,13 @@ module Faraday
|
|||||||
class Instrumentation < Faraday::Middleware
|
class Instrumentation < Faraday::Middleware
|
||||||
# Options class used in Request::Instrumentation class.
|
# Options class used in Request::Instrumentation class.
|
||||||
Options = Faraday::Options.new(:name, :instrumenter) do
|
Options = Faraday::Options.new(:name, :instrumenter) do
|
||||||
|
remove_method :name
|
||||||
# @return [String]
|
# @return [String]
|
||||||
def name
|
def name
|
||||||
self[:name] ||= 'request.faraday'
|
self[:name] ||= 'request.faraday'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
remove_method :instrumenter
|
||||||
# @return [Class]
|
# @return [Class]
|
||||||
def instrumenter
|
def instrumenter
|
||||||
self[:instrumenter] ||= ActiveSupport::Notifications
|
self[:instrumenter] ||= ActiveSupport::Notifications
|
||||||
|
Loading…
x
Reference in New Issue
Block a user