summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDavid Rodriguez <deivid.rodriguez@riseup.net>2024-01-30 19:17:23 +0100
committergit <svn-admin@ruby-lang.org>2024-01-31 12:14:03 +0000
commit171d4bec256e0ac9774b1a51d49e0e2930b0c47b (patch)
treea6645edeefa8f2c242b26fc7501efbb16f3de898 /spec
parent816ce53a8ad86d886e57307cb181ebe3570366c7 (diff)
[rubygems/rubygems] Fix some flaky test failures on Windows
Some specs assert empty output, but sometimes they print warnings about redefinition warnings. Ignore those until they are fixed upstream. https://github.com/rubygems/rubygems/commit/0cd3b6dbae
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/support/command_execution.rb15
-rw-r--r--spec/bundler/support/helpers.rb4
2 files changed, 16 insertions, 3 deletions
diff --git a/spec/bundler/support/command_execution.rb b/spec/bundler/support/command_execution.rb
index 68e5c56c75..5639fda3b6 100644
--- a/spec/bundler/support/command_execution.rb
+++ b/spec/bundler/support/command_execution.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module Spec
- CommandExecution = Struct.new(:command, :working_directory, :exitstatus, :stdout, :stderr) do
+ CommandExecution = Struct.new(:command, :working_directory, :exitstatus, :original_stdout, :original_stderr) do
def to_s
"$ #{command}"
end
@@ -11,6 +11,19 @@ module Spec
@stdboth ||= [stderr, stdout].join("\n").strip
end
+ def stdout
+ original_stdout
+ end
+
+ # Can be removed once/if https://github.com/oneclick/rubyinstaller2/pull/369 is resolved
+ def stderr
+ return original_stderr unless Gem.win_platform?
+
+ original_stderr.split("\n").reject do |l|
+ l.include?("operating_system_defaults")
+ end.join("\n")
+ end
+
def to_s_verbose
[
to_s,
diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb
index 64ed0553b8..1ad9cc78ca 100644
--- a/spec/bundler/support/helpers.rb
+++ b/spec/bundler/support/helpers.rb
@@ -193,8 +193,8 @@ module Spec
stdout_read_thread = Thread.new { stdout.read }
stderr_read_thread = Thread.new { stderr.read }
- command_execution.stdout = stdout_read_thread.value.strip
- command_execution.stderr = stderr_read_thread.value.strip
+ command_execution.original_stdout = stdout_read_thread.value.strip
+ command_execution.original_stderr = stderr_read_thread.value.strip
status = wait_thr.value
command_execution.exitstatus = if status.exited?