bin/check-rspec.rb in sensu-plugins-rspec-1.1.0 vs bin/check-rspec.rb in sensu-plugins-rspec-2.0.0
- old
+ new
@@ -102,12 +102,12 @@
run = "#{config[:environment_variables]} #{config[:ruby_bin]} -S #{config[:rspec_bin]} #{config[:spec_dir]} -f json"
rspec_results = `#{cd} #{run}`
parsed = JSON.parse(rspec_results)
- parsed['examples'].each do |rspec_test|
- test_name = rspec_test['file_path'].split('/')[-1] + '_' + rspec_test['line_number'].to_s
- output = rspec_test['full_description']
+ parsed['examples'].each_with_index do |rspec_test, index|
+ test_name = rspec_test['file_path'].split('/')[-1] + '_' + rspec_test['line_number'].to_s + '_' + index.to_s
+ output = rspec_test['full_description']
if rspec_test['status'] == 'passed'
send_ok(test_name, output)
else
send_warning(test_name, output)