1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00
heartcombo--devise/test/support/webrat/integrations/rails.rb
Felipe Renan 101e50f9df Fix webrat warnings
Forwarding methods to private methods is deprecated and produces a
warning after Ruby 2.4.

see: https://bugs.ruby-lang.org/issues/12782

To fix this issue I'm mocking patching webrat making RailsAdatper#response
method public since Webrat::Session is delegating functions to it.
2019-02-04 14:50:14 -02:00

41 lines
968 B
Ruby

# frozen_string_literal: true
require 'webrat/core/elements/form'
require 'action_dispatch/testing/integration'
module Webrat
Form.class_eval do
def self.parse_rails_request_params(params)
Rack::Utils.parse_nested_query(params)
end
end
module Logging
# Avoid RAILS_DEFAULT_LOGGER deprecation warning
def logger # :nodoc:
::Rails.logger
end
end
class RailsAdapter
# This method is private within webrat gem and after Ruby 2.4 we get a lot of warnings because
# Webrat::Session#response is delegated to this method.
def response
integration_session.response
end
protected
def do_request(http_method, url, data, headers)
update_protocol(url)
integration_session.send(http_method, normalize_url(url), params: data, headers: headers)
end
end
end
module ActionDispatch #:nodoc:
IntegrationTest.class_eval do
include Webrat::Methods
include Webrat::Matchers
end
end