Sha256: f17b90b00eb3ce7f471276bbb31361626485f4824918febe6cb2b2e513d40765
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') module WhosGotDirt RSpec.describe Validator do let :invalid do { 'id' => 123, 'name' => 'John Smith', 'identifiers' => [{ 'scheme' => 'ACME', }, { 'identifier' => 'john-smith', }, { 'scheme' => 'ACME', }], } end let :valid do { 'id' => '123', 'name' => 'John Smith', 'identifiers' => [{ 'identifier' => 'john-smith', }], } end describe '.validate' do it 'should return errors for invalid data' do expect(Validator.validate(invalid, 'person').map{|error| [error[:fragment], error[:failed_attribute]]}).to eq([ ['#/id', 'Type'], ['#/identifiers/0', 'Properties'], ['#/identifiers/2', 'Properties'], ]) end it 'should not return errors for valid data' do expect(Validator.validate(valid, 'person')).to eq([]) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
whos_got_dirt-0.0.2 | spec/validator_spec.rb |