Sha256: 38f30b43b08da78bfd8268222cd4e0285e655f66e1bfc678cfd8f514e270ff0e
Contents?: true
Size: 1.12 KB
Versions: 11
Compression:
Stored size: 1.12 KB
Contents
# Copyright (c) 2008-2013 Michael Dvorkin and contributors. # # Fat Free CRM is freely distributable under the terms of MIT license. # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php #------------------------------------------------------------------------------ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe 'ActiveModel Validation Errors' do it 'should render explicit error message if it starts with a caret' do class Adam < User validates_presence_of :title, :message => '^Missing title' end adam = Adam.create(:username => 'adam', :email => 'adam@example.com') adam.valid?.should == false adam.errors[:title].should == [ '^Missing title' ] adam.errors.full_messages[0].should == 'Missing title' end it 'should exhibit default behavior' do class Eve < User validates_presence_of :title, :message => 'missing' end eve = Eve.create(:username => 'eve', :email => 'eve@example.com') eve.valid?.should == false eve.errors[:title].should == [ 'missing' ] eve.errors.full_messages[0].should == 'Title missing' end end
Version data entries
11 entries across 11 versions & 1 rubygems