Class: Qsim::Checker
- Inherits:
-
Mumukit::Metatest::Checker
- Object
- Mumukit::Metatest::Checker
- Qsim::Checker
- Defined in:
- lib/checker.rb
Instance Method Summary collapse
- #check(result, example) ⇒ Object
- #check_equal(result, state) ⇒ Object
- #render_error_output(result, error) ⇒ Object
- #render_success_output(result) ⇒ Object
Instance Method Details
#check(result, example) ⇒ Object
3 4 5 6 |
# File 'lib/checker.rb', line 3 def check(result, example) @output_options = example[:output] super end |
#check_equal(result, state) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/checker.rb', line 8 def check_equal(result, state) state.each do |target, expected| actual = target_value result, target fail I18n.t(:check_equal_failure, record: target, expected: expected, actual: actual) unless actual == expected end end |
#render_error_output(result, error) ⇒ Object
19 20 21 |
# File 'lib/checker.rb', line 19 def render_error_output(result, error) "#{error}\n#{renderer.render(result, @output_options)}" end |
#render_success_output(result) ⇒ Object
15 16 17 |
# File 'lib/checker.rb', line 15 def render_success_output(result) renderer.render(result, @output_options) end |