Sha256: 074ca068d20e0bb067738c72668f00721c825ad3a78b1aec68a83274f9c50081

Contents?: true

Size: 629 Bytes

Versions: 2

Compression:

Stored size: 629 Bytes

Contents

# Rails 5 deprecates calling HTTP action methods with positional arguments
# in favor of keyword arguments. However, the keyword argument form is only
# supported in Rails 5+. Since we support back to 4, we need some sort of shim
# to avoid super noisy deprecations when running tests.
module HTTPMethodShim
  def get(path, params = nil, *args)
    if args.any?
      raise ArgumentError, "Unexpected arguments passed to shim: #{args.inspect}"
    else
      super(path, params: params)
    end
  end
end

if Rails::VERSION::MAJOR >= 5
  RSpec.configure do |config|
    config.include HTTPMethodShim, type: :controller
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
high_voltage-3.1.1 spec/support/http_method_shim.rb
high_voltage-3.1.0 spec/support/http_method_shim.rb