1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
# Specs: # Equivalent Unit Tests:
###############################################################################
describe Thingy do # class TestThingy < Minitest::Test
before do # def setup
# super
do_some_setup # do_some_setup
end # end
#
it "should do the first thing" do # def test_first_thing
_(1).must_equal 1 # assert_equal 1, 1
end # end
# end
#
describe SubThingy do # class TestSubThingy < TestThingy
before do # def setup
# super
do_more_setup # do_more_setup
end # end
#
it "should do the second thing" do # def test_second_thing
_(2).must_equal 2 # assert_equal 2, 2
end # end
end # end
end #
#
###############################################################################
# runs 2 specs # runs 3 tests
###############################################################################
# The specs generate:
class ThingySpec < Minitest::Spec
def setup
super
do_some_setup
end
def test_should_do_the_first_thing
_(1).must_equal 1
end
end
class SubThingySpec < ThingySpec
def setup
super
do_more_setup
end
# because only setup/teardown is inherited, not specs
remove_method :test_should_do_the_first_thing
def test_should_do_the_second_thing
_(2).must_equal 2
end
end
|