lapwinglabs/rube

pre and post conditions

matthewmueller opened this issue · 0 comments

We need to let errors pass through on some of the relationships.

Right now the relationships get skipped when there's an error upstream, but the relationship may make the input still valid even if there's an error.

This illustrates it. Right now this doesn't throw, but it should because c is not present:

it('should throw because it\'s missing an attribute', function(done) {
  var schema = Rube({
    a: Rube(String),
    b: Rube(String),
    c: Rube(String)
  }).or('a', 'b');

  schema.only('c')({}, function(err, v) {
    assert(err);
    done();
  });
})