Sha256: 88c087dea895be1a7c55da6e249560bf2c96e3ee0ae22fed91d81d59b0c56000
Contents?: true
Size: 948 Bytes
Versions: 1
Compression:
Stored size: 948 Bytes
Contents
describe DataMapper::Validations::ConfirmationValidator do before(:all) do class Cow include DataMapper::CallbacksHelper include DataMapper::Validations::ValidationHelper attr_accessor :name, :name_confirmation, :age end end it 'should pass validation' do class Cow validations.clear! validates_confirmation_of :name, :context => :save end betsy = Cow.new betsy.valid?.should == true betsy.name = 'Betsy' betsy.name_confirmation = '' betsy.valid?(:save).should == false betsy.errors.full_messages.first.should == 'Name does not match the confirmation' betsy.name = '' betsy.name_confirmation = 'Betsy' betsy.valid?(:save).should == false betsy.errors.full_messages.first.should == 'Name does not match the confirmation' betsy.name = 'Betsy' betsy.name_confirmation = 'Betsy' betsy.valid?(:save).should == true end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
datamapper-0.2.0 | spec/validates_confirmation_of_spec.rb |