Sha256: 19f0192ec0eff6b440b2a29ad7412e24541d76dead452a7fb1e61422c345ef83
Contents?: true
Size: 736 Bytes
Versions: 1
Compression:
Stored size: 736 Bytes
Contents
require "./spec/spec_helper" scope "basic validations" do scope "non-blank" do class ANonBlankAttribute < Va::Model attribute :name attribute :age validate_present(:name, :age) end test "passing" do va = ANonBlankAttribute.new(name: "Fede", age: :of_ultron) assert_equal va.valid?, true end test "one empty string" do va = ANonBlankAttribute.new(name: "", age: :of_ultron) assert_equal va.valid?, false end test "one nil" do va = ANonBlankAttribute.new(name: "Fede", age: nil) assert_equal va.valid?, false end test "both empty" do va = ANonBlankAttribute.new(name: nil, age: "") assert_equal va.valid?, false end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
va-0.1.0 | spec/validations_spec.rb |