Skip to content

Instantly share code, notes, and snippets.

@weavenet
Created August 7, 2013 05:07
Show Gist options
  • Save weavenet/6171363 to your computer and use it in GitHub Desktop.
Save weavenet/6171363 to your computer and use it in GitHub Desktop.
Ruby method to stub out ENV variables in Rspec.
module EnvVar
def set_env_var(name, value)
ENV.stub(:[])
ENV.stub(:[]).with(name).and_return(value)
end
end
@henrik
Copy link

henrik commented Feb 23, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment