Class: GobstonesExpectationsHook

Inherits:
Mumukit::Defaults::ExpectationsHook
  • Object
show all
Includes:
StonesSpec::WithTempfile, WithTestParser
Defined in:
lib/expectations_hook.rb

Instance Method Summary collapse

Methods included from WithTestParser

#parse_test

Methods included from StonesSpec::WithTempfile

#write_tempfile

Instance Method Details

#run!(request) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/expectations_hook.rb', line 54

def run!(request)
  content = request[:content]
  expectations = request[:expectations]

  if content.strip.empty?
    return expectations.map { |exp| {'expectation' => exp, 'result' => false } }
  end

  ast = generate_ast! content
  all_expectations = expectations + (default_expectations_for parse_test request)

  all_expectations.map { |exp| {'expectation' => exp, 'result' => run_expectation!(exp, ast)} }
end