summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSutou Kouhei <kou@clear-code.com>2026-01-18 22:48:42 +0900
committergit <svn-admin@ruby-lang.org>2026-01-19 07:10:42 +0000
commitfb75e99efea67ad3c2f802817345f749ffaf202c (patch)
treebb2a6cb4faf75221acdfa1a4ca4adf1e28e92dd2 /test
parent631bf19b37e4bfb16b1af2b88190b4622ca567e5 (diff)
[ruby/rubygems] Add missing `.binmode` for `Gem::AtomicFileWriter`
In https://github.com/ruby/rubygems/pull/9202, I commented that `temp_file.binmode` is redundant. But I was wrong. We need `temp_file.binmode` even when we specify `File::BINARY`. Sorry. https://github.com/ruby/rubygems/commit/d9f1f5c6a6
Diffstat (limited to 'test')
-rw-r--r--test/rubygems/test_gem_util_atomic_file_writer.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_util_atomic_file_writer.rb b/test/rubygems/test_gem_util_atomic_file_writer.rb
new file mode 100644
index 0000000000..e011a38ad4
--- /dev/null
+++ b/test/rubygems/test_gem_util_atomic_file_writer.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+require_relative "helper"
+require "rubygems/util/atomic_file_writer"
+
+class TestGemUtilAtomicFileWriter < Gem::TestCase
+ def test_external_encoding
+ Gem::AtomicFileWriter.open(File.join(@tempdir, "test.txt")) do |file|
+ assert_equal(Encoding::ASCII_8BIT, file.external_encoding)
+ end
+ end
+end