views:

27

answers:

1

My web application writes some kind of log during runtime. I don't want to write this log when running my test suite using cucumber.

So, how can I check my current runtime environment (TEST, DEV or PROD)?

I'm looking for the C equivalent to i.e. :
#ifdef DEBUG
   // just run in debug mode
#endif

Thank you very much for helping me on this.

+1  A: 

Try this for the if condition:

if ENV['RAILS_ENV'] == "test"
    # Insert Code Here
end

(replace 'test' with 'development' or 'production' as needed)

ridecar2
Exactly what I wanted.Thank you!
hkda150
`Rails.env` is the preferred way to do this now.
John Topley
Thanks, I'll read up on that then.
ridecar2