To enable adding the intro, the tracker knows visited modules.

This commit is contained in:
Felipe Sere
2016-05-10 22:41:02 +01:00
parent c23fca5b29
commit 7b494e16df
2 changed files with 29 additions and 17 deletions

View File

@@ -5,19 +5,24 @@ defmodule TrackerTest do
test "can start" do
Tracker.start(@sample_modules)
assert Tracker.summarize == %{total: 2, current: 0}
assert Tracker.summarize == %{total: 2, current: 0, visited_modules: []}
end
test "can be notified of completed koans" do
Tracker.start(@sample_modules)
Tracker.completed(:"Hi there")
assert Tracker.summarize == %{total: 2, current: 1}
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.completed(:"Hi there")
Tracker.completed(:"Hi there")
assert Tracker.summarize == %{total: 2, current: 1}
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)
refute Tracker.complete?
end
end