bitsa 0.20 → 0.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile.lock +26 -20
- data/HISTORY +11 -1
- data/README.rdoc +11 -2
- data/bin/bitsa +0 -1
- data/bitsa.gemspec +4 -4
- data/lib/bitsa.rb +24 -14
- data/lib/bitsa/args_processor.rb +7 -3
- data/lib/bitsa/contacts_cache.rb +8 -7
- data/lib/bitsa/gmail_contacts_loader.rb +19 -13
- data/lib/bitsa/settings.rb +8 -0
- data/lib/bitsa/version.rb +1 -1
- data/rvmrc +1 -0
- data/spec/helper.rb +5 -1
- data/spec/lib/bitsa/args_processor_spec.rb +123 -0
- data/spec/lib/bitsa/confg_file_spec.rb +34 -0
- data/spec/lib/bitsa/contacts_cache_spec.rb +331 -0
- data/spec/lib/bitsa/gmail_contacts_loader_spec.rb +203 -0
- data/spec/lib/bitsa/settings_spec.rb +50 -0
- data/spec/lib/bitsa_spec.rb +2 -0
- data/tasks/spec.rake +5 -5
- metadata +64 -46
- data/spec/args_processor_spec.rb +0 -66
- data/spec/confg_file_spec.rb +0 -32
- data/spec/contacts_cache_spec.rb +0 -294
- data/spec/gmail_contacts_loader_spec.rb +0 -89
- data/spec/settings_spec.rb +0 -34
@@ -1,89 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/helper'
|
2
|
-
|
3
|
-
require 'fakeweb'
|
4
|
-
|
5
|
-
require "bitsa/contacts_cache"
|
6
|
-
require "bitsa/gmail_contacts_loader"
|
7
|
-
|
8
|
-
describe Bitsa::GmailContactsLoader do
|
9
|
-
context "Bitsa::GmailContactsLoader" do
|
10
|
-
before(:each) do
|
11
|
-
FakeWeb.allow_net_connect = false
|
12
|
-
FakeWeb.register_uri(:post, "https://www.google.com/accounts/ClientLogin",
|
13
|
-
:body => "SID=DQAAAGgA...7Zg8CTN\nLSID=DQAAAGsA...lk8BBbG\nAuth=DQAAAGgA...dk3fA5N")
|
14
|
-
FakeWeb.register_uri(:get, "https://www.google.com/m8/feeds/contacts/test/thin?orderby=lastmodified&showdeleted=true&max-results=25&start-index=1",
|
15
|
-
:body => <<eos
|
16
|
-
<feed gd:etag='W/"AkANQXo7eCp7ImA9WxFTGUo."' xmlns:gContact='http://schemas.google.com/contact/2008' xmlns:gd='http://schemas.google.com/g/2005' xmlns:batch='http://schemas.google.com/gdata/batch' xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/' xmlns='http://www.w3.org/2005/Atom'>
|
17
|
-
<id>
|
18
|
-
somebody@example.com
|
19
|
-
</id>
|
20
|
-
<updated>
|
21
|
-
2010-04-11T09:39:50.400Z
|
22
|
-
</updated>
|
23
|
-
<category term='http://schemas.google.com/contact/2008#contact' scheme='http://schemas.google.com/g/2005#kind'/>
|
24
|
-
<title>
|
25
|
-
Somebodys's Contacts
|
26
|
-
</title>
|
27
|
-
<link href='http://www.google.com/' rel='alternate' type='text/html'/>
|
28
|
-
<link href='http://www.google.com/m8/feeds/contacts/somebody%40example.com/thin' rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml'/>
|
29
|
-
<link href='http://www.google.com/m8/feeds/contacts/somebody%40example.com/thin' rel='http://schemas.google.com/g/2005#post' type='application/atom+xml'/>
|
30
|
-
<link href='http://www.google.com/m8/feeds/contacts/somebody%40example.com/thin/batch' rel='http://schemas.google.com/g/2005#batch' type='application/atom+xml'/>
|
31
|
-
<link href='http://www.google.com/m8/feeds/contacts/somebody%40example.com/thin?max-results=25' rel='self' type='application/atom+xml'/>
|
32
|
-
<author>
|
33
|
-
<name>
|
34
|
-
Somebody
|
35
|
-
</name>
|
36
|
-
<email>
|
37
|
-
somebody@example.com
|
38
|
-
</email>
|
39
|
-
</author>
|
40
|
-
<generator uri='http://www.google.com/m8/feeds' version='1.0'>
|
41
|
-
Contacts
|
42
|
-
</generator>
|
43
|
-
<openSearch:totalResults>
|
44
|
-
1
|
45
|
-
</openSearch:totalResults>
|
46
|
-
<openSearch:startIndex>
|
47
|
-
1
|
48
|
-
</openSearch:startIndex>
|
49
|
-
<openSearch:itemsPerPage>
|
50
|
-
25
|
51
|
-
</openSearch:itemsPerPage>
|
52
|
-
<entry gd:etag='"SHc-fTVSLyp7ImA9WxBaEkwIQAU."'>
|
53
|
-
<id>
|
54
|
-
http://www.google.com/m8/feeds/contacts/somebody%40example.com/base/0
|
55
|
-
</id>
|
56
|
-
<updated>
|
57
|
-
2010-03-21T23:05:19.955Z
|
58
|
-
</updated>
|
59
|
-
<app:edited xmlns:app='http://www.w3.org/2007/app'>
|
60
|
-
2010-03-21T23:05:19.955Z
|
61
|
-
</app:edited>
|
62
|
-
<category term='http://schemas.google.com/contact/2008#contact' scheme='http://schemas.google.com/g/2005#kind'/>
|
63
|
-
<title>
|
64
|
-
Jpe Bloggs
|
65
|
-
</title>
|
66
|
-
<link href='http://www.google.com/m8/feeds/photos/media/somebody%40example.com/0' gd:etag='"bwR-YldFbCp7ImBIGHMMbBALQAwWIFMBVVc."' rel='http://schemas.google.com/contacts/2008/rel#photo' type='image/*'/>
|
67
|
-
<link href='http://www.google.com/m8/feeds/contacts/somebody%40example.com/thin/0' rel='self' type='application/atom+xml'/>
|
68
|
-
<link href='http://www.google.com/m8/feeds/contacts/somebody%40example.com/thin/0' rel='edit' type='application/atom+xml'/>
|
69
|
-
<gd:email address='jbloggs@example.com' rel='http://schemas.google.com/g/2005#other' primary='true'/>
|
70
|
-
<gd:email address='another@example.com' rel='http://schemas.google.com/g/2005#work'/>
|
71
|
-
<gContact:groupMembershipInfo href='http://www.google.com/m8/feeds/groups/somebody%40example.com/base/6' deleted='false'/>
|
72
|
-
</entry>
|
73
|
-
</feed>
|
74
|
-
eos
|
75
|
-
)
|
76
|
-
end
|
77
|
-
|
78
|
-
it "should update cache" do
|
79
|
-
cache = mock('Bitsa::ContactsCache')
|
80
|
-
gcl = Bitsa::GmailContactsLoader.new('test', 'pw')
|
81
|
-
cache.should_receive(:update).once
|
82
|
-
cache.should_receive(:source_last_modified=).once
|
83
|
-
cache.should_receive(:source_last_modified)
|
84
|
-
cache.should_receive(:save).once
|
85
|
-
gcl.update_cache(cache)
|
86
|
-
end
|
87
|
-
|
88
|
-
end
|
89
|
-
end
|
data/spec/settings_spec.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require "helper"
|
2
|
-
require "bitsa/config_file"
|
3
|
-
require "bitsa/settings"
|
4
|
-
|
5
|
-
describe Bitsa::Settings do
|
6
|
-
context "An existing Settings object" do
|
7
|
-
|
8
|
-
it "should read a value from config file if it wasn't passed in options" do
|
9
|
-
settings = load_settings({})
|
10
|
-
settings.login.should == "test@gmail.com"
|
11
|
-
settings.password.should == "myPassword"
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should use values passed in options to override those in the config file" do
|
15
|
-
settings = load_settings({:login => "somebody@example.com"})
|
16
|
-
settings.login.should == "somebody@example.com"
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should still use values in config file when other options passed" do
|
20
|
-
settings = load_settings({:login => "somebody@example.com"})
|
21
|
-
settings.password.should == "myPassword"
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def load_settings(options)
|
29
|
-
settings = Bitsa::Settings.new
|
30
|
-
settings.load(Bitsa::ConfigFile.new("spec/data/config.yml"), options)
|
31
|
-
settings
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|