Sha256: 56c1022264f9d1e043730221c3a877f0916ac21761b0eb46138bf5bd23e28aad
Contents?: true
Size: 926 Bytes
Versions: 3
Compression:
Stored size: 926 Bytes
Contents
# -*- coding: utf-8 -*- require_relative '../../spec_helper' describe 'DataMapper::Validations::ViolationSet' do before :all do @model = DataMapper::Validations::ViolationSet.new(Object.new) @model.add(:ip_address, "must have valid format") @model.add(:full_name, "can't be blank") end describe "#each" do it "iterates over properties and yields error message arrays" do params = [] @model.each do |param| params << param end expect(params).to eq [ [ 'must have valid format' ], [ "can't be blank" ] ] end end describe "#map" do before :all do @model.add(:ip_address, "must belong to a local subnet") end it "maps error message arrays using provided block" do projection = @model.map { |ary| ary } expect(projection).to eq [ [ 'must have valid format', 'must belong to a local subnet' ], [ "can't be blank" ] ] end end end
Version data entries
3 entries across 3 versions & 1 rubygems