Class: Flatware::RSpec::JobBuilder
- Inherits:
-
Object
- Object
- Flatware::RSpec::JobBuilder
- Extended by:
- Forwardable
- Defined in:
- lib/flatware/rspec/job_builder.rb
Overview
groups spec files into one job per worker. reads from persisted example statuses, if available, and attempts to ballence the jobs accordingly.
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#workers ⇒ Object
readonly
Returns the value of attribute workers.
Instance Method Summary collapse
-
#initialize(args, workers:) ⇒ JobBuilder
constructor
A new instance of JobBuilder.
- #jobs ⇒ Object
Constructor Details
#initialize(args, workers:) ⇒ JobBuilder
Returns a new instance of JobBuilder.
20 21 22 23 24 25 26 27 28 |
# File 'lib/flatware/rspec/job_builder.rb', line 20 def initialize(args, workers:) @args = args @workers = workers @configuration = ::RSpec.configuration configuration.define_singleton_method(:command) { 'rspec' } ::RSpec::Core::ConfigurationOptions.new(args).configure(@configuration) end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
12 13 14 |
# File 'lib/flatware/rspec/job_builder.rb', line 12 def args @args end |
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
12 13 14 |
# File 'lib/flatware/rspec/job_builder.rb', line 12 def configuration @configuration end |
#workers ⇒ Object (readonly)
Returns the value of attribute workers.
12 13 14 |
# File 'lib/flatware/rspec/job_builder.rb', line 12 def workers @workers end |
Instance Method Details
#jobs ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/flatware/rspec/job_builder.rb', line 30 def jobs timed_files, untimed_files = timed_and_untimed_files( sum_seconds(load_persisted_example_statuses) ) balance_jobs( bucket_count: [files_to_run.size, workers].min, timed_files: timed_files, untimed_files: untimed_files ) end |