mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-24 14:56:43 +00:00
added matcher docs to README
This commit is contained in:
parent
ef51d8c3d6
commit
c06daf2a2f
17
README
17
README
@ -183,7 +183,7 @@ To see all defined formats look in the lib/validates_timeliness/formats.rb.
|
|||||||
|
|
||||||
=== US/EURO FORMATS
|
=== US/EURO FORMATS
|
||||||
|
|
||||||
The perenial problem for non-US develops or applications not primarily for the
|
The perenial problem for non-US developers or applications not primarily for the
|
||||||
US, is the US date format of m/d/yy. This is ambiguous with the European format
|
US, is the US date format of m/d/yy. This is ambiguous with the European format
|
||||||
of d/my/yy. By default the plugin uses the US formats as this is the Ruby default
|
of d/my/yy. By default the plugin uses the US formats as this is the Ruby default
|
||||||
when it does date interpretation, and is in keeping PoLS (principle of least
|
when it does date interpretation, and is in keeping PoLS (principle of least
|
||||||
@ -278,6 +278,21 @@ inserted in the error messages for temporal options like so
|
|||||||
|
|
||||||
Those are Ruby strftime formats not the plugin formats.
|
Those are Ruby strftime formats not the plugin formats.
|
||||||
|
|
||||||
|
|
||||||
|
=== RSPEC MATCHER:
|
||||||
|
|
||||||
|
To sweeten the deal that little bit more, you have an Rspec matcher available for
|
||||||
|
you model specs. Now you can easily test the validations you have just written
|
||||||
|
with the plugin or better yet *before* you write them! You just use the
|
||||||
|
validation options you want as you would with the validation method. Those
|
||||||
|
options are then verified and reported if they fail. Use it like so:
|
||||||
|
|
||||||
|
|
||||||
|
@person.should validate_date(:birth_date, :before => Time.now, :before_message => 'should be before today')
|
||||||
|
|
||||||
|
|
||||||
|
The matcher names are just the singular of the validation methods.
|
||||||
|
|
||||||
== CREDITS:
|
== CREDITS:
|
||||||
|
|
||||||
* Adam Meehan (adam.meehan@gmail.com, http://duckpunching.com/)
|
* Adam Meehan (adam.meehan@gmail.com, http://duckpunching.com/)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user