What is the reasoning behind MiniTest’s lack of support for
before :all
/ after :all
?
I can understand that one should keep setup procedures to a minimum,
but are their not use cases where pre-testcase setup is really needed
– logging into a database or service, for example?
What is the conventional thinking on this topic?
Thomas S. wrote in post #1015734:
What is the conventional thinking on this topic?
Maybe I’m wrong but I was going through some Ruby standard libraries
just the other day and I saw this:
Define a ‘before’ action. Inherits the way normal methods should.
NOTE: +type+ is ignored and is only there to make porting easier.
Equivalent to MiniTest::Unit::TestCase#setup.
def self.before type = :each, &block
raise “unsupported before type: #{type}” unless type == :each
define_inheritable_method :setup, &block
end
Define an ‘after’ action. Inherits the way normal methods should.
NOTE: +type+ is ignored and is only there to make porting easier.
Equivalent to MiniTest::Unit::TestCase#teardown.
def self.after type = :each, &block
raise “unsupported after type: #{type}” unless type == :each
define_inheritable_method :teardown, &block
end
Keep in mind I don’t use minitest so that might not be what you’re
after.
-Luke
On Aug 9, 5:16pm, luke gruber [email protected] wrote:
NOTE: +type+ is ignored and is only there to make porting easier.
Equivalent to MiniTest::Unit::TestCase#teardown.
def self.after type = :each, &block
raise “unsupported after type: #{type}” unless type == :each
define_inheritable_method :teardown, &block
end
Keep in mind I don’t use minitest so that might not be what you’re
after.
That’s just elucidating my question. Read the line:
raise "unsupported before type: #{type}" unless type == :each
I’m asking about :all
,
I’m asking about :all
,
You probably found this already, but just in case:
http://bfts.rubyforge.org/minitest/MiniTest/Unit.html#method-c-after_tests
I don’t think Minitest supports a before_tests though
there’s a github repo for that functionality apparently:
http://techno-weenie.net/2010/5/4/escaping-your-test-suite-with-your-life/
-Luke