Files
codeocean/lib/rspec_adapter.rb
Sebastian Serth 3d3478d859 Test Adapters: Always use the last output for score runs
* This prevents learners from cheating by printing the required status line themselves
2021-11-02 15:52:49 +01:00

17 lines
372 B
Ruby

# frozen_string_literal: true
class RspecAdapter < TestingFrameworkAdapter
REGEXP = /(\d+) examples?, (\d+) failures?/.freeze
def self.framework_name
'RSpec 3'
end
def parse_output(output)
captures = output[:stdout].scan(REGEXP).try(:last).map(&:to_i)
count = captures.first
failed = captures.second
{count: count, failed: failed}
end
end