Last active
August 29, 2015 13:56
-
-
Save myers/9122856 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule SessionHerderTest do | |
use ExUnit.Case | |
setup do | |
{:ok, sup_pid} = Chat.SessionSupervisor.start_link | |
{:ok, herder_pid} = Chat.SessionHerder.start_link | |
{:ok, pids: [sup_pid, herder_pid]} | |
end | |
teardown config do | |
IO.puts inspect(config[:pids]) | |
Enum.each config[:pids], &:erlang.exit(&1, :kill) | |
:ok | |
end | |
test "create new session" do | |
{:ok, session_id} = Chat.SessionHerder.new | |
assert is_binary(session_id) | |
assert Chat.SessionHerder.count == 1 | |
end | |
test "reconnect old session" do | |
{:ok, session_id} = Chat.SessionHerder.new | |
assert is_binary(session_id) | |
assert Chat.SessionHerder.count == 1 | |
:ok = Chat.SessionHerder.reconnect(session_id) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) test create new session (SessionHerderTest) | |
** (MatchError) no match of right hand side value: {:error, {:already_started, #PID<0.117.0>}} | |
stacktrace: | |
test/session_herder_test.ex:6: SessionHerderTest.__ex_unit_setup_0/1 | |
test/session_herder_test.ex:1: SessionHerderTest.__ex_unit__/2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment