Correcting some spelling and grammar issues
This commit is contained in:
@@ -157,7 +157,7 @@ defmodule Processes do
|
|||||||
assert_receive {:EXIT, _pid, ___}
|
assert_receive {:EXIT, _pid, ___}
|
||||||
end
|
end
|
||||||
|
|
||||||
koan "If you monitor your children, you'll be automatically informed for their depature" do
|
koan "If you monitor your children, you'll be automatically informed of their departure" do
|
||||||
spawn_monitor(fn -> Process.exit(self(), :normal) end)
|
spawn_monitor(fn -> Process.exit(self(), :normal) end)
|
||||||
|
|
||||||
assert_receive {:DOWN, _ref, :process, _pid, ___}
|
assert_receive {:DOWN, _ref, :process, _pid, ___}
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ defmodule Protocols do
|
|||||||
|
|
||||||
@intro "Want to follow the rules? Adhere to the protocol!"
|
@intro "Want to follow the rules? Adhere to the protocol!"
|
||||||
|
|
||||||
defprotocol School, do: def enrol(person)
|
defprotocol School, do: def enroll(person)
|
||||||
|
|
||||||
defimpl School, for: Any do
|
defimpl School, for: Any do
|
||||||
def enrol(_) do
|
def enroll(_) do
|
||||||
"Pupil enrolled at school"
|
"Pupil enrolled at school"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -21,31 +21,31 @@ defmodule Protocols do
|
|||||||
defmodule Baker, do: defstruct name: ""
|
defmodule Baker, do: defstruct name: ""
|
||||||
|
|
||||||
defimpl School, for: Musician do
|
defimpl School, for: Musician do
|
||||||
def enrol(musician) do
|
def enroll(musician) do
|
||||||
"#{musician.name} signed up for #{musician.instrument}"
|
"#{musician.name} signed up for #{musician.instrument}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defimpl School, for: Dancer do
|
defimpl School, for: Dancer do
|
||||||
def enrol(dancer), do: "#{dancer.name} enrolled for #{dancer.dance_style}"
|
def enroll(dancer), do: "#{dancer.name} enrolled for #{dancer.dance_style}"
|
||||||
end
|
end
|
||||||
|
|
||||||
koan "Sharing an interface is the secret at school" do
|
koan "Sharing an interface is the secret at school" do
|
||||||
musician = %Musician{name: "Andre", instrument: "violin"}
|
musician = %Musician{name: "Andre", instrument: "violin"}
|
||||||
dancer = %Dancer{name: "Darcy", dance_style: "ballet"}
|
dancer = %Dancer{name: "Darcy", dance_style: "ballet"}
|
||||||
|
|
||||||
assert School.enrol(musician) == ___
|
assert School.enroll(musician) == ___
|
||||||
assert School.enrol(dancer) == ___
|
assert School.enroll(dancer) == ___
|
||||||
end
|
end
|
||||||
|
|
||||||
koan "Sometimes we all use the same" do
|
koan "Sometimes we all use the same" do
|
||||||
student = %Student{name: "Emily"}
|
student = %Student{name: "Emily"}
|
||||||
assert School.enrol(student) == ___
|
assert School.enroll(student) == ___
|
||||||
end
|
end
|
||||||
|
|
||||||
koan "If you don't comply you can't get in" do
|
koan "If you don't comply you can't get in" do
|
||||||
assert_raise ___, fn ->
|
assert_raise ___, fn ->
|
||||||
School.enrol(%Baker{name: "Delia"})
|
School.enroll(%Baker{name: "Delia"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user