From 9b6dafbb4a99766f378d4f5575bc314ae1fff08d Mon Sep 17 00:00:00 2001 From: Stefanni Brasil Date: Mon, 22 Apr 2024 17:28:30 -0600 Subject: [PATCH] Print out error messages for debugging --- .../superglue_installation_acceptance.rb | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/superglue_rails/test/acceptance/superglue_installation_acceptance.rb b/superglue_rails/test/acceptance/superglue_installation_acceptance.rb index 9fe89f6f..6b6453e8 100644 --- a/superglue_rails/test/acceptance/superglue_installation_acceptance.rb +++ b/superglue_rails/test/acceptance/superglue_installation_acceptance.rb @@ -40,15 +40,23 @@ def setup end def successfully(command, silent = false) - silencer = if silent - "1>/dev/null" + redirection = if silent + "1>/dev/null 2>&1" # Redirect both stdout and stderr to /dev/null else - "" + "2>&1" # Merge stderr with stdout end - return_value = system("#{command} #{silencer}") + # Execute the command with the specified redirection + output = `#{command} #{redirection}` - assert return_value + # Check the return status of the command + success = $?.success? + + # Raise an error if the command execution was not successful + raise "Command '#{command}' failed with error: #{output}" unless success + + # Return the combined output + output end def update_package_json @@ -118,8 +126,8 @@ def test_installation FileUtils.rm_rf("testapp") generate_test_app_7 "testapp" Dir.chdir("testapp") do - successfully "bundle install" successfully "yarn add react react-dom @babel/preset-react" + successfully("bin/rails about") FileUtils.rm_f("public/index.html") install_superglue