coherence_demo
coherence_demo copied to clipboard
Fix Issue #8: Failing Test Cases
Your solution is to run post(session_path(conn, :create), %{session: @user_attrs})
before every request in the tests. While it works, it's also verbose and repetitive.
Wouldn't it be better to build upon the original solution, using a setup
function?
Update:
The authors solution (that doesn't work anymore) combined with your solution is working. Add the following setup
block to the controller test file and all the post
calls in every test can now be removed:
setup %{conn: conn} do
user =
User.changeset(%User{}, @user_attrs)
|> Medox.Repo.insert!
conn = post(conn, session_path(conn, :create), %{session: @user_attrs})
{:ok, conn: conn, user: user}
end
Hi @zwippie thank you for your suggestion. Really appreciated.
I have updated this PR.
@siriusdely You're welcome. In the meantime I've also found another workaround, as discussed in this related issue.