2022-03-22 23:07:30 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
# rubocop: disable RSpec/EnvAssignment
|
|
|
|
|
|
|
|
RSpec.configure do |config|
|
|
|
|
config.around(:each, :fips_mode) do |example|
|
2022-03-28 11:07:51 -04:00
|
|
|
set_fips_mode(true) do
|
|
|
|
example.run
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
config.around(:each, fips_mode: false) do |example|
|
|
|
|
set_fips_mode(false) do
|
|
|
|
example.run
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def set_fips_mode(value)
|
2022-03-22 23:07:30 -04:00
|
|
|
prior_value = ENV["FIPS_MODE"]
|
2022-03-28 11:07:51 -04:00
|
|
|
ENV["FIPS_MODE"] = value.to_s
|
2022-03-22 23:07:30 -04:00
|
|
|
|
2022-03-28 11:07:51 -04:00
|
|
|
yield
|
2022-03-22 23:07:30 -04:00
|
|
|
|
|
|
|
ENV["FIPS_MODE"] = prior_value
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# rubocop: enable RSpec/EnvAssignment
|