Class: Specjour::Worker
- Inherits:
-
Object
- Object
- Specjour::Worker
- Includes:
- Protocol, SocketHelper
- Defined in:
- lib/specjour/worker.rb
Constant Summary
Constants included from Protocol
Protocol::TERMINATOR, Protocol::TERMINATOR_REGEXP
Instance Attribute Summary collapse
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#printer_uri ⇒ Object
Returns the value of attribute printer_uri.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Worker
constructor
A new instance of Worker.
- #prepare ⇒ Object
- #run_tests ⇒ Object
Methods included from SocketHelper
#current_uri, #hostname, #ip_from_hostname, #local_ip, #new_uri
Methods included from Protocol
Constructor Details
#initialize(options = {}) ⇒ Worker
Returns a new instance of Worker.
9 10 11 12 13 14 15 16 |
# File 'lib/specjour/worker.rb', line 9 def initialize( = {}) ARGV.replace [] $stdout = StringIO.new if [:quiet] @number = [:number].to_i self.printer_uri = [:printer_uri] set_env_variables Specjour.load_custom_hooks end |
Instance Attribute Details
#number ⇒ Object (readonly)
Returns the value of attribute number.
7 8 9 |
# File 'lib/specjour/worker.rb', line 7 def number @number end |
#printer_uri ⇒ Object
Returns the value of attribute printer_uri.
6 7 8 |
# File 'lib/specjour/worker.rb', line 6 def printer_uri @printer_uri end |
Instance Method Details
#prepare ⇒ Object
22 23 24 |
# File 'lib/specjour/worker.rb', line 22 def prepare Configuration.prepare.call end |
#run_tests ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/specjour/worker.rb', line 26 def run_tests Configuration.after_fork.call run_times = Hash.new(0) while test = connection.next_test print_status(test) time = Benchmark.realtime { run_test test } profile(test, time) run_times[test_type(test)] += time connection.(:done) end send_run_times(run_times) ensure connection.disconnect end |