From d983fb6361566c8266edc82d94e165c1dd128e19 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Sun, 25 Dec 2022 15:14:31 +0100 Subject: [PATCH] Set up Aruba environment properly in 'uses aruba API' shared context --- spec/support/shared_contexts/aruba.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/spec/support/shared_contexts/aruba.rb b/spec/support/shared_contexts/aruba.rb index d7889547b..3018dbf11 100644 --- a/spec/support/shared_contexts/aruba.rb +++ b/spec/support/shared_contexts/aruba.rb @@ -17,7 +17,7 @@ def create_test_files(files, data = "a") end end - before do + around do |example| klass = Class.new do include Aruba::Api @@ -36,5 +36,12 @@ def set_tag(tag_name, value) if @aruba.aruba.current_directory[0] == "/" raise "We must work with relative paths, everything else is dangerous" end + + # Use configured home directory as HOME + @aruba.set_environment_variable "HOME", aruba.config.home_directory + + @aruba.with_environment do + example.run + end end end