Class: KnapsackPro::RSpec::TestQueueInitializer

Inherits:
Object
  • Object
show all
Defined in:
lib/knapsack_pro/rspec/test_queue_initializer.rb

Instance Method Summary collapse

Instance Method Details

#call(args) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/knapsack_pro/rspec/test_queue_initializer.rb', line 6

def call(args)
  test_queue_url, slow_id_paths = KnapsackPro::TestCaseDetectors::RSpecTestExampleDetector
    .new
    .calculate_slow_id_paths(args.to_s)
    .values_at(:test_queue_url, :slow_id_paths)

  unless test_queue_url.nil? # The test queue already existed when calculating the slow id paths.
    KnapsackPro.logger.info "Test Queue URL: #{test_queue_url}"
    exit 0
  end

  # The test queue was created by another node while this one calculated the slow id paths via the RSpec dry-run.
  exit 0 if test_queue_exists?

  initialize_test_queue(slow_id_paths)
end