Sha256: 37fd794bfe8398cb13076cb40494ecf09cb32b2abeeb458519ef47ca5a776d24
Contents?: true
Size: 1.28 KB
Versions: 4
Compression:
Stored size: 1.28 KB
Contents
require 'test/unit' require 'shoulda' require File.dirname(__FILE__) + '/../lib/clevic' require File.dirname(__FILE__) + '/fixtures.rb' # Allow running of startup and shutdown things before # an entire suite, instead of just one per test class SuiteWrapper < Test::Unit::TestSuite attr_accessor :tests, :db def initialize( name, test_case ) super( name ) @test_case = test_case # define in fixtures.rb @db = $db end def startup CreateFlights.new( db ).up CreatePassengers.new( db ).up PopulateCachePassengers.new( db ).up Flight.columns Passenger.columns end def shutdown PopulateCachePassengers.new( db ).down CreatePassengers.new( db ).down CreateFlights.new( db ).down 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
clevic-0.13.0.b5 | test/test_helper.rb |
clevic-0.13.0.b3 | test/test_helper.rb |
clevic-0.13.0.b2 | test/test_helper.rb |
clevic-0.13.0.b1 | test/test_helper.rb |