Tyler A. Young 🧑🏻💻⚗️ on Nostr: If you're writing tests for an Ecto schema module, consider using ...
If you're writing tests for an Ecto schema module, consider using Ecto.Changeset.apply_action/2 (or its ! variant) rather than actually hitting the database.
It’ll return the struct as though it had hit the DB if and only if the changeset was valid.
Published at
2025-03-18 14:58:32Event JSON
{
"id": "a1f193cfccd0a30f177eec79e615a93e0660bf5c2c5b6be68f11f2921570894b",
"pubkey": "6bb1d7b21dbaffc990baad05f8f0d8480f68a330beaab59864275f4300d3c82e",
"created_at": 1742309912,
"kind": 1,
"tags": [
[
"proxy",
"https://fosstodon.org/users/tylerayoung/statuses/114184022407293087",
"activitypub"
]
],
"content": "If you're writing tests for an Ecto schema module, consider using Ecto.Changeset.apply_action/2 (or its ! variant) rather than actually hitting the database.\n\nIt’ll return the struct as though it had hit the DB if and only if the changeset was valid.",
"sig": "f42e398d00613f3c7045e4ad05862b12121340558444bad0388352f826371797bcd33e5cc2a81466a00c1adc03c9b99bfd7d32181c523a08baa8d601c4fd9b54"
}