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.



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# 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