Sha256: 8325301dc4da55190388916439a19d331a1399d57560c91221a49dd316f3b3c4
Contents?: true
Size: 1.21 KB
Versions: 4
Compression:
Stored size: 1.21 KB
Contents
# frozen_string_literal: true # 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', password: 'ouchmyrib') expect(adam.valid?).to eq(false) expect(adam.errors[:title]).to eq(['^Missing title']) expect(adam.errors.full_messages[0]).to eq('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', password: 'doyoulikeapples') expect(eve.valid?).to eq(false) expect(eve.errors[:title]).to eq(['missing']) expect(eve.errors.full_messages[0]).to eq('Title missing') end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
fat_free_crm-0.20.1 | spec/lib/errors_spec.rb |
fat_free_crm-0.20.0 | spec/lib/errors_spec.rb |
fat_free_crm-0.19.2 | spec/lib/errors_spec.rb |
fat_free_crm-0.19.0 | spec/lib/errors_spec.rb |