Class: TurboTest::Command::Run

Inherits:
Samovar::Command
  • Object
show all
Defined in:
lib/turbo_test/command/run.rb

Instance Method Summary collapse

Instance Method Details

#callObject

Prepare the environment and run the controller.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/turbo_test/command/run.rb', line 30

def call
	Console.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