I have the following rspec test code below which basically makes an API call to a server and gets all_elem_ids from get_all_queries. I'm trying to have tests run in parallel such that the 'it' block gets executed for each of the values for all_elem_ids variable, with perhaps like a max thread count of 5. Unfortunately with the code below it seems to be creating threads but the actual code ends up doing nothing. The it block gets executed 5 times but however I can see that the tests don't actually execute but are still declared as "Passed"
Code:
ids = ['2']
RSpec.describe 'Verify data' do
unless ids.nil?
ids.each do |val_a|
context "Elem id: #{val_a}" do
all_elem_ids = get_all_queries(val_a)
# example value, all_elem_ids= ['1', '56', '9', '10']
all_elem_ids.each do |val_b|
it "Verify data for id: #{val_b}" do
Thread.new{
run_test_a(val_b.to_s)
run_test_b(val_b.to_s)
}
end
end
end
end
end
end