diff --git a/cucumber/_authenticators_common/features/support/hooks.rb b/cucumber/_authenticators_common/features/support/hooks.rb index c4d922e03b..8435668100 100644 --- a/cucumber/_authenticators_common/features/support/hooks.rb +++ b/cucumber/_authenticators_common/features/support/hooks.rb @@ -29,4 +29,17 @@ # share this code, and to it the api way (probably) creds.password = 'SEcret12!!!!' creds.save(raise_on_save_failure: true) + + # Save env to revert to it after the test + @env = {} + ENV.each do |key, value| + @env[key] = value + end +end + +After do + # Revert to original env + @env.each do |key, value| + ENV[key] = value + end end diff --git a/cucumber/api/features/support/hooks.rb b/cucumber/api/features/support/hooks.rb index 18ce5a5ee5..56f711ffe7 100644 --- a/cucumber/api/features/support/hooks.rb +++ b/cucumber/api/features/support/hooks.rb @@ -26,10 +26,21 @@ Account.find_or_create_accounts_resource admin_role = Role.create(role_id: "cucumber:user:admin") Credentials.new(role: admin_role).save(raise_on_save_failure: true) + + # Save env to revert to it after the test + @env = {} + ENV.each do |key, value| + @env[key] = value + end end After do FileUtils.remove_dir('cuke_export') if Dir.exists?('cuke_export') + + # Revert to original env + @env.each do |key, value| + ENV[key] = value + end end Before("@logged-in") do diff --git a/cucumber/authenticators/features/support/hooks.rb b/cucumber/authenticators/features/support/hooks.rb index 57ce6f8ad5..7daffa9fc9 100644 --- a/cucumber/authenticators/features/support/hooks.rb +++ b/cucumber/authenticators/features/support/hooks.rb @@ -24,4 +24,17 @@ # this code, and to it the api way (probably) creds.password = 'SEcret12!!!!' creds.save(raise_on_save_failure: true) + + # Save env to revert to it after the test + @env = {} + ENV.each do |key, value| + @env[key] = value + end +end + +After do + # Revert to original env + @env.each do |key, value| + ENV[key] = value + end end diff --git a/cucumber/policy/features/support/hooks.rb b/cucumber/policy/features/support/hooks.rb index 2af2af504f..9bd9c219ef 100644 --- a/cucumber/policy/features/support/hooks.rb +++ b/cucumber/policy/features/support/hooks.rb @@ -37,4 +37,17 @@ # this code, and to it the api way (probably) creds.password = 'SEcret12!!!!' creds.save(raise_on_save_failure: true) + + # Save env to revert to it after the test + @env = {} + ENV.each do |key, value| + @env[key] = value + end +end + +After do + # Revert to original env + @env.each do |key, value| + ENV[key] = value + end end