Sha256: 3812e2a1b6ae5fb6832ba110538e222b7bde19f09540dda454cf101a62c8b83b

Contents?: true

Size: 648 Bytes

Versions: 2

Compression:

Stored size: 648 Bytes

Contents

class Mumukit::Assistant::Rule::TheseTestsFailed < Mumukit::Assistant::Rule::SubmissionFailed
  def initialize(message, tests)
    raise 'missing tests' if tests.blank?
    super(message)
    @tests = tests
  end

  def matches?(submission)
    super && matches_failing_tests?(submission)
  end

  def matches_failing_tests?(submission)
    @tests.all? do |it|
      includes_failing_test? it, submission
    end
  end

  def includes_failing_test?(title, submission)
    failed_tests(submission).map { |it| it[:title] }.include?(title)
  end

  def failed_tests(submission)
    submission.test_results.select { |it| it[:status].failed? }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mumukit-assistant-0.1.1 lib/mumukit/assistant/rule/these_tests_failed.rb
mumukit-assistant-0.1.0 lib/mumukit/assistant/rule/these_tests_failed.rb