Extract tracker into supervision tree.

This commit is contained in:
Nathan Walker
2017-04-25 20:45:48 -05:00
parent b71221977c
commit b2dfc28650
4 changed files with 35 additions and 28 deletions

View File

@@ -4,25 +4,25 @@ defmodule TrackerTest do
@sample_modules [SampleKoan, PassingKoan]
test "can start" do
Tracker.start(@sample_modules)
Tracker.set_total(@sample_modules)
assert Tracker.summarize == %{total: 2, current: 0, visited_modules: []}
end
test "can be notified of completed koans" do
Tracker.start(@sample_modules)
Tracker.set_total(@sample_modules)
Tracker.completed(SampleKoan, :"Hi there")
assert Tracker.summarize == %{total: 2, current: 1, visited_modules: [SampleKoan]}
end
test "multiple comletions of the same koan count only once" do
Tracker.start(@sample_modules)
Tracker.set_total(@sample_modules)
Tracker.completed(SampleKoan, :"Hi there")
Tracker.completed(SampleKoan, :"Hi there")
assert Tracker.summarize == %{total: 2, current: 1, visited_modules: [SampleKoan]}
end
test "knows when koans are not complete" do
Tracker.start(@sample_modules)
Tracker.set_total(@sample_modules)
refute Tracker.complete?
end
end