mirror of
https://github.com/lostisland/faraday.git
synced 2025-10-16 00:03:37 -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'
|
||||
|
||||
RSpec::Core::RakeTask.new(:spec)
|
||||
RSpec::Core::RakeTask.new(:spec) do |task|
|
||||
task.ruby_opts = %w[-W]
|
||||
end
|
||||
|
||||
task default: :spec
|
||||
|
@ -174,6 +174,7 @@ module Faraday
|
||||
|
||||
memoized_attributes[key.to_sym] = block
|
||||
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
||||
remove_method(key) if method_defined?(key, false)
|
||||
def #{key}() self[:#{key}]; end
|
||||
RUBY
|
||||
end
|
||||
|
@ -42,6 +42,7 @@ module Faraday
|
||||
end
|
||||
end
|
||||
|
||||
remove_method :params=
|
||||
# Replace params, preserving the existing hash type.
|
||||
#
|
||||
# @param hash [Hash] new params
|
||||
@ -53,6 +54,7 @@ module Faraday
|
||||
end
|
||||
end
|
||||
|
||||
remove_method :headers=
|
||||
# Replace request headers, preserving the existing hash type.
|
||||
#
|
||||
# @param hash [Hash] new headers
|
||||
|
@ -6,11 +6,13 @@ module Faraday
|
||||
class Instrumentation < Faraday::Middleware
|
||||
# Options class used in Request::Instrumentation class.
|
||||
Options = Faraday::Options.new(:name, :instrumenter) do
|
||||
remove_method :name
|
||||
# @return [String]
|
||||
def name
|
||||
self[:name] ||= 'request.faraday'
|
||||
end
|
||||
|
||||
remove_method :instrumenter
|
||||
# @return [Class]
|
||||
def instrumenter
|
||||
self[:instrumenter] ||= ActiveSupport::Notifications
|
||||
|
Loading…
x
Reference in New Issue
Block a user