Stefan Lang
3/11/2008 1:45:00 AM
2008/3/10, Drew Olson <olsonas@gmail.com>:
> Stefan Lang wrote:
> > 2008/3/10, Drew Olson <olsonas@gmail.com>:
> >> I've got a rake TestTask that I have set a global variable in specific
> >> cases (I know, I know, tsk tsk). However, this value doesn't seem to be
> >> available to my tests. ...
> >
> > The tests are run in new ruby processes, not in the
> > rake process itself.
> >
> > Stefan
>
>
> Ugh, I had suspicions this was the case. How does one pass information
> (for example, which config file to use) that is given to the rake task
> at the command line to the test case itself?
Simple parameters can be passed via environment variables.
So put ENV["SOME_VAR"] = foo in the Rakefile and access
it via ENV["SOME_VAR"] in the test process.
You can also set an environment variable on the rake commandline:
$ rake some_task SOME_VAR=foo
Stefan