From 706e92f7117fee32e0d40b605f0b6c6b8cb86348 Mon Sep 17 00:00:00 2001 From: Colin Dean Date: Mon, 18 Dec 2023 13:01:31 -0500 Subject: [PATCH 1/2] Run tests on Ruby 3.1 Now that Homebrew 4.2.0 runs on Ruby 3.1, let's bump to that. https://brew.sh/2023/12/18/homebrew-4.2.0/ --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7bd2bb9d7..b1680ddff 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -35,7 +35,7 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: '2.6' + ruby-version: '3.1' bundler-cache: true - name: Run RSpec tests From fe114094f71534880a85eed88602cbfcd3f46a28 Mon Sep 17 00:00:00 2001 From: Colin Dean Date: Mon, 18 Dec 2023 20:42:24 +0000 Subject: [PATCH 2/2] Duplicate frozen CHILD_STATUS to allow rspec proxy Without this, a test fails because rspec is unable to proxy $CHILD_STATUS/$?. I looked around for another way to handle this but there's no way to unfreeze except through duplication. ``` 1) Bundle when the system call fails emits all stdout output even if verbose is false Failure/Error: success = st.success? ArgumentError: Cannot proxy frozen objects, rspec-mocks relies on proxies for method stubbing and expectations. # ./lib/bundle/bundle.rb:18:in `block in system' # ./lib/bundle/bundle.rb:12:in `popen' # ./lib/bundle/bundle.rb:12:in `system' # ./spec/bundle_utils_spec.rb:22:in `block (4 levels) in ' # ./spec/bundle_utils_spec.rb:22:in `block (3 levels) in ' # ./spec/spec_helper.rb:73:in `block (3 levels) in ' # ./spec/spec_helper.rb:73:in `block (2 levels) in ' # ------------------ # --- Caused by: --- # FrozenError: # can't modify frozen object: pid 0 exit 0 # ./lib/bundle/bundle.rb:18:in `block in system' ``` --- lib/bundle/bundle.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bundle/bundle.rb b/lib/bundle/bundle.rb index ffb0b6f90..c249dbb6f 100644 --- a/lib/bundle/bundle.rb +++ b/lib/bundle/bundle.rb @@ -14,7 +14,7 @@ def system(cmd, *args, verbose: false) logs << buf end Process.wait(pipe.pid) - success = $CHILD_STATUS.success? + success = $CHILD_STATUS.dup.success? pipe.close end puts logs.join unless success