Reputation: 131
In ruby how do you pass in a variable to use in Rspec.configure via the command line? if I try something like env SETUP=blah rspec spec/debug_spec.rb
I will get the error block in <top (required)>': uninitialized constant SETUP (NameError)
. I get the same outcome attempting to get the value with temp = SETUP
and temp = ENV[SETUP]
in Rspec configure. I want to use this variable to guide how a number of global variables are setup. Something like tags is not suitable in my use case.
Upvotes: 2
Views: 835
Reputation: 672
I feel you're just missing the quotes for the string (that's why you get the NameError
exception), so
If your command line is like this:
SETUP=blah rspec spec/debug_spec.rb
The in your spec_helper.rb
, you would use it like this:
temp = ENV['SETUP']
Upvotes: 2