Detect test cases are currently running

How do I know in my code that Im in the middle of running test cases.

I thought there was a “$TESTING” variable that I could check but that
one is always empty.

I would like to be able to know whether or not to load in test helpers
in the init.rb files of plugins.

You can always just set $TESTING=true in your test_helper file and use
it that way.

-Ezra

You can compare the RAILS_ENV constant. If it is “test”, then you’re
running tests.

RAILS_ENV == “test”

  • Jamis