{"id":17036679,"url":"https://github.com/marick/ecto_test_data_builder","last_synced_at":"2025-03-22T22:45:34.385Z","repository":{"id":57493718,"uuid":"293360587","full_name":"marick/ecto_test_data_builder","owner":"marick","description":"Use this code to build your own Elixir module that helps build Ecto test data.","archived":false,"fork":false,"pushed_at":"2020-09-10T21:03:07.000Z","size":103,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-28T13:00:15.307Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marick.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-06T20:58:31.000Z","updated_at":"2023-03-10T12:07:09.000Z","dependencies_parsed_at":"2022-08-30T02:20:57.319Z","dependency_job_id":null,"html_url":"https://github.com/marick/ecto_test_data_builder","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marick%2Fecto_test_data_builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marick%2Fecto_test_data_builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marick%2Fecto_test_data_builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marick%2Fecto_test_data_builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marick","download_url":"https://codeload.github.com/marick/ecto_test_data_builder/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245031362,"owners_count":20549914,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T08:51:21.744Z","updated_at":"2025-03-22T22:45:34.365Z","avatar_url":"https://github.com/marick.png","language":"Elixir","readme":"# README\n\nThis provides support code for writing Ecto test data builders that\nare used like this:\n\n```elixir\nrepo = \n  empty_repo()\n  |\u003e procedure(\"haltering\", frequency: \"twice per week\")\n  |\u003e reservation_for([\"bossie\"], [\"haltering\"], date: @wed)\n  |\u003e reservation_for([\"bossie\"], [\"haltering\"], date: @mon)\n```\n\nThat code constructs test data for a database\nconfiguration like this:\n\n\u003cimg src=\"https://raw.githubusercontent.com/marick/ecto_test_data_builder/main/pics/reservation_schema.png\" width=\"400px\"/\u003e\n\nI claim that code is a better way to set up test data than other approaches. \n\nIn addition to creating rows in database tables, the functions produce\na \"repo cache\", conventionally bound to `repo`, that contains a view into\nthe database that makes common testing operations simpler.\n\nFor example, it's straightforward to have the `repo` structure contain\ntop-level fields that point directly to important values. This allows\nyou to avoid the busywork of keeping track of database ids. Instead,\nthere's only one \"source of truth\" and you use that:\n\n```elixir\n# setup\n\nrepo = \n  ...\n  |\u003e animal(\"bossie\", ...)\n...\n\n# The function under test\n\n... VM.Animal.fetch(:one_for_edit, repo.bossie.id) ...\n                                   ^^^^^^^^^^^^^^\n```\n\nThat's surprisingly useful.\n\n## More information\n\n[Online documentation](https://hexdocs.pm/ecto_test_data_builder)\n\nSee [USE.md](./USE.md) for a description of using this package to\ncreate a custom test-data builder.\n\n## Installation\n\nAdd `ecto_test_data_builder` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:ecto_test_data_builder, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarick%2Fecto_test_data_builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarick%2Fecto_test_data_builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarick%2Fecto_test_data_builder/lists"}