class TurboTest::Command::Run

Public Instance Methods

call() click to toggle source

Prepare the environment and run the controller.

# File lib/turbo_test/command/run.rb, line 47
def call
        Async.logger.info(self) do |buffer|
                buffer.puts "TurboTest v#{VERSION} preparing for maximum thrust!"
        end
        
        path = @options[:configuration]
        full_path = File.expand_path(path)
        
        configuration = Configuration.new
        
        if File.exist?(full_path)
                configuration.load(full_path)
        end
        
        configuration.finalize!
        
        Bundler.require(:preload)
        
        if GC.respond_to?(:compact)
                GC.compact
        end
        
        server = Server.new(configuration)
        
        queue = configuration.queue(
                paths&.map{|path| File.expand_path(path)}
        )
        
        results = server.run(queue)
        
        if results[:failed].zero?
                puts "All tests passed!"
        end
        
        return results
end