Sha256: 7f61c75a8b1c97f4cbe46ed92c0ffa03d7b487a7ff05378401d9aa524c6f84b6
Contents?: true
Size: 1.04 KB
Versions: 12
Compression:
Stored size: 1.04 KB
Contents
# -*- coding: utf-8 -*- require 'spec_helper' shared_examples_for 'a validation error reader' do context 'and that property has no associated errors' do it 'should return an empty array' do @errors[@property].should == [] end end context 'and that property has associated error(s)' do it 'should return a non empty array' do @errors.add(@property.to_sym, 'invalid') @errors[@property].should_not be_empty end end end describe 'DataMapper::Validations::ValidationErrors' do describe '[]' do describe 'when passing the argument as a String' do before(:each) do @errors = DataMapper::Validations::ValidationErrors.new(Object.new) @property = 'name' end it_should_behave_like 'a validation error reader' end describe 'when passing the argument as a Symbol' do before(:each) do @errors = DataMapper::Validations::ValidationErrors.new(Object.new) @property = :name end it_should_behave_like 'a validation error reader' end end end
Version data entries
12 entries across 12 versions & 2 rubygems