Sha256: 0aad288846f13c399cc7b2f85a51177b031418eb006b730a8862fb5b4b3ca06e
Contents?: true
Size: 765 Bytes
Versions: 3
Compression:
Stored size: 765 Bytes
Contents
require 'volt/models' class TestModel < Model validate :_name, length: 4 end describe Model do it "should validate the name" do expect(TestModel.new.errors).to eq({:_name => ["must be at least 4 chars"]}) end it "should show marked validations once they are marked" do model = TestModel.new expect(model.marked_errors).to eq({}) model.mark_field!(:_name) expect(model.marked_errors).to eq( { :_name => ["must be at least 4 chars"] } ) end it "should show all fields in marked errors once saved" do model = TestModel.new expect(model.marked_errors).to eq({}) model.save! expect(model.marked_errors).to eq( { :_name => ["must be at least 4 chars"] } ) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
volt-0.7.4 | spec/models/validations_spec.rb |
volt-0.7.3 | spec/models/validations_spec.rb |
volt-0.7.2 | spec/models/validations_spec.rb |