Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/logaan/vlad
Browse files Browse the repository at this point in the history
  • Loading branch information
logaan committed Dec 19, 2013
2 parents d68afd2 + d563cf5 commit 4b84528
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -142,3 +142,7 @@ Copyright © 2012 Logan Campbell

Distributed under the Eclipse Public License, the same as Clojure.



[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/logaan/vlad/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

2 changes: 1 addition & 1 deletion project.clj
@@ -1,7 +1,7 @@
(defproject vlad "1.1.0"
:description "Vlad is an attempt at providing convenient and simple
validations. Vlad is purely functional and makes no assumptions
about your data. It can be used for validating html form data as
about your data. It can be used for validating html form data
just as well as it can be used to validate your csv about cats."
:url "https://github.com/logaan/vlad"
:license {:name "Eclipse Public License"
Expand Down
2 changes: 1 addition & 1 deletion src/vlad/validations.clj
Expand Up @@ -10,7 +10,7 @@
(validate (present :name)
{:name \"Vlad\"})"
[selector]
(predicate selector str/blank? {:type ::present}))
(predicate selector #(if (string? %) (str/blank? %) true) {:type ::present}))

(defn length-over
"Checks that the `count` of the value found at `selector` is over `size`."
Expand Down
6 changes: 5 additions & 1 deletion test/vlad/test/validations.clj
Expand Up @@ -3,12 +3,16 @@
[vlad validations validation-types]))

(tabular
(fact (validate ?validator {:name "Chris" :confirm_name "Brad"}) => ?errors)
(fact (validate ?validator {:name "Chris" :confirm_name "Brad" :number-of-teeth 32}) => ?errors)
?validator ?errors

(present [:name])
[]

(present [:number-of-teeth])
[{:type :vlad.validations/present
:selector [:number-of-teeth]}]

(present [:age])
[{:type :vlad.validations/present
:selector [:age]}]
Expand Down

0 comments on commit 4b84528

Please sign in to comment.