From 8bd6a4755c79616d84ca99be105822225c3b46e4 Mon Sep 17 00:00:00 2001
From: Stan Lo <stan.lo@shopify.com>
Date: Thu, 7 Mar 2024 13:46:06 +0800
Subject: [PATCH 1/2] Improve irb_spec's home setup

Before v1.12, IRB avoids loading `~/.irbrc` if the project folder has
a `.irbrc` file. So to avoid loading dev's `~/.irbrc`, cfe908c added an
empty irbrc fixture as a workaround.

However, because IRB v1.12 starts loading `~/.irbrc` even if the project
folder has a `.irbrc` file, the workaround no longer works.

This commit removes the workaround and uses altering `HOME` environment
variable to avoid loading `.irbrc` from devs' home directory instead.
---
 core/binding/irb_spec.rb | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/core/binding/irb_spec.rb b/core/binding/irb_spec.rb
index b3bc274f78..bc6c602a8e 100644
--- a/core/binding/irb_spec.rb
+++ b/core/binding/irb_spec.rb
@@ -1,11 +1,19 @@
 require_relative '../../spec_helper'
 
 describe "Binding#irb" do
+  before :each do
+    @env_home = ENV["HOME"]
+    ENV["HOME"] = CODE_LOADING_DIR
+  end
+
+  after :each do
+    ENV["HOME"] = @env_home
+  end
+
   it "creates an IRB session with the binding in scope" do
     irb_fixture = fixture __FILE__, "irb.rb"
-    irbrc_fixture = fixture __FILE__, "irbrc"
 
-    out = IO.popen([{"IRBRC"=>irbrc_fixture}, *ruby_exe, irb_fixture], "r+") do |pipe|
+    out = IO.popen([*ruby_exe, irb_fixture], "r+") do |pipe|
       pipe.puts "a ** 2"
       pipe.puts "exit"
       pipe.readlines.map(&:chomp)

From 23927d1014ccf8cd4a9a3a76abf0431c74249152 Mon Sep 17 00:00:00 2001
From: Stan Lo <stan.lo@shopify.com>
Date: Fri, 8 Mar 2024 17:25:21 +0800
Subject: [PATCH 2/2] Remove unneeded fixture file

---
 core/binding/fixtures/irbrc | 1 -
 1 file changed, 1 deletion(-)
 delete mode 100644 core/binding/fixtures/irbrc

diff --git a/core/binding/fixtures/irbrc b/core/binding/fixtures/irbrc
deleted file mode 100644
index 2bc12af2f7..0000000000
--- a/core/binding/fixtures/irbrc
+++ /dev/null
@@ -1 +0,0 @@
-# empty configuration