Skip to content

Commit

Permalink
Fix Ppl::Format::Contact::Full for the new name entity
Browse files Browse the repository at this point in the history
  • Loading branch information
henrycatalinismith committed Jul 13, 2013
1 parent b60af1d commit bcfa4e1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/ppl/format/contact/full.rb
Expand Up @@ -39,7 +39,7 @@ def process(contact)
def first_line(contact)
line = ""
if !contact.name.nil?
line += contact.name
line += contact.name.full
end
email_address = choose_first_line_address(contact)
unless email_address.nil?
Expand Down
9 changes: 6 additions & 3 deletions spec/ppl/format/contact/full_spec.rb
Expand Up @@ -23,18 +23,21 @@
end

it "should start with the contact's name" do
@contact.name = "John Doe"
@contact.name = Ppl::Entity::Name.new
@contact.name.full = "John Doe"
@format.process(@contact).should eq "John Doe"
end

it "should include their email address in brackets" do
@contact.name = "John Doe"
@contact.name = Ppl::Entity::Name.new
@contact.name.full = "John Doe"
@contact.email_addresses << Ppl::Entity::EmailAddress.new("john@example.org")
@format.process(@contact).should include "John Doe <john@example.org>"
end

it "should include their preferred email address in brackets" do
@contact.name = "John Doe"
@contact.name = Ppl::Entity::Name.new
@contact.name.full = "John Doe"
@contact.email_addresses << Ppl::Entity::EmailAddress.new("john@example.org")
@contact.email_addresses << Ppl::Entity::EmailAddress.new("fred@testtest.es")
@contact.email_addresses[1].preferred = true
Expand Down

0 comments on commit bcfa4e1

Please sign in to comment.