Skip to content
Snippets Groups Projects
Verified Commit e9c075d0 authored by Sergey Suprunenko's avatar Sergey Suprunenko
Browse files

Mock :crypt.crypt/2 because otherwise the test fails on Mac OS

parent e3ca9f70
No related branches found
No related tags found
No related merge requests found
......@@ -47,16 +47,18 @@ test "it authenticates the auth_user if present and password is correct and rese
|> assign(:auth_user, user)
conn =
with_mock User,
reset_password: fn user, %{password: password, password_confirmation: password} ->
send(self(), :reset_password)
{:ok, user}
end do
conn
|> LegacyAuthenticationPlug.call(%{})
with_mocks([
{:crypt, [], [crypt: fn _password, password_hash -> password_hash end]},
{User, [],
[
reset_password: fn user, %{password: password, password_confirmation: password} ->
{:ok, user}
end
]}
]) do
LegacyAuthenticationPlug.call(conn, %{})
end
assert_received :reset_password
assert conn.assigns.user == user
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment