{"id":19163583,"url":"https://github.com/dockyard/valid_field","last_synced_at":"2025-08-20T19:29:29.752Z","repository":{"id":62430684,"uuid":"44936346","full_name":"DockYard/valid_field","owner":"DockYard","description":null,"archived":false,"fork":false,"pushed_at":"2019-07-10T07:07:04.000Z","size":45,"stargazers_count":48,"open_issues_count":4,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T00:07:54.056Z","etag":null,"topics":["elixir","testing"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/valid_field","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/DockYard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-26T00:18:01.000Z","updated_at":"2023-06-24T22:01:14.000Z","dependencies_parsed_at":"2022-11-01T20:17:52.586Z","dependency_job_id":null,"html_url":"https://github.com/DockYard/valid_field","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DockYard%2Fvalid_field","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DockYard%2Fvalid_field/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DockYard%2Fvalid_field/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DockYard%2Fvalid_field/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DockYard","download_url":"https://codeload.github.com/DockYard/valid_field/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249181131,"owners_count":21225850,"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":["elixir","testing"],"created_at":"2024-11-09T09:15:56.430Z","updated_at":"2025-04-16T01:26:39.884Z","avatar_url":"https://github.com/DockYard.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ValidField [![Build Status](https://travis-ci.org/DockYard/valid_field.svg?branch=master)](https://travis-ci.org/DockYard/valid_field) [![Inline docs](http://inch-ci.org/github/dockyard/valid_field.svg?branch=master)](http://inch-ci.org/github/dockyard/valid_field)\n\n**[ValidField is built and maintained by DockYard, contact us for expert Elixir and Phoenix consulting](https://dockyard.com/phoenix-consulting)**.\n\nValidField allows you to unit test changesets\n\n## Usage\n\nAdd valid_field to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [{:valid_field, \"~\u003e 0.6.0\", only: :test}]\nend\n```\n\nThen in your unit test:\n\n```elixir\ndefmodule App.UserTest do\n  import ValidField\n  alias App.User\n\n  test \".changeset - Validations\" do\n    with_changeset(%User{})\n    |\u003e assert_valid_field(:email, [\"something@else.com\"])\n    |\u003e assert_invalid_field(:email, [\"\", nil, \"test\"])\n    |\u003e assert_valid_field(:password, [\"password123!\"])\n    |\u003e assert_invalid_field(:password, [nil, \"\", \"test\", \"nospecialcharacters1\", \"nonumber!\"])\n  end\nend\n```\n\nAlternatively you can combine the `assert_valid_field/3` and\n`assert_invalid_field/3` syntax into `assert_field/4`. Refactoring the\nsame example above using `assert_field/4` would yield:\n\n```elixir\ndefmodule App.UserTest do\n  import ValidField\n  alias App.User\n\n  test \".changeset - Validations\" do\n    with_changeset(%User{})\n    |\u003e assert_field(:email, [\"something@else.com\"], [\"\", nil, \"test\"])\n    |\u003e assert_field(:password, [\"password123!\"], [nil, \"\", \"test\", \"nospecialcharacters1\", \"nonumber!\"])\n  end\nend\n```\n\n## Authors\n\n* [Dan McClain](http://twitter.com/_danmcclain)\n* [Brian Cardarella](http://twitter.com/bcardarella)\n\n[We are very thankful for the many contributors](https://github.com/DockYard/valid_field/graphs/contributors)\n\n## Versioning\n\nThis library follows [Semantic Versioning](http://semver.org)\n\n## Want to help?\n\nPlease do! We are always looking to improve this library. Please see our\n[Contribution Guidelines](https://github.com/DockYard/valid_field/blob/master/CONTRIBUTING.md)\non how to properly submit issues and pull requests.\n\n## Legal\n\n[DockYard](http://dockyard.com/), Inc. \u0026copy; 2016\n\n[@dockyard](http://twitter.com/DockYard)\n\n[Licensed under the MIT license](http://www.opensource.org/licenses/mit-license.php)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdockyard%2Fvalid_field","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdockyard%2Fvalid_field","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdockyard%2Fvalid_field/lists"}