2

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.

Mike Jr
  • 187
  • 1
  • 7
  • 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 03:05

1 Answers1

1

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
Pierre Carrier
  • 2,617
  • 18
  • 28