From 09c2eaf107938f0cf3b1463870639eb9eb757e72 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Fri, 4 Mar 2022 10:18:43 -0500 Subject: [PATCH] Add an easy way to print `ExecResult` in tests Signed-off-by: Alexandre Terrasa --- spec/helpers/mock_project.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/spec/helpers/mock_project.rb b/spec/helpers/mock_project.rb index f1647f83d..36fa07db8 100644 --- a/spec/helpers/mock_project.rb +++ b/spec/helpers/mock_project.rb @@ -66,9 +66,22 @@ def reset_bundler_version end class ExecResult < T::Struct + extend T::Sig + const :out, String const :err, String const :status, T::Boolean + + sig { returns(String) } + def to_s + <<~STR + ########## STDOUT ########## + #{out.empty? ? "" : out} + ########## STDERR ########## + #{err.empty? ? "" : err} + ########## STATUS: #{status} ########## + STR + end end # Run `bundle install` in this project context (unbundled env)