atig 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +24 -0
- data/Gemfile +3 -0
- data/README.mkdn +52 -0
- data/Rakefile +15 -0
- data/atig.gemspec +25 -0
- data/bin/atig +74 -0
- data/docs/OMakefile +32 -0
- data/docs/OMakeroot +45 -0
- data/docs/_static/allow.png +0 -0
- data/docs/_static/emacs.png +0 -0
- data/docs/_static/irc_setting.png +0 -0
- data/docs/_static/irssi.png +0 -0
- data/docs/_static/limechat.png +0 -0
- data/docs/_static/limechat_s.png +0 -0
- data/docs/_static/oauth_channel.png +0 -0
- data/docs/_static/screenshot.png +0 -0
- data/docs/_static/structure.png +0 -0
- data/docs/_static/verify.png +0 -0
- data/docs/changelog.rst +96 -0
- data/docs/commandline_options.rst +21 -0
- data/docs/commands.rst +84 -0
- data/docs/conf.py +194 -0
- data/docs/config.rst +159 -0
- data/docs/feature.rst +41 -0
- data/docs/graphics.graffle +1995 -0
- data/docs/hacking_guide.rst +43 -0
- data/docs/index.rst +109 -0
- data/docs/irc.rst +31 -0
- data/docs/options.rst +75 -0
- data/docs/quickstart.rst +89 -0
- data/docs/resize.sh +7 -0
- data/docs/tiarra.rst +2 -0
- data/docs/tig.rst +21 -0
- data/lib/atig.rb +19 -0
- data/lib/atig/agent.rb +8 -0
- data/lib/atig/agent/agent.rb +38 -0
- data/lib/atig/agent/clenup.rb +23 -0
- data/lib/atig/agent/dm.rb +35 -0
- data/lib/atig/agent/following.rb +45 -0
- data/lib/atig/agent/full_list.rb +20 -0
- data/lib/atig/agent/list.rb +55 -0
- data/lib/atig/agent/list_status.rb +46 -0
- data/lib/atig/agent/mention.rb +13 -0
- data/lib/atig/agent/other_list.rb +18 -0
- data/lib/atig/agent/own_list.rb +18 -0
- data/lib/atig/agent/stream_follow.rb +38 -0
- data/lib/atig/agent/timeline.rb +13 -0
- data/lib/atig/agent/user_stream.rb +31 -0
- data/lib/atig/basic_twitter.rb +116 -0
- data/lib/atig/bitly.rb +52 -0
- data/lib/atig/channel.rb +5 -0
- data/lib/atig/channel/channel.rb +17 -0
- data/lib/atig/channel/dm.rb +14 -0
- data/lib/atig/channel/list.rb +76 -0
- data/lib/atig/channel/mention.rb +20 -0
- data/lib/atig/channel/retweet.rb +28 -0
- data/lib/atig/channel/timeline.rb +74 -0
- data/lib/atig/command.rb +21 -0
- data/lib/atig/command/autofix.rb +58 -0
- data/lib/atig/command/command.rb +24 -0
- data/lib/atig/command/command_helper.rb +95 -0
- data/lib/atig/command/destroy.rb +44 -0
- data/lib/atig/command/dm.rb +31 -0
- data/lib/atig/command/favorite.rb +27 -0
- data/lib/atig/command/info.rb +50 -0
- data/lib/atig/command/limit.rb +15 -0
- data/lib/atig/command/location.rb +23 -0
- data/lib/atig/command/name.rb +18 -0
- data/lib/atig/command/option.rb +37 -0
- data/lib/atig/command/refresh.rb +18 -0
- data/lib/atig/command/reply.rb +37 -0
- data/lib/atig/command/retweet.rb +63 -0
- data/lib/atig/command/search.rb +51 -0
- data/lib/atig/command/spam.rb +26 -0
- data/lib/atig/command/status.rb +41 -0
- data/lib/atig/command/thread.rb +44 -0
- data/lib/atig/command/time.rb +32 -0
- data/lib/atig/command/uptime.rb +32 -0
- data/lib/atig/command/user.rb +42 -0
- data/lib/atig/command/user_info.rb +27 -0
- data/lib/atig/command/version.rb +49 -0
- data/lib/atig/command/whois.rb +39 -0
- data/lib/atig/db/db.rb +60 -0
- data/lib/atig/db/followings.rb +131 -0
- data/lib/atig/db/listenable.rb +22 -0
- data/lib/atig/db/lists.rb +76 -0
- data/lib/atig/db/roman.rb +30 -0
- data/lib/atig/db/sized_uniq_array.rb +62 -0
- data/lib/atig/db/sql.rb +35 -0
- data/lib/atig/db/statuses.rb +147 -0
- data/lib/atig/db/transaction.rb +47 -0
- data/lib/atig/exception_util.rb +26 -0
- data/lib/atig/gateway.rb +62 -0
- data/lib/atig/gateway/channel.rb +99 -0
- data/lib/atig/gateway/session.rb +326 -0
- data/lib/atig/http.rb +95 -0
- data/lib/atig/ifilter.rb +7 -0
- data/lib/atig/ifilter/expand_url.rb +74 -0
- data/lib/atig/ifilter/retweet.rb +14 -0
- data/lib/atig/ifilter/retweet_time.rb +16 -0
- data/lib/atig/ifilter/sanitize.rb +18 -0
- data/lib/atig/ifilter/strip.rb +15 -0
- data/lib/atig/ifilter/utf7.rb +26 -0
- data/lib/atig/ifilter/xid.rb +36 -0
- data/lib/atig/levenshtein.rb +49 -0
- data/lib/atig/monkey.rb +4 -0
- data/lib/atig/oauth-patch.rb +40 -0
- data/lib/atig/oauth.rb +55 -0
- data/lib/atig/ofilter.rb +4 -0
- data/lib/atig/ofilter/escape_url.rb +102 -0
- data/lib/atig/ofilter/footer.rb +20 -0
- data/lib/atig/ofilter/geo.rb +17 -0
- data/lib/atig/ofilter/short_url.rb +47 -0
- data/lib/atig/option.rb +90 -0
- data/lib/atig/scheduler.rb +79 -0
- data/lib/atig/search.rb +22 -0
- data/lib/atig/search_twitter.rb +21 -0
- data/lib/atig/sized_hash.rb +33 -0
- data/lib/atig/stream.rb +66 -0
- data/lib/atig/twitter.rb +79 -0
- data/lib/atig/twitter_struct.rb +63 -0
- data/lib/atig/unu.rb +27 -0
- data/lib/atig/update_checker.rb +53 -0
- data/lib/atig/url_escape.rb +62 -0
- data/lib/atig/util.rb +16 -0
- data/lib/atig/version.rb +3 -0
- data/lib/memory_profiler.rb +77 -0
- data/spec/command/autofix_spec.rb +35 -0
- data/spec/command/destroy_spec.rb +98 -0
- data/spec/command/dm_spec.rb +28 -0
- data/spec/command/favorite_spec.rb +55 -0
- data/spec/command/limit_spec.rb +27 -0
- data/spec/command/location_spec.rb +25 -0
- data/spec/command/name_spec.rb +19 -0
- data/spec/command/option_spec.rb +133 -0
- data/spec/command/refresh_spec.rb +22 -0
- data/spec/command/reply_spec.rb +79 -0
- data/spec/command/retweet_spec.rb +66 -0
- data/spec/command/spam_spec.rb +27 -0
- data/spec/command/status_spec.rb +44 -0
- data/spec/command/thread_spec.rb +91 -0
- data/spec/command/time_spec.rb +52 -0
- data/spec/command/uptime_spec.rb +55 -0
- data/spec/command/user_info_spec.rb +42 -0
- data/spec/command/user_spec.rb +50 -0
- data/spec/command/version_spec.rb +67 -0
- data/spec/command/whois_spec.rb +78 -0
- data/spec/db/followings_spec.rb +100 -0
- data/spec/db/listenable_spec.rb +32 -0
- data/spec/db/lists_spec.rb +104 -0
- data/spec/db/roman_spec.rb +17 -0
- data/spec/db/sized_uniq_array_spec.rb +63 -0
- data/spec/db/statuses_spec.rb +180 -0
- data/spec/ifilter/expand_url_spec.rb +44 -0
- data/spec/ifilter/retweet_spec.rb +28 -0
- data/spec/ifilter/retweet_time_spec.rb +25 -0
- data/spec/ifilter/sanitize_spec.rb +25 -0
- data/spec/ifilter/sid_spec.rb +29 -0
- data/spec/ifilter/strip_spec.rb +23 -0
- data/spec/ifilter/tid_spec.rb +29 -0
- data/spec/ifilter/utf7_spec.rb +30 -0
- data/spec/levenshtein_spec.rb +24 -0
- data/spec/ofilter/escape_url_spec.rb +50 -0
- data/spec/ofilter/footer_spec.rb +32 -0
- data/spec/ofilter/geo_spec.rb +33 -0
- data/spec/ofilter/short_url_spec.rb +127 -0
- data/spec/option_spec.rb +91 -0
- data/spec/sized_hash_spec.rb +45 -0
- data/spec/spec_helper.rb +35 -0
- data/spec/update_checker_spec.rb +55 -0
- metadata +326 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
# -*- mode:ruby; coding:utf-8 -*-
|
2
|
+
|
3
|
+
require File.expand_path( '../../spec_helper', __FILE__ )
|
4
|
+
require 'atig/command/autofix'
|
5
|
+
require 'atig/command/command_helper'
|
6
|
+
|
7
|
+
describe Atig::Command::Autofix do
|
8
|
+
include CommandHelper
|
9
|
+
before do
|
10
|
+
@command = init Atig::Command::Autofix
|
11
|
+
@opts.autofix = true
|
12
|
+
target = status 'hello', 'id'=>'42'
|
13
|
+
entry = entry user(1,'mzp'), target, "entry", 1
|
14
|
+
@statuses.should_receive(:find_by_user).with(@me,:limit=>1).and_return([ entry ])
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should post normal tweet" do
|
18
|
+
res = status('blah blah')
|
19
|
+
@api.should_receive(:post).with('statuses/update', {:status=>'blah blah'}).and_return(res)
|
20
|
+
|
21
|
+
call '#twitter', "autofix", %w(blah blah)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should delete old similar tweet" do
|
25
|
+
res = status('hillo')
|
26
|
+
@api.should_receive(:post).with('statuses/update', {:status=>'hillo'}).and_return(res)
|
27
|
+
@api.should_receive(:post).with("statuses/destroy/42")
|
28
|
+
@statuses.should_receive(:remove_by_id).with(1)
|
29
|
+
|
30
|
+
@channel.should_receive(:notify).with("Similar update in previous. Conclude that it has error.")
|
31
|
+
@channel.should_receive(:notify).with("And overwrite previous as new status: hillo")
|
32
|
+
|
33
|
+
call '#twitter', "autofix", %w(hillo)
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
# -*- mode:ruby; coding:utf-8 -*-
|
2
|
+
|
3
|
+
require File.expand_path( '../../spec_helper', __FILE__ )
|
4
|
+
require 'atig/command/destroy'
|
5
|
+
require 'atig/command/command_helper'
|
6
|
+
|
7
|
+
describe Atig::Command::Destroy,"when status is not removed" do
|
8
|
+
include CommandHelper
|
9
|
+
|
10
|
+
before do
|
11
|
+
@command = init Atig::Command::Destroy
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should specified other's status" do
|
15
|
+
entry = entry user(2,'other'), status('blah blah', 'id'=>'1')
|
16
|
+
@statuses.stub!(:find_by_tid).with('b').and_return(entry)
|
17
|
+
|
18
|
+
@channel.should_receive(:notify).with("The status you specified by the ID tid is not yours.")
|
19
|
+
call "#twitter","destory",%w(b)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe Atig::Command::Destroy,"when remove recently tweet" do
|
24
|
+
include CommandHelper
|
25
|
+
|
26
|
+
before do
|
27
|
+
@command = init Atig::Command::Destroy
|
28
|
+
|
29
|
+
target = status 'blah blah', 'id'=>'1'
|
30
|
+
entry = entry @me, target,'entry',1
|
31
|
+
@res = mock 'res'
|
32
|
+
|
33
|
+
stub_status(:find_by_tid,'a' => entry)
|
34
|
+
stub_status(:find_by_sid,'mzp:a' => entry)
|
35
|
+
stub_status(:find_by_screen_name,'mzp' => [ entry ], :default=>[])
|
36
|
+
|
37
|
+
# api
|
38
|
+
@api.should_receive(:post).with("statuses/destroy/1")
|
39
|
+
|
40
|
+
# notice
|
41
|
+
@channel.should_receive(:notify).with("Destroyed: blah blah")
|
42
|
+
|
43
|
+
# update topics
|
44
|
+
new_entry = entry @me, status('foo', 'id'=>'2')
|
45
|
+
@gateway.should_receive(:topic).with(new_entry)
|
46
|
+
|
47
|
+
@statuses.should_receive(:remove_by_id).with(1).and_return{
|
48
|
+
@statuses.should_receive(:find_by_screen_name).with(@me.screen_name,:limit=>1).and_return{
|
49
|
+
[ new_entry ]
|
50
|
+
}
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should specified by tid" do
|
55
|
+
call "#twitter","destory",%w(a)
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should remove status by user" do
|
59
|
+
call "#twitter","destory",%w(mzp)
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should remove status by sid" do
|
63
|
+
call "#twitter","destory",%w(mzp:a)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe Atig::Command::Destroy,"when remove old tweet" do
|
68
|
+
include CommandHelper
|
69
|
+
|
70
|
+
before do
|
71
|
+
@command = init Atig::Command::Destroy
|
72
|
+
|
73
|
+
target = status 'blah blah', 'id'=>'1'
|
74
|
+
entry = entry @me, target,'entry',1
|
75
|
+
@res = mock 'res'
|
76
|
+
|
77
|
+
stub_status(:find_by_tid,'a' => entry)
|
78
|
+
stub_status(:find_by_sid,'mzp:a' => entry)
|
79
|
+
stub_status(:find_by_screen_name, @db.me.screen_name => [ entry ], :default=>[])
|
80
|
+
|
81
|
+
# api
|
82
|
+
@api.should_receive(:post).with("statuses/destroy/1")
|
83
|
+
|
84
|
+
# notice
|
85
|
+
@channel.should_receive(:notify).with("Destroyed: blah blah")
|
86
|
+
|
87
|
+
# update topics
|
88
|
+
@statuses.should_receive(:remove_by_id).with(1)
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should specified by tid" do
|
92
|
+
call "#twitter","destory",%w(a)
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should remove status by sid" do
|
96
|
+
call "#twitter","destory",%w(mzp:a)
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- mode:ruby; coding:utf-8 -*-
|
2
|
+
|
3
|
+
require File.expand_path( '../../spec_helper', __FILE__ )
|
4
|
+
require 'atig/command/dm'
|
5
|
+
require 'atig/command/command_helper'
|
6
|
+
|
7
|
+
describe Atig::Command::Dm do
|
8
|
+
include CommandHelper
|
9
|
+
before do
|
10
|
+
@command = init Atig::Command::Dm
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should have '/me dm' name" do
|
14
|
+
@gateway.names.should == ['d', 'dm','dms']
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should post the status by API" do
|
18
|
+
@api.should_receive(:post).with('direct_messages/new',
|
19
|
+
{:user=>'mzp', :text=> 'blah blah'})
|
20
|
+
@channel.should_receive(:notify).with("Sent message to mzp: blah blah")
|
21
|
+
call '#twitter', "dm", %w(mzp blah blah)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should post the status by API" do
|
25
|
+
@channel.should_receive(:notify).with("/me dm <SCREEN_NAME> blah blah")
|
26
|
+
call '#twitter', "dm", %w()
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# -*- mode:ruby; coding:utf-8 -*-
|
2
|
+
|
3
|
+
require File.expand_path( '../../spec_helper', __FILE__ )
|
4
|
+
require 'atig/command/favorite'
|
5
|
+
require 'atig/command/command_helper'
|
6
|
+
|
7
|
+
describe Atig::Command::Favorite do
|
8
|
+
include CommandHelper
|
9
|
+
before do
|
10
|
+
@command = init Atig::Command::Favorite
|
11
|
+
|
12
|
+
target = status 'blah blah', 'id'=>'1'
|
13
|
+
entry = entry user(1,'mzp'), target
|
14
|
+
@res = mock 'res'
|
15
|
+
|
16
|
+
stub_status(:find_by_tid,'a' => entry)
|
17
|
+
stub_status(:find_by_sid,'mzp:a' => entry)
|
18
|
+
stub_status(:find_by_screen_name,'mzp' => [ entry ], :default=>[])
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should post fav by tid" do
|
22
|
+
@api.should_receive(:post).with("favorites/create/1")
|
23
|
+
@channel.should_receive(:notify).with("FAV: mzp: blah blah")
|
24
|
+
|
25
|
+
call "#twitter","fav",%w(a)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should post fav by sid" do
|
29
|
+
@api.should_receive(:post).with("favorites/create/1")
|
30
|
+
@channel.should_receive(:notify).with("FAV: mzp: blah blah")
|
31
|
+
|
32
|
+
call "#twitter","fav",%w(mzp:a)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should post fav by screen name" do
|
36
|
+
@api.should_receive(:post).with("favorites/create/1")
|
37
|
+
@channel.should_receive(:notify).with("FAV: mzp: blah blah")
|
38
|
+
|
39
|
+
call "#twitter","fav",%w(mzp)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should post fav by screen name with at" do
|
43
|
+
@api.should_receive(:post).with("favorites/create/1")
|
44
|
+
@channel.should_receive(:notify).with("FAV: mzp: blah blah")
|
45
|
+
|
46
|
+
call "#twitter","fav",%w(@mzp)
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should post unfav" do
|
50
|
+
@api.should_receive(:post).with("favorites/destroy/1")
|
51
|
+
@channel.should_receive(:notify).with("UNFAV: mzp: blah blah")
|
52
|
+
|
53
|
+
call "#twitter","unfav",%w(a)
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- mode:ruby; coding:utf-8 -*-
|
2
|
+
|
3
|
+
require File.expand_path( '../../spec_helper', __FILE__ )
|
4
|
+
require 'atig/command/limit'
|
5
|
+
require 'atig/command/command_helper'
|
6
|
+
|
7
|
+
describe Atig::Command::Limit do
|
8
|
+
include CommandHelper
|
9
|
+
|
10
|
+
before do
|
11
|
+
@reset = ::Time.utc(2010,9,25,8,24,12)
|
12
|
+
@command = init Atig::Command::Limit
|
13
|
+
@api.stub!(:limit).and_return(150)
|
14
|
+
@api.stub!(:remain).and_return(148)
|
15
|
+
@api.stub!(:reset).and_return(@reset)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should provide limit command" do
|
19
|
+
@gateway.names.should == ['rls','limit','limits']
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should show limit" do
|
23
|
+
@channel.should_receive(:notify).with("148 / 150 (reset at 2010-09-25 08:24:12)")
|
24
|
+
call '#twitter', 'limit', []
|
25
|
+
@gateway.notified.should == '#twitter'
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- mode:ruby; coding:utf-8 -*-
|
2
|
+
|
3
|
+
require File.expand_path( '../../spec_helper', __FILE__ )
|
4
|
+
require 'atig/command/location'
|
5
|
+
require 'atig/command/command_helper'
|
6
|
+
|
7
|
+
describe Atig::Command::Location do
|
8
|
+
include CommandHelper
|
9
|
+
|
10
|
+
before do
|
11
|
+
@command = init Atig::Command::Location
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should update location" do
|
15
|
+
@api.should_receive(:post).with('account/update_profile',:location=>'some place')
|
16
|
+
@channel.should_receive(:notify).with("You are in some place now.")
|
17
|
+
call '#twitter','location',%w(some place)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should reset location" do
|
21
|
+
@api.should_receive(:post).with('account/update_profile',:location=>'')
|
22
|
+
@channel.should_receive(:notify).with("You are nowhere now.")
|
23
|
+
call '#twitter','location',%w()
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- mode:ruby; coding:utf-8 -*-
|
2
|
+
|
3
|
+
require File.expand_path( '../../spec_helper', __FILE__ )
|
4
|
+
require 'atig/command/name'
|
5
|
+
require 'atig/command/command_helper'
|
6
|
+
|
7
|
+
describe Atig::Command::Name do
|
8
|
+
include CommandHelper
|
9
|
+
|
10
|
+
before do
|
11
|
+
@command = init Atig::Command::Name
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should update name" do
|
15
|
+
@api.should_receive(:post).with('account/update_profile',:name=>'mzp')
|
16
|
+
@channel.should_receive(:notify).with("You are named mzp.")
|
17
|
+
call '#twitter', 'name', %w(mzp)
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,133 @@
|
|
1
|
+
# -*- mode:ruby; coding:utf-8 -*-
|
2
|
+
|
3
|
+
require File.expand_path( '../spec_helper', File.dirname(__FILE__))
|
4
|
+
require 'atig/command/option'
|
5
|
+
require 'atig/command/command_helper'
|
6
|
+
|
7
|
+
describe Atig::Command::Option do
|
8
|
+
include CommandHelper
|
9
|
+
|
10
|
+
before do
|
11
|
+
@command = init Atig::Command::Option
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should provide option command" do
|
15
|
+
@command.command_name.should == %w(opt opts option options)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe Atig::Command::Option, 'when have many property' do
|
20
|
+
include CommandHelper
|
21
|
+
|
22
|
+
before do
|
23
|
+
@command = init Atig::Command::Option
|
24
|
+
@opts.foo1 = true
|
25
|
+
@opts.foo2 = 42
|
26
|
+
@opts.foo3 = 42.1
|
27
|
+
|
28
|
+
@opts.stub!(:foo1=)
|
29
|
+
@opts.stub!(:foo2=)
|
30
|
+
@opts.stub!(:foo3=)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should list up values" do
|
34
|
+
xs = []
|
35
|
+
@channel.stub!(:notify){|x| xs << x}
|
36
|
+
call '#twitter', 'opt', %w()
|
37
|
+
xs.should == [
|
38
|
+
"foo1 => true",
|
39
|
+
"foo2 => 42",
|
40
|
+
"foo3 => 42.1",
|
41
|
+
]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
describe Atig::Command::Option, 'when have bool property' do
|
47
|
+
include CommandHelper
|
48
|
+
|
49
|
+
before do
|
50
|
+
@command = init Atig::Command::Option
|
51
|
+
@opts.stub!(:foo).and_return true
|
52
|
+
@opts.stub!(:foo=){|v| @value = v }
|
53
|
+
@channel.stub!(:notify)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should show the value" do
|
57
|
+
@channel.should_receive(:notify).with("foo => true")
|
58
|
+
call '#twitter', 'opt', %w(foo)
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should update the value" do
|
62
|
+
call '#twitter', 'opt', %w(foo false)
|
63
|
+
@value.should be_false
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe Atig::Command::Option, 'when have int property' do
|
68
|
+
include CommandHelper
|
69
|
+
|
70
|
+
before do
|
71
|
+
@command = init Atig::Command::Option
|
72
|
+
@opts.stub!(:foo).and_return 42
|
73
|
+
@opts.stub!(:foo=){|v| @value = v }
|
74
|
+
@channel.stub!(:notify)
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should show the value" do
|
78
|
+
@channel.should_receive(:notify).with("foo => 42")
|
79
|
+
call '#twitter', 'opt', %w(foo)
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should update the value" do
|
83
|
+
call '#twitter', 'opt', %w(foo 42)
|
84
|
+
@value.should == 42
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe Atig::Command::Option, 'when have float property' do
|
89
|
+
include CommandHelper
|
90
|
+
|
91
|
+
before do
|
92
|
+
@command = init Atig::Command::Option
|
93
|
+
@opts.stub!(:foo).and_return 1.23
|
94
|
+
@opts.stub!(:foo=){|v| @value = v }
|
95
|
+
@channel.stub!(:notify)
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should show the value" do
|
99
|
+
@channel.should_receive(:notify).with("foo => 1.23")
|
100
|
+
call '#twitter', 'opt', %w(foo)
|
101
|
+
end
|
102
|
+
|
103
|
+
it "should update the value" do
|
104
|
+
call '#twitter', 'opt', %w(foo 1.24)
|
105
|
+
@value.should == 1.24
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
describe Atig::Command::Option, 'when have string property' do
|
110
|
+
include CommandHelper
|
111
|
+
|
112
|
+
before do
|
113
|
+
@command = init Atig::Command::Option
|
114
|
+
@opts.stub!(:foo).and_return "bar"
|
115
|
+
@opts.stub!(:foo=){|v| @value = v }
|
116
|
+
@channel.stub!(:notify)
|
117
|
+
end
|
118
|
+
|
119
|
+
it "should show the value" do
|
120
|
+
@channel.should_receive(:notify).with("foo => bar")
|
121
|
+
call '#twitter', 'opt', %w(foo)
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should update the value" do
|
125
|
+
call '#twitter', 'opt', %w(foo baz)
|
126
|
+
@value.should == 'baz'
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should update the value" do
|
130
|
+
call '#twitter', 'opt', %w(foo blah Blah)
|
131
|
+
@value.should == 'blah Blah'
|
132
|
+
end
|
133
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- mode:ruby; coding:utf-8 -*-
|
2
|
+
|
3
|
+
require File.expand_path( '../../spec_helper', __FILE__ )
|
4
|
+
require 'atig/command/refresh'
|
5
|
+
require 'atig/command/command_helper'
|
6
|
+
require 'atig/command/info'
|
7
|
+
|
8
|
+
describe Atig::Command::Refresh do
|
9
|
+
include CommandHelper
|
10
|
+
|
11
|
+
before do
|
12
|
+
@command = init Atig::Command::Refresh
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should refresh all" do
|
16
|
+
@followings.should_receive(:invalidate)
|
17
|
+
@lists.should_receive(:invalidate).with(:all)
|
18
|
+
@channel.should_receive(:notify).with("refresh followings/lists...")
|
19
|
+
|
20
|
+
call '#twitter','refresh', []
|
21
|
+
end
|
22
|
+
end
|