Sha256: ad7d755c609114b6617cfd29c7cd3baa02a7d7ff6ff265b0472af9a16b74f1b5

Contents?: true

Size: 855 Bytes

Versions: 3

Compression:

Stored size: 855 Bytes

Contents

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

describe Pupa::Concerns::Identifiable do
  let :klass do
    Class.new(Pupa::Base) do
      include Pupa::Concerns::Identifiable
    end
  end

  let :object do
    klass.new
  end

  describe '#identifiers=' do
    it 'should use coerce to a IdentifierList' do
      object.identifiers = [{identifier: '123456789', scheme: 'DUNS'}]
      object.identifiers.should be_a(Pupa::IdentifierList)
    end
  end

  describe '#add_identifier' do
    it 'should add an identifier' do
      object.add_identifier('123456789', scheme: 'duns')
      object.identifiers.should == [{identifier: '123456789', scheme: 'duns'}]
    end

    it 'should not add an identifier without an identifier' do
      object.add_identifier(nil)
      object.identifiers.blank?.should == true
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pupa-0.0.8 spec/models/concerns/identifiable_spec.rb
pupa-0.0.7 spec/models/concerns/identifiable_spec.rb
pupa-0.0.6 spec/models/concerns/identifiable_spec.rb