ref: master
vendor/contacts/test/unit/gmail_contact_importer_test.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
dir = File.dirname(__FILE__) require "#{dir}/../test_helper" require 'contacts' class GmailContactImporterTest < ContactImporterTestCase def setup super @account = TestAccounts[:gmail] end def test_successful_login Contacts.new(:gmail, @account.username, @account.password) end def test_importer_fails_with_invalid_password assert_raise(Contacts::AuthenticationError) do Contacts.new(:gmail, @account.username, "wrong_password") end end def test_importer_fails_with_blank_password assert_raise(Contacts::AuthenticationError) do Contacts.new(:gmail, @account.username, "") end end def test_importer_fails_with_blank_username assert_raise(Contacts::AuthenticationError) do Contacts.new(:gmail, "", @account.password) end end def test_fetch_contacts contacts = Contacts.new(:gmail, @account.username, @account.password).contacts @account.contacts.each do |contact| assert contacts.include?(contact), "Could not find: #{contact.inspect} in #{contacts.inspect}" end end end |