Replace multiple receives with assert_receives

❤️ #101
This commit is contained in:
Jay Hayes
2016-05-04 15:08:17 -05:00
parent 65b9af48b4
commit f7cced5913

View File

@@ -71,13 +71,8 @@ defmodule Processes do
send pid, {self, "o"} send pid, {self, "o"}
send pid, {self, "hai"} send pid, {self, "hai"}
receive do assert_receive ___
msg -> assert msg == ___ assert_receive ___
end
receive do
msg -> assert msg == ___
end
Process.exit(pid, :kill) Process.exit(pid, :kill)
end end
@@ -99,15 +94,11 @@ defmodule Processes do
end end
send pid, {self, :get} send pid, {self, :get}
receive do assert_receive ___
value -> assert value == ___
end
send pid, {self, :set, "bar"} send pid, {self, :set, "bar"}
send pid, {self, :get} send pid, {self, :get}
receive do assert_receive ___
value -> assert value == ___
end
end end
koan "Waiting for a message can get boring" do koan "Waiting for a message can get boring" do