1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
Commit graph

15 commits

Author SHA1 Message Date
Paul Thornthwaite
cdae6f38f4 [tests] Fixes schema validator for arrays
Arrays should not fail if empty. They should only fail if any member of
the array does not match the schema.
2013-01-23 15:24:23 +00:00
Paul Thornthwaite
5f63112640 [tests] Extracts schema validator to class
Created Fog::Schema::DataValidator to contain the matching logic for the
data based schemas used by the tests.

This is tested in isolation and removes dependency on Shindo. Also
exposes a #message call to get the last message set by the validator to
avoid coupling the test output to the internals.

Tests for the #data_matches_schema helper are added as well.
2013-01-23 15:24:23 +00:00
Paul Thornthwaite
0793a42a64 [tests] Changes to format testing helper
* Adds and documents Shindo::Tests#data_matches_schema
* Deprecates Shindo::Tests#format method
* Strict mode is replace by expandable options
* Uses Fog::Logger instead of p for debug output
* Shindo::Tests#formats_kernel removed (was private)
* Shindo::Tests#confirm_data_matches_schema added
* #confirm_data_matches_schema uses yield

Related to issue #1477

Shindo::Tests#formats incorrectly treated missing keys as valid if their
value is allowed to be "nullable" or NilClass. These keys are not
optional. They are required but can be the value nil or the Nullable
class.

Unfortunately due to lack of documentation and a bug in the code the
current Nullable classes can be interpreted as optional and work as such.

This replaces the old format checker with a new version that supports
options to control the matching behaviour related to extra keys in
either the data or the schema.

This corrects the behaviour so extra keys in either the schema or the
supplied data fail the check unless non strict has been used.

A legacy version of the #formats test is in place that passes the
options so it behaves as the old version does.

Premptive patches have been added to fix those tests that were already
broken but passed the original checks.
2013-01-23 15:24:23 +00:00
Frederick Cheung
519efbf179 [Core] fix format_helper assuming p returns nil
on ruby 1.9 it returns the printed string so
x = foo || p("foo was false")

always evaluates to something truthy
2012-09-04 21:26:48 +01:00
geemus
ac610d1d1b fix Fog::Nullable::Boolean to include true/false 2012-01-22 18:32:46 -06:00
Dan Prince
20ccb7ca81 Add support for non-strict validations, and nullable arrays/hashes. 2011-09-28 15:24:40 -04:00
geemus
6ce84bdc5b [tests] more helpful formats helper errors 2011-09-23 16:58:39 -05:00
Brian Hartsock
994d5fa3e1 Rackspace LB: account usage request 2011-07-27 21:44:43 -04:00
geemus
c30357d638 [AWS|SQS] flesh out basics 2011-07-19 15:11:21 -05:00
geemus
d76964a5e1 [brightbox|compute] fix format for account in tests 2011-05-26 14:38:54 -07:00
geemus
b5c1d10b0b [terremark_ecloud] task requests 2011-02-14 15:28:39 -08:00
geemus
9a0606e938 fix formats tests to handle empty array 2011-01-21 16:37:17 -08:00
Dan Peterson
5e6797f6b6 [TerremarkEcloud] initial 2011-01-20 16:28:45 -08:00
geemus
c732cf1146 fixes for formats with nullables 2011-01-04 15:17:05 -08:00
geemus
5322683b6e [tests] cleanup/organize helpers 2011-01-04 14:01:31 -08:00