{"id":13509192,"url":"https://github.com/sinetris/factory_girl_elixir","last_synced_at":"2025-07-24T00:41:55.206Z","repository":{"id":18649521,"uuid":"21856412","full_name":"sinetris/factory_girl_elixir","owner":"sinetris","description":"Minimal implementation of Ruby's factory_girl in Elixir.","archived":false,"fork":false,"pushed_at":"2015-06-02T08:39:25.000Z","size":191,"stargazers_count":43,"open_issues_count":2,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-01T09:34:17.835Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sinetris.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-15T10:59:27.000Z","updated_at":"2023-09-01T08:48:33.000Z","dependencies_parsed_at":"2022-09-15T01:22:20.178Z","dependency_job_id":null,"html_url":"https://github.com/sinetris/factory_girl_elixir","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinetris%2Ffactory_girl_elixir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinetris%2Ffactory_girl_elixir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinetris%2Ffactory_girl_elixir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinetris%2Ffactory_girl_elixir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sinetris","download_url":"https://codeload.github.com/sinetris/factory_girl_elixir/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246323933,"owners_count":20759052,"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-08-01T02:01:04.357Z","updated_at":"2025-03-30T13:31:45.013Z","avatar_url":"https://github.com/sinetris.png","language":"Elixir","funding_links":[],"categories":["Testing"],"sub_categories":[],"readme":"# FactoryGirlElixir\n\n[![Build Status](https://travis-ci.org/sinetris/factory_girl_elixir.svg?branch=master)](https://travis-ci.org/sinetris/factory_girl_elixir)\n\nMinimal implementation of Ruby's [factory_girl](http://github.com/thoughtbot/factory_girl) in Elixir.\n\nThis is a rewrite of the [factory_boy](https://github.com/inkr/factory_boy) project to make it work on Elixir v1.0.x.\n\n## Usage\n\nAdd FactoryGirlElixir as a dependency in your `mix.exs` file.\n\n```elixir\ndefp deps do\n  [\n    {:factory_girl_elixir, \"~\u003e 0.1.1\"}\n  ]\nend\n```\n\nYou should also update your applications list to include both projects:\n\n```elixir\ndef application do\n  [applications: [:factory_girl_elixir]]\nend\n```\n\nAfter you are done, run `mix deps.get` in your shell to fetch the dependencies.\n\n\n## Defining a Factory\n\n```elixir\ndefmodule Factory do\n  use FactoryGirlElixir.Factory\n\n  factory :user do\n    field :password, \"secret\"\n    # create a sequence using an anonymous functions\n    field :username, fn(n) -\u003e\n      \"username#{n}\"\n    end\n    # or an anonymous functions shortcut\n    field :email, \u0026(\"foo#{\u00261}@example.com\")\n  end\n\n  factory :assets do\n    field :name, \"bob\"\n  end\nend\n```\n\nThen query the module to get a list of attributes for your record\n\n```elixir\nuser = Factory.attributes_for(:user) #=\u003e %{password: \"secret\", username: \"username1\", email: \"foo1@example.com\"}\nparametrized_user = user |\u003e Factory.parametrize\n#=\u003e %{\"email\" =\u003e \"foo1@example.com\", \"password\" =\u003e \"secret\", \"username\" =\u003e \"username1\"}\n```\n\nYou can override attributes\n\n```elixir\nuser = Factory.attributes_for(:user, email: \"user@example.org\")\n#=\u003e %{password: \"secret\", username: \"username1\", email: \"user@example.org\"}\n```\n\n## Contributing\n\n1. [Fork](https://help.github.com/articles/fork-a-repo) this repo\n2. Create a topic branch - `git checkout -b my_branch`\n3. Push to your branch - `git push origin my_branch`\n4. Create a [Pull Request](http://help.github.com/pull-requests/) from your\n   branch\n5. That's it!\n\n## Copyright and license\n\nCopyright (c) 2014 Duilio Ruggiero. Code released under [the MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinetris%2Ffactory_girl_elixir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsinetris%2Ffactory_girl_elixir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinetris%2Ffactory_girl_elixir/lists"}