[Backgroundrb-devel] Setting environment
Chris T
ctmailinglists at googlemail.com
Sat Oct 14 05:35:30 EDT 2006
Not sure this is known behaviour but it seems that if want to set the
environment to, for example, test, and you want to use Active Record you
have to both explicitly set the RAILS_ENV and the BackgrounDRb environment.
So, if you have a config file backgroundrb_test.yml (as well as the
default) and set the environment to test in that, this is what *seems*
to happen:
$ script/backgroundrb/start # starts backgroundrb in development
environment and uses AR in development environment
$ script/backgroundrb/start -c backgroundrb_test # starts
backgroundrb in test environment but uses AR in development
environment, leading to weird shit with fixtures and so on.
$ script/backgroundrb/start -c backgroundrb_test # starts
backgroundrb in test environment but uses AR in development
environment, leading to weird shit with fixtures and so on.
$ RAILS_ENV=test script/backgroundrb/start # starts backgroundrb in
development environment but I think uses AR in test environment --
not sure what end result is here.
$ RAILS_ENV=test script/backgroundrb/start -c backgroundrb_test #
starts backgroundrb in test environment and AR in test environment.
All tickety-boo and working as expected.
As I said, this may be expected behaviour, but it confused me for a
while and meant my tests (which use mocks) seemed to behaving very
oddly. Hope this helps someone else in the future.
Cheers
CT
More information about the Backgroundrb-devel
mailing list