Sha256: 1ec47be4364c95c647341f17f5afd2133aa0e00da1d07e0546a7b084da04a195
Contents?: true
Size: 1.23 KB
Versions: 4
Compression:
Stored size: 1.23 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Pupa::Concerns::Nameable do let :klass do Class.new do include Pupa::Model include Pupa::Concerns::Nameable end end let :object do klass.new end describe '#other_names' do it 'should symbolize keys' do object.other_names = [{'name' => 'Mr. Ziggy Q. Public, Esq.', 'note' => 'Birth name'}] object.other_names.should == [{name: 'Mr. Ziggy Q. Public, Esq.', note: 'Birth name'}] end end describe '#add_name' do it 'should add a name' do object.add_name('Mr. Ziggy Q. Public, Esq.', start_date: '1920-01', end_date: '1949-12-31', note: 'Birth name', family_name: 'Public', given_name: 'John', additional_name: 'Quinlan', honorific_prefix: 'Mr.', honorific_suffix: 'Esq.') object.other_names.should == [{name: 'Mr. Ziggy Q. Public, Esq.', start_date: '1920-01', end_date: '1949-12-31', note: 'Birth name', family_name: 'Public', given_name: 'John', additional_name: 'Quinlan', honorific_prefix: 'Mr.', honorific_suffix: 'Esq.'}] end it 'should not add a name without a name' do object.add_name(nil) object.add_name('') object.other_names.blank?.should == true end end end
Version data entries
4 entries across 4 versions & 1 rubygems