LogoJiazhen Xie's blog

Rspec environmental Variable

By Jiazhen Xie on Oct 13, 2013
Rspec environmental Variable

What is Environment Variable?

Environment variables are variables passed to programs by the command line or the graphical shell. Though there are a number of environment variables that only affect the command line or graphical shell itself (such as PATH or HOME), there are also several that directly affect how Ruby scripts execute.

How to use it?

For example, in your spec, add a code:

something = ENV['SOMETHING']

Then in the command line, use:

SOMETHING=1000

Variable something will now be assigned to 1000.

© Copyright 2024 by Jiazhen Xie.