ex_machina
ex_machina copied to clipboard
Create test data for Elixir applications
Hello there 👋🏼 It looks like this project may no longer be maintained. Does @thoughtbot plan to continue supporting this effort, or can we work to transition it to a...
Given a factory that produces a struct `Foo` with a UTC datetime field `published_at`, the follow is produced. `params_for(:foo)` -> `%Foo{published_at: ~U[2019-08-04 17:25:42.638664Z]}` `string_params_for(:foo)` -> `%Foo{"published_at" => %{ "calendar" =>...
Resolves https://github.com/thoughtbot/ex_machina/issues/362 This PR introduces a configuration option to preserve dates when using the `string_params_for` function, making it a non breaking change for now. Add the following ``` config :ex_machina,...
Ecto tests are failing, because 0 is converted to nil and comp with nil causes error. Would default value start_with 1 make sense?
I've found the `Factory` methods provided by Ex Machina to be very useful in development. Often, when I'm manually testing code in `IEx` it's handy to be able to quickly...
Users of the [polymorphic embed library](https://github.com/mathieuprog/polymorphic_embed) are working with ex_machina for their tests. The library introduces a new function `cast_polymorphic_embed/2` for casting fields of type `{:parameterized, PolymorphicEmbed, options}`. Would it...
Hey guys. Thanks for the great lib first of all. Imagine I've got schemas: ```elixir schema "comment" do field :body belongs_to :user, User end ``` So I'm creating a factory:...
If your changeset uses `put_assoc`, testing it with a `params_with_assoc` makes the function kinda blows up at the moment as the FK's are present in `params_with_assoc` as opposed to the...
__Summary__ Relating to some changes in Ecto for this [bug](https://github.com/elixir-ecto/ecto/issues/3246), [a warning](https://github.com/elixir-ecto/ecto/commit/8c4135fb14f3ee57c06ce0c3984d9475d0a4a435) is emitted on the attempted Preload of associations that exist a built struct without a parent_id on the...
I find myself creating many helper functions in my factory file that change one or a few attributes of a factory. For example, ```elixir # factory file def user_factory do...