Sha256: e27a532694af0377ed2e4b4b8d540adb12187a29eec73c56386891da7f6c6362

Contents?: true

Size: 484 Bytes

Versions: 68

Compression:

Stored size: 484 Bytes

Contents

# Backport the Rails 5 controller test methods to Rails 4
module BackportTest
  [:delete, :get, :post, :put, :patch].each do |http_action|
    define_method(http_action) do |*args|
      (action, rest) = *args
      rest ||= {}
      if rest[:xhr]
        @request.env['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'
        @request.env['HTTP_ACCEPT'] ||= [Mime::JS, Mime::HTML, Mime::XML, 'text/xml', Mime::ALL].join(', ')
      end
      super(action, rest[:params])
    end
  end
end

Version data entries

68 entries across 68 versions & 4 rubygems

Version Path
geo_concerns-0.0.9 spec/support/backport_test.rb
curation_concerns-1.6.0 spec/support/backport_test.rb
geo_concerns-0.0.8 spec/support/backport_test.rb
blacklight-6.6.1 spec/support/backport_test.rb
blacklight-6.6.0 spec/support/backport_test.rb
geo_concerns-0.0.7 spec/support/backport_test.rb
curation_concerns-1.5.0 spec/support/backport_test.rb
blacklight-6.5.0 spec/support/backport_test.rb