Skip to content

Instantly share code, notes, and snippets.

@groyoh
Created October 24, 2016 09:08
Show Gist options
  • Save groyoh/d6a29edf266ef9b2e370fdbc4c9032a3 to your computer and use it in GitHub Desktop.
Save groyoh/d6a29edf266ef9b2e370fdbc4c9032a3 to your computer and use it in GitHub Desktop.
AMS #1946
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 'activesupport', require: 'active_support/all'
end
class FailCase
def as_json(opts = {})
{ 'infinity' => 1/0.0 }
end
end
FailCase.new.to_json
__END__
Fetching gem metadata from https://rubygems.org/..............
Fetching version metadata from https://rubygems.org/.
Resolving dependencies...
Using concurrent-ruby 1.0.2
Using i18n 0.7.0
Using minitest 5.9.1
Using thread_safe 0.3.5
Using bundler 1.13.6
Using tzinfo 1.2.2
Using activesupport 5.0.0.1
/home/groyoh/.rbenv/versions/2.3.1/lib/ruby/2.3.0/json/common.rb:224:in `generate': 836: Infinity not allowed in JSON (JSON::GeneratorError)
from /home/groyoh/.rbenv/versions/2.3.1/lib/ruby/2.3.0/json/common.rb:224:in `generate'
from /home/groyoh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/json/encoding.rb:99:in `stringify'
from /home/groyoh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/json/encoding.rb:33:in `encode'
from /home/groyoh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/json/encoding.rb:20:in `encode'
from /home/groyoh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/core_ext/object/json.rb:37:in `to_json'
from ams_1946.rb:20:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment