Sha256: 8e9eb2f4145cf73a2df06b3ed21552abebe7e2edb7e697beec683333dbda6cdc

Contents?: true

Size: 1.85 KB

Versions: 20

Compression:

Stored size: 1.85 KB

Contents

describe Ppl::Entity::Contact do

  before(:each) do
    @contact = Ppl::Entity::Contact.new
  end

  describe "#id" do
    it "should return a value" do
      @contact.id.should be nil
    end
  end

  describe "#id=" do
    it "should accept a value" do
      @contact.id = "john"
      @contact.id.should eq "john"
    end
  end

  describe "#email_addresses" do
    it "should return an array" do
      @contact.email_addresses.should be_a(Array)
    end
  end

  describe "#birthday" do
    it "should return a value" do
      @contact.birthday.should eq nil
    end
  end

  describe "#postal_address" do
    it "should return a value" do
      @contact.postal_address.should eq nil
    end
  end

  describe "#has_email_address?" do
    it "should know if the contact has the given email address" do
      @contact.email_addresses.push "test@example.org"
      @contact.has_email_address?("test@example.org").should eq true
    end
    it "should know if the contact lacks the given email address" do
      @contact.has_email_address?("test@example.org").should eq false
    end
  end

  describe "#urls" do
    it "should return an array" do
      @contact.urls.should be_a(Array)
    end
  end

  describe "#nicknames" do
    it "should return an array" do
      @contact.nicknames.should be_a(Array)
    end
  end

  describe "#organizations" do
    it "should return an array" do
      @contact.organizations.should be_a(Array)
    end
  end

  describe "#phone_numbers" do
    it "should return an array" do
      @contact.phone_numbers.should be_a(Array)
    end
  end

  describe "#age" do
    it "should return nil if the date of birth is unknown" do
      @contact.age(Date.today).should eq nil
    end
    it "should return the contact's age" do
      @contact.birthday = Date.parse("1970-01-01")
      @contact.age(Date.parse("1980-01-02")).should eq 10
    end
  end

end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
ppl-1.25.0 spec/ppl/entity/contact_spec.rb
ppl-1.24.0 spec/ppl/entity/contact_spec.rb
ppl-1.23.0 spec/ppl/entity/contact_spec.rb
ppl-1.22.2 spec/ppl/entity/contact_spec.rb
ppl-1.22.1 spec/ppl/entity/contact_spec.rb
ppl-1.22.0 spec/ppl/entity/contact_spec.rb
ppl-1.21.0 spec/ppl/entity/contact_spec.rb
ppl-1.20.0 spec/ppl/entity/contact_spec.rb
ppl-1.19.0 spec/ppl/entity/contact_spec.rb
ppl-1.18.0 spec/ppl/entity/contact_spec.rb
ppl-1.17.2 spec/ppl/entity/contact_spec.rb
ppl-1.17.1 spec/ppl/entity/contact_spec.rb
ppl-1.17.0 spec/ppl/entity/contact_spec.rb
ppl-1.16.0 spec/ppl/entity/contact_spec.rb
ppl-1.15.1 spec/ppl/entity/contact_spec.rb
ppl-1.15.0 spec/ppl/entity/contact_spec.rb
ppl-1.14.1 spec/ppl/entity/contact_spec.rb
ppl-1.14.0 spec/ppl/entity/contact_spec.rb
ppl-1.13.0 spec/ppl/entity/contact_spec.rb
ppl-1.12.0 spec/ppl/entity/contact_spec.rb