What is the conventional way to set a variable once to be used by all examples in an RSpec suite?
I currently set a global variable in spec_helper that checks whether the specs are being run in a "debug mode"
$debug = ENV.key?('DEBUG') && (ENV['DEBUG'].casecmp('false') != 0) && (ENV['DEBUG'].casecmp('no') != 0)
How do I make this information available to all the examples in the suite without using a global variable and without re-computing the value for each context and/or example? (My understanding is that using a before(:all) block would re-compute it once per context; but, that before(:suite) can't be used to set instance variables.)
(Note: I'm asking more to learn about good design that to address this specific problem. I know one global isn't a big deal.)