mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Remove unnecessary monkey-patch of test helpers with Rails 5+
This is warning on Ruby 2.7, and seems unnecessary since Rails 5+ adopted kwargs approach. We still need to handle the difference for Rails < 5 for now, while we support it (which I would like to remove soon.)
This commit is contained in:
parent
94be5fb6a1
commit
34d9053819
1 changed files with 10 additions and 26 deletions
|
@ -5,19 +5,11 @@ module Devise
|
|||
# %w( get post patch put head delete xml_http_request
|
||||
# xhr get_via_redirect post_via_redirect
|
||||
# ).each do |method|
|
||||
%w( get post put ).each do |method|
|
||||
if Devise::Test.rails5_and_up?
|
||||
define_method(method) do |url, options={}|
|
||||
if options.empty?
|
||||
super url
|
||||
else
|
||||
super url, options
|
||||
end
|
||||
end
|
||||
else
|
||||
define_method(method) do |url, options={}|
|
||||
if options[:xhr]==true
|
||||
xml_http_request __method__, url, options[:params] || {}, options[:headers]
|
||||
unless Devise::Test.rails5_and_up?
|
||||
%w( get post put ).each do |method|
|
||||
define_method(method) do |url, options = {}|
|
||||
if options[:xhr] == true
|
||||
xml_http_request __method__, url, options[:params] || {}, options[:headers]
|
||||
else
|
||||
super url, options[:params] || {}, options[:headers]
|
||||
end
|
||||
|
@ -30,19 +22,11 @@ module Devise
|
|||
# %w( get post patch put head delete xml_http_request
|
||||
# xhr get_via_redirect post_via_redirect
|
||||
# ).each do |method|
|
||||
%w( get post put ).each do |method|
|
||||
if Devise::Test.rails5_and_up?
|
||||
define_method(method) do |action, options={}|
|
||||
if options.empty?
|
||||
super action
|
||||
else
|
||||
super action, options
|
||||
end
|
||||
end
|
||||
else
|
||||
define_method(method) do |action, options={}|
|
||||
if options[:xhr]==true
|
||||
xml_http_request __method__, action, options[:params] || {}, options[:headers]
|
||||
unless Devise::Test.rails5_and_up?
|
||||
%w( get post put ).each do |method|
|
||||
define_method(method) do |action, options = {}|
|
||||
if options[:xhr] == true
|
||||
xml_http_request __method__, action, options[:params] || {}, options[:headers]
|
||||
else
|
||||
super action, options[:params] || {}, options[:headers]
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue