Created
June 2, 2016 12:30
-
-
Save maltoe/a1b9bfc83be1c0eaef208ade9cbdfdad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_controller/railtie' | |
require 'minitest/autorun' | |
require 'rack/test' | |
class BugTest < ActiveSupport::TestCase | |
include Rack::Test::Methods | |
def test_to_json_with_non_ascii_data | |
t = Tempfile.new 'foo' | |
t.binmode # This is not even necessary, but AFAIK is set for our uploads. | |
t.puts "\x80".force_encoding('ASCII-8BIT') | |
t.rewind | |
uf = ActionDispatch::Http::UploadedFile.new(tempfile: t) | |
assert_nothing_raised { uf.to_json } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment