Sha256: 9c4479ead016cff2c55cb8f79dda17d94fb5e59ff2b21d05ba1436529fe5c4c0

Contents?: true

Size: 1.34 KB

Versions: 8

Compression:

Stored size: 1.34 KB

Contents

require "spec_helper"
require "omnicontacts/importer/hotmail"

describe OmniContacts::Importer::Hotmail do

  let(:hotmail) { OmniContacts::Importer::Hotmail.new({}, "client_id", "client_secret") }

  let(:contacts_as_json) {
    "{
       \"data\":
       [{
       \"id\": \"contact.b4466224b2ca42798c3d4ea90c75aa56\", 
       \"first_name\": null, 
       \"last_name\": null, 
       \"name\": \"henrik@hotmail.com\", 
       \"gender\": null, 
       \"is_friend\": false,
       \"is_favorite\": false,  
       \"user_id\": null, 
       \"birth_day\": 29, 
       \"birth_month\": 3 
       }]
    }" }

  describe "fetch_contacts_using_access_token" do

    let(:token) { "token" }
    let(:token_type) { "token_type" }

    it "should request the contacts by providing the token in the url" do
      hotmail.should_receive(:https_get) do |host, path, params, headers|
        params[:access_token].should eq(token)
        contacts_as_json
      end
      hotmail.fetch_contacts_using_access_token token, token_type
    end

    it "should correctly parse the contacts" do
      hotmail.should_receive(:https_get).and_return(contacts_as_json)
      result = hotmail.fetch_contacts_using_access_token token, token_type
      result.size.should be(1)
      result.first[:name].should be_nil
      result.first[:email].should eq("henrik@hotmail.com")
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
omnicontacts-0.2.5 spec/omnicontacts/importer/hotmail_spec.rb
omnicontacts-0.2.4 spec/omnicontacts/importer/hotmail_spec.rb
omnicontacts-0.2.3 spec/omnicontacts/importer/hotmail_spec.rb
omnicontacts-0.2.2 spec/omnicontacts/importer/hotmail_spec.rb
omnicontacts-0.2.1 spec/omnicontacts/importer/hotmail_spec.rb
omnicontacts-0.2.0 spec/omnicontacts/importer/hotmail_spec.rb
omnicontacts-0.1.7 spec/omnicontacts/importer/hotmail_spec.rb
omnicontacts-0.1.6 spec/omnicontacts/importer/hotmail_spec.rb