Sha256: fada8bf658d6d9dd8fc26cc397cc0ca98eb3b396b7877c44e1da2d7ccaed0760
Contents?: true
Size: 1.1 KB
Versions: 20
Compression:
Stored size: 1.1 KB
Contents
# frozen_string_literal: true # Backport the Rails 5 controller test methods to Rails 4 module BackportTestHelpers def delete(*args) (action, rest) = *args rest ||= {} @request.env['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest' if rest[:xhr] super(action, rest[:params]) end def get(*args) (action, rest) = *args rest ||= {} @request.env['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest' if rest[:xhr] super(action, rest[:params]) end def post(*args) (action, rest) = *args rest ||= {} body = rest[:body] @request.env['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest' if rest[:xhr] if body super(action, body, rest.except(:params).merge(rest[:params])) else super(action, rest[:params]) end end def put(*args) (action, rest) = *args rest ||= {} @request.env['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest' if rest[:xhr] super(action, rest[:params]) end def patch(*args) (action, rest) = *args rest ||= {} @request.env['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest' if rest[:xhr] super(action, rest[:params]) end end
Version data entries
20 entries across 20 versions & 1 rubygems