fix: REALLY set ARGV[0] in all tests

Phillip Davis created

turns out you need to set it in both test_helper and in em
- sgx_bwmsgsv2 references ARGV[0], so must set it before
requiring
- but each  test runs in its own fiber, and fibers don't share ARGV

Change summary

test/test_component.rb       | 1 -
test/test_helper.rb          | 3 +++
test/test_webhook_handler.rb | 1 -
3 files changed, 3 insertions(+), 2 deletions(-)

Detailed changes

test/test_component.rb 🔗

@@ -9,7 +9,6 @@ end
 
 class ComponentTest < Minitest::Test
 	def setup
-		ARGV[0] = 'component'
 		SGXbwmsgsv2.instance_variable_set(:@written, [])
 
 		def SGXbwmsgsv2.write_to_stream(s)

test/test_helper.rb 🔗

@@ -31,6 +31,8 @@ rescue LoadError, NameError
 	nil
 end
 
+ARGV[0] = "component"
+
 $VERBOSE = nil
 
 class FakeRedis
@@ -167,6 +169,7 @@ module Minitest
 				e = nil
 				EM.run do
 					Fiber.new {
+						ARGV[0] = "component"
 						begin
 							send("raw_#{m}")
 						rescue

test/test_webhook_handler.rb 🔗

@@ -9,7 +9,6 @@ end
 
 class WebhookHandlerTest < Minitest::Test
 	def setup
-		ARGV[0] = 'component'
 		SGXbwmsgsv2.instance_variable_set(:@written, [])
 
 		def SGXbwmsgsv2.write_to_stream(s)