module EnvHelper
  def stub_env_variables(vars)
    allow(ENV).to receive(:[]).and_call_original
    vars.each do |variable, value|
      allow(ENV).to receive(:[]).with(variable.to_s).and_return(value)
    end
  end

  def stub_env_variable(key, value)
    stub_env_variables({key => value})
  end
end

RSpec.configure do |config|
  config.include EnvHelper
end
