Combine Laptop Genserver examples to avoid process leaking issue
This commit is contained in:
@@ -135,15 +135,11 @@ defmodule GenServers do
|
|||||||
|
|
||||||
koan "Our server works but it's pretty ugly to use; so lets use a cleaner interface" do
|
koan "Our server works but it's pretty ugly to use; so lets use a cleaner interface" do
|
||||||
Laptop.start_link("EL!73")
|
Laptop.start_link("EL!73")
|
||||||
assert Laptop.unlock("EL!73") == ___
|
|
||||||
end
|
|
||||||
|
|
||||||
koan "Let's use the remaining functions in the external API" do
|
assert Laptop.unlock("EL!73") == ___
|
||||||
Laptop.start_link("EL!73")
|
|
||||||
{_, response} = Laptop.unlock("EL!73")
|
|
||||||
assert response == ___
|
|
||||||
|
|
||||||
Laptop.change_password("EL!73", "Elixir")
|
Laptop.change_password("EL!73", "Elixir")
|
||||||
|
|
||||||
{_, response} = Laptop.unlock("EL!73")
|
{_, response} = Laptop.unlock("EL!73")
|
||||||
assert response == ___
|
assert response == ___
|
||||||
|
|
||||||
|
@@ -11,8 +11,7 @@ defmodule GenServersTests do
|
|||||||
"73x7!n9",
|
"73x7!n9",
|
||||||
{:error, "Incorrect password!"},
|
{:error, "Incorrect password!"},
|
||||||
"Congrats! Your process was successfully named.",
|
"Congrats! Your process was successfully named.",
|
||||||
{:ok, "Laptop unlocked!"},
|
{:multiple, [{:ok, "Laptop unlocked!"}, "Incorrect password!", "Jack Sparrow"]}
|
||||||
{:multiple, ["Laptop unlocked!", "Incorrect password!", "Jack Sparrow"]}
|
|
||||||
]
|
]
|
||||||
|
|
||||||
test_all(GenServers, answers)
|
test_all(GenServers, answers)
|
||||||
|
Reference in New Issue
Block a user