Add placeholders for profile functionality

This commit is contained in:
Michael Miller 2019-03-25 12:13:11 -06:00
parent 2d88097c04
commit 35b887f8f0
9 changed files with 50 additions and 12 deletions

View file

@ -3,7 +3,6 @@
class SpyFormatter < Spectator::Formatting::Formatter
{% for item in [
{"start_suite", "Spectator::TestSuite"},
{"end_suite", "Spectator::Report"},
{"start_example", "Spectator::Example"},
{"end_example", "Spectator::Result"},
] %}
@ -27,6 +26,21 @@ class SpyFormatter < Spectator::Formatting::Formatter
{% end %}
# Stores all invocatiosn made to `#end_suite`.
# Each element is an invocation and the value is the arguments passed to the method.
getter end_suite_calls = [] of NamedTuple(report: Spectator::Report, profile: Bool)
# Number of times the `#end_suite` method was called.
def end_suite_call_count
@end_suite_calls.size
end
# Increments `#end_suite_call_count` and stores the arguments.
def end_suite(report, profile)
@all_calls << :end_suite
@end_suite_calls << {report: report, profile: profile}
end
# Stores the methods that were called and in which order.
# The symbols will be the method name (i.e. `:start_suite`).
getter all_calls = [] of Symbol