Sha256: 619fac8138373cc8005f6d8b4a3d51deba5586490816b74926a2ffb580fb93eb

Contents?: true

Size: 1.29 KB

Versions: 20

Compression:

Stored size: 1.29 KB

Contents

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

describe Pupa::ContactDetailList do
  let :object do
    Pupa::ContactDetailList.new([
      {
        type: 'address',
        value: 'first',
      },
      {
        type: 'address',
        value: 'second',
      },
      {
        type: 'email',
        value: 'first',
      },
      {
        type: 'email',
        value: 'second',
      },
      {
        type: 'custom',
        value: 'content',
      },
    ])
  end

  describe '#address' do
    it 'should return the first postal address' do
      object.address.should == 'first'
    end

    it 'should return nil if no postal addresses' do
      Pupa::ContactDetailList.new.address.should == nil
    end
  end

  describe '#email' do
    it 'should return the first email address' do
      object.email.should == 'first'
    end

    it 'should return nil if no email addresses' do
      Pupa::ContactDetailList.new.email.should == nil
    end
  end

  describe '#find_by_type' do
    it 'should return the value of the first contact detail matching the type' do
      object.find_by_type('custom').should == 'content'
    end

    it 'should return nil if no contact detail matches the type' do
      Pupa::ContactDetailList.new.find_by_type('custom').should == nil
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
pupa-0.1.11 spec/models/contact_detail_list_spec.rb
pupa-0.1.10 spec/models/contact_detail_list_spec.rb
pupa-0.1.9 spec/models/contact_detail_list_spec.rb
pupa-0.1.8 spec/models/contact_detail_list_spec.rb
pupa-0.1.7 spec/models/contact_detail_list_spec.rb
pupa-0.1.6 spec/models/contact_detail_list_spec.rb
pupa-0.1.5 spec/models/contact_detail_list_spec.rb
pupa-0.1.4 spec/models/contact_detail_list_spec.rb
pupa-0.1.3 spec/models/contact_detail_list_spec.rb
pupa-0.1.2 spec/models/contact_detail_list_spec.rb
pupa-0.1.1 spec/models/contact_detail_list_spec.rb
pupa-0.1.0 spec/models/contact_detail_list_spec.rb
pupa-0.0.13 spec/models/contact_detail_list_spec.rb
pupa-0.0.12 spec/models/contact_detail_list_spec.rb
pupa-0.0.11 spec/models/contact_detail_list_spec.rb
pupa-0.0.10 spec/models/contact_detail_list_spec.rb
pupa-0.0.9 spec/models/contact_detail_list_spec.rb
pupa-0.0.8 spec/models/contact_detail_list_spec.rb
pupa-0.0.7 spec/models/contact_detail_list_spec.rb
pupa-0.0.6 spec/models/contact_detail_list_spec.rb