Sha256: af21a598e6cf2a633fa6cb832246e8f725c0142fec32ca2201274251c64049f9

Contents?: true

Size: 720 Bytes

Versions: 3

Compression:

Stored size: 720 Bytes

Contents

require File.expand_path(File.join("..", "lib", "contest"),
                         File.dirname(__FILE__))

class BaseTest < Test::Unit::TestCase
  def setup
    @order = []
    @order << "Grandparent Setup"
  end

  def teardown
    @order << "Grandparent Teardown"

    assert_equal ["Grandparent Setup", "Parent Setup", "Child Setup", "Test Case", "Child Teardown", "Parent Teardown", "Grandparent Teardown"], @order
  end
end

class MidLayerTest < BaseTest
  setup { @order << "Parent Setup" }
  teardown { @order << "Parent Teardown" }
end

class LeafTest < MidLayerTest
  setup { @order << "Child Setup" }
  teardown { @order << "Child Teardown" }

  test "my actual test" do
    @order << "Test Case"
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
tnargav-1.3.3 vendor/bundle/ruby/1.9.1/gems/contest-0.1.3/test/setup_and_teardown_order_test.rb
tnargav-1.2.3 vendor/bundle/ruby/1.9.1/gems/contest-0.1.3/test/setup_and_teardown_order_test.rb
contest-0.1.3 test/setup_and_teardown_order_test.rb