Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to run RSpec examples in multiple environments. I want to pass a flag into RSpec that a case statement can key off so as to set the proper values. This is such a natural thing to want to do that I must be overlooking the obvious. Thank you for your help.

share|improve this question
    
Is this more of a programming question or a server question? I'm not sure what you're trying to accomplish. –  Aaron Sep 27 '11 at 3:05
add comment

1 Answer

up vote 1 down vote accepted

It depends on how RSpec is invoked.

In general I'd avoid command-line parameters as every piece of the stack is always competing to read them in its own way, and the semantics are too loose (it's only sequence of character strings).

A simple and quite generic mechanism would be environment variables. Most execution contexts will allow you to set them easily, including continuous integration services and of course your shell.

% FOO=hop ruby -e "puts ENV['FOO']"
hop
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.