Sha256: d5b4e7aae631165b36779de1673f7b63521b4248945ae5bc607bb7b7429374ec

Contents?: true

Size: 1.21 KB

Versions: 37

Compression:

Stored size: 1.21 KB

Contents

module Test
  module Unit
    class TestCase
      class << self
        # Tweaks to standard method so we don't get superclass methods and we don't
        # get weird default tests
        def suite # :nodoc:
          method_names = public_instance_methods - superclass.public_instance_methods
    
          tests = method_names.delete_if {|method_name| method_name !~ /^test./}
          suite = Test::Unit::TestSuite.new(name)
          
          tests.sort.each do |test|
            catch(:invalid_test) do
              suite << new(test)
            end
          end
          
          suite
        end
      end
    end

    class TestSuite
      # Runs the tests and/or suites contained in this
      # TestSuite.
      def run(result, &progress_block) # :nodoc:
        yield(STARTED, name)
        ivars_from_callback = @tests.first.run_all_callbacks(:before) if @tests.first.is_a?(Test::Unit::TestCase)
        @tests.each do |test|
          test.set_values_from_callbacks(ivars_from_callback) if ivars_from_callback
          test.run(result, &progress_block)
        end
        ivars_from_callback = @tests.first.run_all_callbacks(:after) if ivars_from_callback
        yield(FINISHED, name)
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 7 rubygems

Version Path
auser-poolparty-1.3.0 vendor/gems/context/lib/context/suite.rb
auser-poolparty-1.3.1 vendor/gems/context/lib/context/suite.rb
auser-poolparty-1.3.10 vendor/gems/context/lib/context/suite.rb
auser-poolparty-1.3.11 vendor/gems/context/lib/context/suite.rb
auser-poolparty-1.3.12 vendor/gems/context/lib/context/suite.rb
auser-poolparty-1.3.13 vendor/gems/context/lib/context/suite.rb
auser-poolparty-1.3.14 vendor/gems/context/lib/context/suite.rb
auser-poolparty-1.3.15 vendor/gems/context/lib/context/suite.rb
auser-poolparty-1.3.16 vendor/gems/context/lib/context/suite.rb
auser-poolparty-1.3.17 vendor/gems/context/lib/context/suite.rb
auser-poolparty-1.3.2 vendor/gems/context/lib/context/suite.rb
auser-poolparty-1.3.3 vendor/gems/context/lib/context/suite.rb
auser-poolparty-1.3.4 vendor/gems/context/lib/context/suite.rb
auser-poolparty-1.3.5 vendor/gems/context/lib/context/suite.rb
auser-poolparty-1.3.6 vendor/gems/context/lib/context/suite.rb
auser-poolparty-1.3.7 vendor/gems/context/lib/context/suite.rb
auser-poolparty-1.3.8 vendor/gems/context/lib/context/suite.rb
djsun-context-0.5.5 lib/context/suite.rb
djsun-context-0.5.6 lib/context/suite.rb
fairchild-poolparty-1.3.17 vendor/gems/context/lib/context/suite.rb