Skip to content

Instantly share code, notes, and snippets.

@domcleal
Created March 22, 2017 14:25
Show Gist options
  • Save domcleal/3444b61b89f8200e83a60b0f15d426e2 to your computer and use it in GitHub Desktop.
Save domcleal/3444b61b89f8200e83a60b0f15d426e2 to your computer and use it in GitHub Desktop.
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
gem "rails", github: "rails/rails"
end
require "action_dispatch"
require "action_dispatch/http/parameters"
require "minitest/autorun"
require "rack/test"
class BugTest < Minitest::Test
def test_catches_parseerror
begin
new_parseerror
assert false, "should have raised ParseError"
rescue ActionDispatch::ParamsParser::ParseError
assert true, "caught ParseError"
end
end
private
def new_parseerror
1/0
rescue
raise ActionDispatch::ParamsParser::ParseError.new
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment