Commit Graph

9 Commits

Author SHA1 Message Date
Paul Thornthwaite 2e0b7e545a Standardise empty lines throughout codebase
Done with `rubocop --auto-correct --only EmptyLineBetweenDefs,EmptyLines,EmptyLinesAroundBody`
2014-05-26 14:20:02 +01: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
Paul Thornthwaite 3863cd38c8 [tests] Updates format tests
Tests for #formats (the public interface) have been added however there
are no fail tests due to the way Shindo operates.

Adds a few more test cases and rewords the descriptions in preparation
to refactor the #format_kernels method.

Changes the tests and schema keys to be String based since decoding the
values rarely return Symbols.
2013-01-23 15:24:22 +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
Dan Prince 20ccb7ca81 Add support for non-strict validations, and nullable arrays/hashes. 2011-09-28 15:24:40 -04:00
geemus 7620662c87 [tests] make unimplemented mock tests pending 2011-07-20 12:11:10 -05:00
geemus c30357d638 [AWS|SQS] flesh out basics 2011-07-19 15:11:21 -05:00
geemus 5322683b6e [tests] cleanup/organize helpers 2011-01-04 14:01:31 -08:00
Renamed from tests/helper_tests.rb (Browse further)