Class: Specjour::Worker
- Inherits:
-
Object
- Object
- Specjour::Worker
- Includes:
- Protocol, SocketHelpers
- Defined in:
- lib/specjour/worker.rb
Constant Summary
Constants included from Protocol
Protocol::TERMINATOR, Protocol::TERMINATOR_REGEXP
Instance Attribute Summary collapse
-
#batch_size ⇒ Object
readonly
Returns the value of attribute batch_size.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#printer_uri ⇒ Object
Returns the value of attribute printer_uri.
-
#project_path ⇒ Object
readonly
Returns the value of attribute project_path.
-
#specs_to_run ⇒ Object
readonly
Returns the value of attribute specs_to_run.
Instance Method Summary collapse
-
#initialize(project_path, printer_uri, number, batch_size) ⇒ Worker
constructor
A new instance of Worker.
- #run ⇒ Object
Methods included from SocketHelpers
Methods included from Protocol
Constructor Details
#initialize(project_path, printer_uri, number, batch_size) ⇒ Worker
Returns a new instance of Worker.
10 11 12 13 14 15 16 17 18 |
# File 'lib/specjour/worker.rb', line 10 def initialize(project_path, printer_uri, number, batch_size) @project_path = project_path @specs_to_run = specs_to_run @number = number.to_i @batch_size = batch_size.to_i self.printer_uri = printer_uri Rspec::DistributedFormatter.batch_size = batch_size set_env_variables end |
Instance Attribute Details
#batch_size ⇒ Object (readonly)
Returns the value of attribute batch_size.
8 9 10 |
# File 'lib/specjour/worker.rb', line 8 def batch_size @batch_size end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
8 9 10 |
# File 'lib/specjour/worker.rb', line 8 def number @number end |
#printer_uri ⇒ Object
Returns the value of attribute printer_uri.
7 8 9 |
# File 'lib/specjour/worker.rb', line 7 def printer_uri @printer_uri end |
#project_path ⇒ Object (readonly)
Returns the value of attribute project_path.
8 9 10 |
# File 'lib/specjour/worker.rb', line 8 def project_path @project_path end |
#specs_to_run ⇒ Object (readonly)
Returns the value of attribute specs_to_run.
8 9 10 |
# File 'lib/specjour/worker.rb', line 8 def specs_to_run @specs_to_run end |
Instance Method Details
#run ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/specjour/worker.rb', line 24 def run run_time = 0 Dir.chdir(project_path) while test = connection.next_test run_time += Benchmark.realtime do run_test test end end connection.(:worker_summary=, {:duration => sprintf("%6f", run_time)}) connection.(:done) connection.disconnect end |