jeudi 6 juin 2019

doctest a phoenix context

I'm new to elixir and phoenix and I wanted to doctest a newly created context (using mix phx.gen.context).

I have an Accounts context with a User schema.

I added to accounts_test.exs the following lines:

alias MyApp.Accounts.User
doctest MyApp.Accounts.User, import: true

And even fixed the default change_user documentation:

-     %Ecto.Changeset{source: %User{}}
+     %Ecto.Changeset{data: %User{}}

But I still have many, many, errors and warnings, as if it was basically not made to be doctested...

My question is: is there something I'm missing? Or is it generally not common to doctest one's context (which would explain why it doesn't work out-of-the-box)

Aucun commentaire:

Enregistrer un commentaire