Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

made windows live results return a collection of contact objects as well

  • Loading branch information...
commit 6967956cca127efb635f6f808b4f2f29fa8a30b1 1 parent 9bc68f9
dusty authored committed
View
3  lib/contacts/windows_live.rb
@@ -154,7 +154,8 @@ def self.parse_xml(xml)
name = "#{first_name} #{last_name}"
name.strip!
end
- contacts.push([name, email])
+ new_contact = Contact.new(email, name)
+ contacts << new_contact
end
return contacts
View
12 spec/windows_live/windows_live_spec.rb
@@ -10,10 +10,14 @@
it 'parse the XML contacts document' do
contacts = Contacts::WindowsLive.parse_xml(contacts_xml)
- contacts.should == [ [nil, 'froz@gmail.com'],
- ['Rafael Timbo', 'timbo@hotmail.com'],
- [nil, 'betinho@hotmail.com']
- ]
+
+ contacts[0].name.should be_nil
+ contacts[0].email.should == 'froz@gmail.com'
+ contacts[1].name.should == 'Rafael Timbo'
+ contacts[1].email.should == 'timbo@hotmail.com'
+ contacts[2].name.should be_nil
+ contacts[2].email.should == 'betinho@hotmail.com'
+
end
it 'should can be initialized by a YAML file' do
Please sign in to comment.
Something went wrong with that request. Please try again.