Clears display on failures based on options map

This commit is contained in:
Felipe Sere
2016-03-06 14:56:13 +00:00
parent 4281c63ab1
commit 53815ed759
3 changed files with 19 additions and 13 deletions

View File

@@ -8,25 +8,25 @@ defmodule Runner do
Enums
]
def run do
run(Equalities)
def run(options) do
run(Equalities, options)
end
def run(start_module) do
def run(start_module, options) do
start_idx = Enum.find_index(@modules, &(&1 == start_module))
Enum.drop(@modules, start_idx)
|> Enum.take_while(fn(mod) ->
run_module(mod) == :passed
run_module(mod, options) == :passed
end)
end
def run_module(module) do
def run_module(module, options) do
Display.considering(module)
koans = extract_koans_from(module)
passed = Enum.take_while(koans, fn(name) ->
run_koan(module, name) == :passed
run_koan(module, name, options) == :passed
end)
if Enum.count(koans) == Enum.count(passed) do
@@ -36,11 +36,11 @@ defmodule Runner do
end
end
def run_koan(module, name) do
def run_koan(module, name, options) do
case apply(module, name, []) do
:ok -> :passed
error ->
Display.show_failure(error, module, name)
Display.show_failure(error, module, name, options)
:failed
end
end