ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - danielberkompas/ecto_validation_case: Simplify your Ecto validation tests
Simplify your Ecto validation tests. Contribute to danielberkompas/ecto_validation_case development by creating an account on GitHub.
Visit Site

GitHub - danielberkompas/ecto_validation_case: Simplify your Ecto validation tests

GitHub - danielberkompas/ecto_validation_case: Simplify your Ecto validation tests

Ecto.ValidationCase

Hex Version Build Status Inline docs

Simplify your Ecto model validation tests. Loosely inspired by shoulda matchers, but simpler.

IMPORTANT

Jose Valim, creator of Elixir, has outlined a better approach to this problem here: https://groups.google.com/forum/#!topic/elixir-lang-talk/kwLLyCiarls

Go check it out.

Sample

defmodule MyApp.UserTest do
  use ExUnit.Case
  use Ecto.ValidationCase, model: MyApp.User

  test "requires password to be 10 chars long" do
    rejects "password",    for: :password, message: "too short"
    accepts "password123", for: :password
  end
end

Rationale

Rather than create a matching test helper function for each of the valiations that Ecto supports, this library intentionally keeps things simple, providing only accepts/2 and rejects/2. Why?

  • The api very easy to remember, which makes validation tests more likely to be written.
  • The tests are more explicit, with a minimum of magic. It is very clear exactly what values are being tested, for which fields, and which error messages should be returned.

Installation

You can install Ecto.ValidationCase from hex. First, change your deps in mix.exs specifying that this is applicable only for the test environment:

def deps do
  [{:ecto_validation_case, ">= 0.1.0", env: :test}]
end

Then run mix deps.get to install.

Documentation

Documentation is available on Ecto.ValidationCase's hex page.

License

MIT. See LICENSE and NOTICE for more details.

Articles
to learn more about the elixir concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Elixir.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory