View Source Changelog

The noteworthy changes for each ExMachina version are included here. For a complete changelog, see the git history for each version via the version links.

To see the dates a version was published see the hex package page.

2.8.0 (2024-06-24)

Features

  • ExMachina.start/2: return a supervisor from Application callback (#434) (c9ebb47)

Bug Fixes

  • Revert code changes breaking ecto record loading (#447) (b796311)

Miscellaneous

  • Add release please manifest file (ae31578)
  • Clear up log level warning (821a61a)
  • Fix missing , in configuration file (cf74a91)
  • README updates (#444) (a4352dd)
  • Remove circleci, update tools-version (#438) (b06f4b6)
  • Remove extra character from test configuration file (e8edf47)
  • Resolve config warning (#440) (a327830)
  • Satisfy Credo consistency check (5aa4f01)
  • Support common-config (#436) (2c2a309)
  • Sync files with beam-community/common-config (#437) (72e4038)
  • Sync files with beam-community/common-config (#441) (c809bce)
  • Sync files with beam-community/common-config (#448) (cca2acf)
  • Sync files with beam-community/common-config (#450) (69612ae)
  • Update and run formatter (#439) (8bb6057)
  • Update mix.exs and deps (c6c76f0)
  • Update test postgres configuration (6aab2c8)

2.7.0

Added

  • Allow setting sequence starting point (#414)

2.6.0

Added

  • Pass opts to Repo.insert! (add function-level opts to strategies) (#411)

Fixes/Improvements

  • Import evaluate_lazy_attributes for ExMachina (#410)

Docs

  • Use HTTPS for links in README (#413)
  • Remove "web" dir from README.md (#412)

2.5.0

Added

  • Allow delayed evaluation of attributes (#408)

Fixes

  • Fix Elixir 1.11 compiler warnings (#399)
  • Fix Elixir 1.11 warning by using extra_applications (#400)

Docs

  • Update references to prior art (#384)
  • Bump version number in Readme (#376)

2.4.0

Added

  • Allow ExMachina.Ecto to be used without :repo option (#370)

2.3.0

Added

  • Allows more control over factory definitions (#333)
  • Adds ability to reset specific sequences (#331)

Docs

  • Adds additional callbacks for functions with default params (#319)

Updated dependencies

  • Bump ex_doc from 0.19.1 to 0.19.3
  • Bump ecto_sql from 3.0.0 to 3.0.5
  • Bump ecto from 3.0.0 to 3.0.5

2.2.2

  • Adds support for Ecto 3.0 (#301)

2.2.1

Fixed

  • Fixes sequence typespec (#278)

Removed

  • Removed fields_for/2 function that would raise an error since 1.0.0 (#287)

Docs

  • Adds example for derived attribute (#264)
  • Adds example for dependent factory (#239)

2.2.0

Added

  • Adds support for using lists in sequences (#227).

Fixed

  • Elixir 1.6.x changed the behavior of Regex.split/3 which caused factory names to break. Added a fix in (#275).

2.1.0

Added

Fixed

Improved

  • Miscellaneous documentation improvements.

2.0.0

Added

  • Cast all values before insert (#149)

    For example, this means that if you have field :equity, :decimal in your schema, you can set the value to 0 in your factory and it will automatically cast the value to a Decimal.

  • Add string_params_for, which is useful for controller specs. (#168)

  • Add Sequence.reset/0 for resetting sequences between tests. (#151)

Changed

  • params_* functions now drop fields with nil values (#148)
  • Don't delete has_manys from params_* functions (#174)

Fixed

  • Fix an issue where values on embedded associations would not be cast (#200)
  • Only drop autogenerated ids (#147)
  • Fix an issue where setting an association to nil would break insert (#193)
  • Fix an issue where unbuild hasmany through associations were not removed in `params*` functions (#192)

1.0.2

Minor documentation fixes

1.0.1

Small change to the error generated when a factory definition is not found (#142)

1.0.0

A lot has changed but we tried to make upgrading as simple as possible.

To upgrade: In mix.exs change the version to "~> 1.0" and run mix deps.get. Once you've updated, run mix test and ExMachina will raise errors that show you what needs to change to work with 1.0.0.

Fixed

  • Fix compilation issues under OTP 19 (#138)
  • Raise helpful error when trying to insert twice (#128)

Added

  • Add Sequence.next/1 for quickly creating sequences. Example: sequence("username") will generate "username1", then "username2" (#84)
  • Raise if passing invalid keys to structs (#99)
  • Add params_with_assocs (#124)

Changed

  • Rename fields_for to params_for (#98)
  • If using ExMachina with Ecto, use insert, insert_list and insert_pair instead of create_*
  • Instead of defining a custom save_record, you can now implement an ExMachina.Strategy. See the documentation on hex.pm for more info (#102)
  • Define factory as user_factory instead of factory(:user) (#110). See PR and related issue for details on why this was changed.
  • params_for no longer returns the primary key (#123)

0.6.1

Removes warnings as reported by https://github.com/thoughtbot/ex_machina/issues/70. We recommend updating if you are using Ecto 1.1. There are no backward incompatible changes and no new features.

0.6.0

You can continue using ExMachina 0.5.0 if you are not ready for Ecto 1.1 yet. There are no additional new features in this release.

  • Updated to use Ecto 1.1
  • Require Ecto 1.1

There are still some warnings that we need to fix for Ecto 1.1, but this release at least fixes the error that was caused when upgrading to Ecto 1.1.

0.5.0

Changed

  • Factories were simplified so that attrs is no longer required. See 70a0481 and [issue #56]
  • ExMachina.Ecto.assoc/3 was removed. You can now use build(:factory) instead. See discussion in [issue #56]

Fixed

  • Use association id as defined on the schema [7c67047]

[issue #56]:https://github.com/thoughtbot/ex_machina/issues/56

[7c67047]:https://github.com/thoughtbot/ex_machina/commit/7c6704706cffa7285a608049a1b1f10784790fdd

0.4.0

Added

  • Add support for has_many and has_one Ecto associations. See 1ff4198.

Changed

  • Factories must now be defined with functions. See 59b7d23

0.3.0

Added

  • Add build_list and build_pair. See 8f332ce.
  • Add a create method that takes a map. This allows you to chain functions like: build(:foo) |> make_admin |> create. See 59cbef5.

Changed

  • Factories must now be defined with a macro. See 03c41f6
  • belongs_to associations are now built instead of created. See b518285.

0.2.0

Changed