Sha256: a48d1a8674f837b8f643761a0a33f7a7c74c435e1f1a89a6163234de0ee4de7a

Contents?: true

Size: 1.54 KB

Versions: 3

Compression:

Stored size: 1.54 KB

Contents

require 'contacts/windows_live'

describe Contacts::WindowsLive do

  before(:each) do
    @path = Dir.getwd + '/spec/feeds/'
    @wl = Contacts::WindowsLive.new(@path + 'contacts.yml')
  end
  
  it 'parse the XML contacts document' do
    contacts = Contacts::WindowsLive.parse_xml(contacts_xml)
    contacts.size.should == 2
    contacts[0].service_id == "abc"
    contacts[0].name.should == "Mia Pia"
    contacts[0].firstname.should == "Mia"
    contacts[0].lastname.should == "Pia"
    contacts[0].emails.should include("mia@hotmail.com", "othermia@yahoo.com")
    contacts[0].phones.should include({"value"=>"(123) 123 1234", "type"=>"home"}, {"value"=>"(321) 555 1234", "type"=>"other"})
    contacts[0].addresses.should include({"region"=>"CA", "country"=>"USA", "postalCode"=>"92123", "streetAddress"=>"123 Green St", "type"=>"home", "locality"=>"Middleville", "formatted"=>"123 Green St, Middleville, CA, 92123, USA"})
    
    contacts[0].service_id == "def"
    contacts[1].name.should == ""
    contacts[1].firstname.should == nil
    contacts[1].lastname.should == nil
    contacts[1].emails.should include("marcus@hotmail.com")
    contacts[1].phones.should be_empty
    contacts[1].addresses.should be_empty
  end

  it 'should can be initialized by a YAML file' do
    wll = @wl.instance_variable_get('@wll')

    wll.appid.should == 'your_app_id'
    wll.securityalgorithm.should == 'wsignin1.0'
    wll.returnurl.should == 'http://yourserver.com/your_return_url'
  end

  def contacts_xml
    File.open(@path + 'wl_full_contacts.xml', 'r+').read
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
aurelian-contacts-0.3.1 spec/windows_live/windows_live_spec.rb
aurelian-contacts-0.3.2 spec/windows_live/windows_live_spec.rb
aurelian-contacts-0.3.3 spec/windows_live/windows_live_spec.rb