Sha256: 11a3fc380ce02a32a1f87db7f6e11b89568510d49ec8458fa04d207a1a257961

Contents?: true

Size: 1.53 KB

Versions: 13

Compression:

Stored size: 1.53 KB

Contents

module Devise
  class IntegrationTest < ActionDispatch::IntegrationTest
    # %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 Rails.version >= '5.0.0'
        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]
          else
            super url, options[:params] || {}, options[:headers]
          end
        end
      end
    end
  end

  class ControllerTestCase < ActionController::TestCase
    # %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 Rails.version >= '5.0.0'
        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]
          else
            super action, options[:params] || {}, options[:headers]
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
devise-4.3.0 test/support/http_method_compatibility.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/devise-4.2.1/test/support/http_method_compatibility.rb
devise-4.2.1 test/support/http_method_compatibility.rb
devise-4.2.0 test/support/http_method_compatibility.rb
devise-4.0.3 test/support/http_method_compatibility.rb
devise-4.1.1 test/support/http_method_compatibility.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/devise-4.1.0/test/support/http_method_compatibility.rb
devise-4.1.0 test/support/http_method_compatibility.rb
devise-4.0.2 test/support/http_method_compatibility.rb
devise-4.0.1 test/support/http_method_compatibility.rb
devise-4.0.0 test/support/http_method_compatibility.rb
devise-4.0.0.rc2 test/support/http_method_compatibility.rb
devise-4.0.0.rc1 test/support/http_method_compatibility.rb