Sha256: d6de59ba763778a819dc3b39cc744d43a672522324b6da67701d4138e25a795f
Contents?: true
Size: 1.09 KB
Versions: 11
Compression:
Stored size: 1.09 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.', 'start_date' => '1920-01', 'end_date' => '1949-12-31', 'note' => 'Birth name'}] object.other_names.should == [{name: 'Mr. Ziggy Q. Public, Esq.', start_date: '1920-01', end_date: '1949-12-31', 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') object.other_names.should == [{name: 'Mr. Ziggy Q. Public, Esq.', start_date: '1920-01', end_date: '1949-12-31', note: 'Birth name'}] 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
11 entries across 11 versions & 1 rubygems