Is there an equivalent to RSpec's before(:all) in MiniTest?
Posted
by bergyman
on Stack Overflow
See other posts from Stack Overflow
or by bergyman
Published on 2010-03-31T22:38:41Z
Indexed on
2010/03/31
22:43 UTC
Read the original article
Hit count: 208
ruby
|unit-testing
Since it now seems to have replaced TestUnit in 1.9.1, I can't seem to find an equivalent to this. There ARE times when you really just want a method to run once for the suite of tests.
For now I've resorted to some lovely hackery along the lines of:
Class ParseStandardWindTest < MiniTest::Unit::TestCase
@@reader ||= PolicyDataReader.new(Time.now)
@@data ||= @@reader.parse
def test_stuff
transaction = @@data[:transaction]
assert true, transaction
end
end
© Stack Overflow or respective owner