Skip to content

Instantly share code, notes, and snippets.

@myers
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myers/9122856 to your computer and use it in GitHub Desktop.
Save myers/9122856 to your computer and use it in GitHub Desktop.
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
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