Sha256: 2e16de3c8425b9fab0633451ac33765551a2579c37ef0cf57136cf6ef7d45c80

Contents?: true

Size: 943 Bytes

Versions: 5

Compression:

Stored size: 943 Bytes

Contents

require 'test/unit'
require File.dirname(__FILE__) + '/../lib/qtext'
require 'shoulda'

# Allow running of setup and teardown things before
# an entire suite, instead of just one per test
class SuiteWrapper < Test::Unit::TestSuite
  attr_accessor :tests
  
  def initialize( name, test_case )
    super( name )
    @test_case = test_case
  end
  
  def startup
  end
  
  def shutdown
  end
  
  def run( *args )
    startup
    @test_case.startup if @test_case.respond_to? :startup
    retval = super
    @test_case.shutdown if @test_case.respond_to? :shutdown
    shutdown
    retval
  end
end

module Test
  module Unit
    class TestCase
      unless respond_to? :old_suite
        class << self
          alias_method :old_suite, :suite
        end
        
        def self.suite
          os = old_suite
          sw = SuiteWrapper.new( os.name, self )
          sw.tests = os.tests
          sw
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
qtext-0.6.7 test/test_helper.rb
qtext-0.6.6 test/test_helper.rb
qtext-0.6.5 test/test_helper.rb
qtext-0.6.2 test/test_helper.rb
qtext-0.6.0 test/test_helper.rb