Sha256: 9245d0068fe6504ddf5a1d910a2bc5a74ad1796c98c9bd66921f6365a21349ba
Contents?: true
Size: 841 Bytes
Versions: 2
Compression:
Stored size: 841 Bytes
Contents
require "./spec/spec_helper" scope "errors" do class Truthy < Va::Model attribute :t validate(:t, "not truthy") do |t| t end end spec do va = Truthy.new(t: false) @errors = va.errors @errors == { t: "not truthy"} end class Falsey < Va::Model attribute :f1 attribute :f2 validate(:f1, :f2, "not falsey") do |f1, f2| !f1 && !f2 end end spec do va = Falsey.new(f1: false, f2: true) @errors = va.errors @errors == { [:f1, :f2] => "not falsey"} end class WithoutMessages < Va::Model attribute :a attribute :b validate(:a) do |a| false end validate(:a, :b) do |a, b| false end end spec do va = WithoutMessages.new @errors = va.errors @errors == { :a => "is invalid", [:a, :b] => "is invalid" } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
va-0.3.0 | spec/errors_spec.rb |
va-0.2.0 | spec/errors_spec.rb |