Class: RspecChunked::ChunkedTests
- Inherits:
-
Object
- Object
- RspecChunked::ChunkedTests
- Defined in:
- lib/rspec_chunked/chunked_tests.rb
Class Attribute Summary collapse
-
.balance_settings ⇒ Object
Returns the value of attribute balance_settings.
Instance Attribute Summary collapse
-
#balance_settings ⇒ Object
Returns the value of attribute balance_settings.
-
#cmd ⇒ Object
Returns the value of attribute cmd.
-
#job_number ⇒ Object
Returns the value of attribute job_number.
-
#order_logic ⇒ Object
Returns the value of attribute order_logic.
-
#qty_groups ⇒ Object
Returns the value of attribute qty_groups.
Instance Method Summary collapse
-
#initialize(qty_groups, job_number, cmd: nil, order_logic: :file_size) ⇒ ChunkedTests
constructor
A new instance of ChunkedTests.
- #run ⇒ Object
Constructor Details
#initialize(qty_groups, job_number, cmd: nil, order_logic: :file_size) ⇒ ChunkedTests
Returns a new instance of ChunkedTests.
11 12 13 14 15 16 17 |
# File 'lib/rspec_chunked/chunked_tests.rb', line 11 def initialize(qty_groups, job_number, cmd: nil, order_logic: :file_size) @qty_groups = qty_groups @job_number = job_number - 1 @order_logic = order_logic @balance_settings = self.class.balance_settings || {} @cmd = cmd || 'bundle exec rspec' end |
Class Attribute Details
.balance_settings ⇒ Object
Returns the value of attribute balance_settings.
6 7 8 |
# File 'lib/rspec_chunked/chunked_tests.rb', line 6 def balance_settings @balance_settings end |
Instance Attribute Details
#balance_settings ⇒ Object
Returns the value of attribute balance_settings.
8 9 10 |
# File 'lib/rspec_chunked/chunked_tests.rb', line 8 def balance_settings @balance_settings end |
#cmd ⇒ Object
Returns the value of attribute cmd.
8 9 10 |
# File 'lib/rspec_chunked/chunked_tests.rb', line 8 def cmd @cmd end |
#job_number ⇒ Object
Returns the value of attribute job_number.
8 9 10 |
# File 'lib/rspec_chunked/chunked_tests.rb', line 8 def job_number @job_number end |
#order_logic ⇒ Object
Returns the value of attribute order_logic.
8 9 10 |
# File 'lib/rspec_chunked/chunked_tests.rb', line 8 def order_logic @order_logic end |
#qty_groups ⇒ Object
Returns the value of attribute qty_groups.
8 9 10 |
# File 'lib/rspec_chunked/chunked_tests.rb', line 8 def qty_groups @qty_groups end |
Instance Method Details
#run ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/rspec_chunked/chunked_tests.rb', line 19 def run balanced_tests = balance_tests(group_tests, balance_settings) tests = balanced_tests[job_number] qty = balanced_tests.flatten.count Kernel.puts "**** running #{tests.count}/#{qty} test files (group number: #{job_number + 1})" Kernel.abort('failed running command') unless Kernel.system "#{cmd} #{tests.join(' ')}" end |