class Mumukit::Assistant::Rule::TheseExpectationsFailed
Public Class Methods
new(message, expectations, strict: false)
click to toggle source
Calls superclass method
Mumukit::Assistant::Rule::Base::new
# File lib/mumukit/assistant/rule/these_expectations_failed.rb, line 2 def initialize(message, expectations, strict: false) raise 'missing expectations' if expectations.blank? super(message) @expectations = expectations @strict = strict end
Public Instance Methods
failed_expectations(submission)
click to toggle source
# File lib/mumukit/assistant/rule/these_expectations_failed.rb, line 19 def failed_expectations(submission) @failed_expectations ||= submission.expectation_results.select { |it| it.indifferent_get(:result).failed? } end
includes_failing_expectation?(humanized_expectation, submission)
click to toggle source
# File lib/mumukit/assistant/rule/these_expectations_failed.rb, line 23 def includes_failing_expectation?(humanized_expectation, submission) binding, inspection = humanized_expectation.split(' ') failed_expectations(submission).any? { |it| it.indifferent_get(:binding) == binding && it.indifferent_get(:inspection) == inspection } end
matches?(submission)
click to toggle source
Calls superclass method
Mumukit::Assistant::Rule::SubmissionPassedWithWarnings#matches?
# File lib/mumukit/assistant/rule/these_expectations_failed.rb, line 9 def matches?(submission) (!@strict || super) && matches_failing_expectations?(submission) end
matches_failing_expectations?(submission)
click to toggle source
# File lib/mumukit/assistant/rule/these_expectations_failed.rb, line 13 def matches_failing_expectations?(submission) @expectations.all? do |it| includes_failing_expectation? it, submission end end