Sha256: ddc5c7413c8577590e6384a0780a84587c81cc3eff1d7cd6f4280c3c51ba295a

Contents?: true

Size: 711 Bytes

Versions: 8

Compression:

Stored size: 711 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe Pupa::Concerns::Nameable do
  let :klass do
    Class.new(Pupa::Base) do
      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

8 entries across 8 versions & 1 rubygems

Version Path
pupa-0.0.8 spec/models/concerns/nameable_spec.rb
pupa-0.0.7 spec/models/concerns/nameable_spec.rb
pupa-0.0.6 spec/models/concerns/nameable_spec.rb
pupa-0.0.5 spec/models/concerns/nameable_spec.rb
pupa-0.0.4 spec/models/concerns/nameable_spec.rb
pupa-0.0.3 spec/models/concerns/nameable_spec.rb
pupa-0.0.2 spec/models/concerns/nameable_spec.rb
pupa-0.0.1 spec/models/concerns/nameable_spec.rb