run_specs (lib/merb-core/test/run_specs.rb)

    # File lib/merb-core/test/run_specs.rb, line 93
    def run_specs(globs, spec_cmd='spec', run_opts = "-c", except = [])
      require "optparse"
      require "spec"
      globs = globs.is_a?(Array) ? globs : [globs]

      forking = (ENV["FORK"] ? ENV["FORK"] == "1" : Merb.forking_environment?)
      base_dir = File.expand_path(File.dirname(__FILE__) / ".." / ".." / "..")

      counter = Merb::Counter.new
      forks   = 0
      failure = false

      FileUtils.rm_rf(base_dir / "results")
      FileUtils.mkdir_p(base_dir / "results")

      time = Benchmark.measure do
        files = {}
        globs.each do |glob|
          Dir[glob].each do |spec|
            if forking
              Kernel.fork do
                run_spec(spec, base_dir)
              end
              Process.wait
            else
              `NOW=1 #{Gem.ruby} #{File.dirname(__FILE__) / "run_spec.rb"} \"#{spec}\"`
            end
            out = File.read(base_dir / "results" / "#{File.basename(spec)}_out")
            err = File.read(base_dir / "results" / "#{File.basename(spec)}_err")
            counter.add(spec, out, err)
          end
        end
      end

      Process.waitall

      counter.time = time
      counter.report
      FileUtils.rm_rf(base_dir / "results")
      exit!(counter.failed? ? -1 : 0)
    end