Sha256: 8c6aeea4be52401b0e6cf71a24d7bf8f6eab7e8c27f865a2764fbe38a60b1628

Contents?: true

Size: 725 Bytes

Versions: 2

Compression:

Stored size: 725 Bytes

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 '#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.other_names.blank?.should == true
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pupa-0.0.10 spec/models/concerns/nameable_spec.rb
pupa-0.0.9 spec/models/concerns/nameable_spec.rb