From 036f6f04f5cf14e18639248baebf59f1b7b4f0ba Mon Sep 17 00:00:00 2001 From: MAEDA Go Date: Sun, 16 Nov 2025 17:19:18 +0900 Subject: [PATCH 1/4] Improve Redmine::MockFile to better mimic File behavior --- test/test_helper.rb | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index a59f70c85..7984359c1 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -299,23 +299,15 @@ class ActiveSupport::TestCase end module Redmine - class MockFile - attr_reader :size, :original_filename, :content_type + class MockFile < StringIO + attr_reader :original_filename, :content_type def initialize(options={}) - @size = options[:size] || 32 @original_filename = options[:original_filename] || options[:filename] @content_type = options[:content_type] - @content = options[:content] || 'x'*size - end - - def read(*args) - if @eof - false - else - @eof = true - @content - end + size = options[:size] || 32 + content = options[:content] || 'x' * size + super(content) end end -- 2.50.1