t 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +28 -18
- data/lib/t/cli.rb +167 -166
- data/lib/t/delete.rb +12 -12
- data/lib/t/list.rb +26 -26
- data/lib/t/printable.rb +12 -2
- data/lib/t/rcfile.rb +11 -11
- data/lib/t/requestable.rb +5 -5
- data/lib/t/search.rb +14 -14
- data/lib/t/set.rb +15 -14
- data/lib/t/version.rb +1 -1
- data/spec/cli_spec.rb +154 -150
- data/spec/delete_spec.rb +11 -11
- data/spec/list_spec.rb +25 -24
- data/spec/rcfile_spec.rb +29 -15
- data/spec/search_spec.rb +19 -14
- data/spec/set_spec.rb +15 -15
- data/t.gemspec +1 -1
- metadata +3 -3
data/spec/delete_spec.rb
CHANGED
@@ -20,7 +20,7 @@ describe T::Delete do
|
|
20
20
|
|
21
21
|
describe "#block" do
|
22
22
|
before do
|
23
|
-
@delete.options = @delete.options.merge(
|
23
|
+
@delete.options = @delete.options.merge("profile" => fixture_path + "/.trc")
|
24
24
|
stub_delete("/1/blocks/destroy.json").
|
25
25
|
with(:query => {:screen_name => "sferik", :include_entities => "false"}).
|
26
26
|
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
@@ -37,7 +37,7 @@ describe T::Delete do
|
|
37
37
|
end
|
38
38
|
context "--id" do
|
39
39
|
before do
|
40
|
-
@delete.options = @delete.options.merge(
|
40
|
+
@delete.options = @delete.options.merge("id" => true)
|
41
41
|
stub_delete("/1/blocks/destroy.json").
|
42
42
|
with(:query => {:user_id => "7505382", :include_entities => "false"}).
|
43
43
|
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
@@ -53,7 +53,7 @@ describe T::Delete do
|
|
53
53
|
|
54
54
|
describe "#dm" do
|
55
55
|
before do
|
56
|
-
@delete.options = @delete.options.merge(
|
56
|
+
@delete.options = @delete.options.merge("profile" => fixture_path + "/.trc")
|
57
57
|
stub_get("/1/direct_messages/show/1773478249.json").
|
58
58
|
with(:query => {:include_entities => "false"}).
|
59
59
|
to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
@@ -90,7 +90,7 @@ describe T::Delete do
|
|
90
90
|
end
|
91
91
|
context "--force" do
|
92
92
|
before do
|
93
|
-
@delete.options = @delete.options.merge(
|
93
|
+
@delete.options = @delete.options.merge("force" => true)
|
94
94
|
end
|
95
95
|
it "should request the correct resource" do
|
96
96
|
@delete.dm("1773478249")
|
@@ -107,7 +107,7 @@ describe T::Delete do
|
|
107
107
|
|
108
108
|
describe "#favorite" do
|
109
109
|
before do
|
110
|
-
@delete.options = @delete.options.merge(
|
110
|
+
@delete.options = @delete.options.merge("profile" => fixture_path + "/.trc")
|
111
111
|
stub_get("/1/statuses/show/28439861609.json").
|
112
112
|
with(:query => {:include_entities => "false", :include_my_retweet => "false", :trim_user => "true"}).
|
113
113
|
to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
@@ -144,7 +144,7 @@ describe T::Delete do
|
|
144
144
|
end
|
145
145
|
context "--force" do
|
146
146
|
before do
|
147
|
-
@delete.options = @delete.options.merge(
|
147
|
+
@delete.options = @delete.options.merge("force" => true)
|
148
148
|
end
|
149
149
|
it "should request the correct resource" do
|
150
150
|
@delete.favorite("28439861609")
|
@@ -161,7 +161,7 @@ describe T::Delete do
|
|
161
161
|
|
162
162
|
describe "#list" do
|
163
163
|
before do
|
164
|
-
@delete.options = @delete.options.merge(
|
164
|
+
@delete.options = @delete.options.merge("profile" => fixture_path + "/.trc")
|
165
165
|
stub_get("/1/account/verify_credentials.json").
|
166
166
|
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
167
167
|
stub_get("/1/lists/show.json").
|
@@ -199,7 +199,7 @@ describe T::Delete do
|
|
199
199
|
end
|
200
200
|
context "--force" do
|
201
201
|
before do
|
202
|
-
@delete.options = @delete.options.merge(
|
202
|
+
@delete.options = @delete.options.merge("force" => true)
|
203
203
|
end
|
204
204
|
it "should request the correct resource" do
|
205
205
|
@delete.list("presidents")
|
@@ -216,7 +216,7 @@ describe T::Delete do
|
|
216
216
|
end
|
217
217
|
context "--id" do
|
218
218
|
before do
|
219
|
-
@delete.options = @delete.options.merge(
|
219
|
+
@delete.options = @delete.options.merge("id" => true)
|
220
220
|
stub_get("/1/lists/show.json").
|
221
221
|
with(:query => {:owner_screen_name => "sferik", :list_id => "8863586"}).
|
222
222
|
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
@@ -239,7 +239,7 @@ describe T::Delete do
|
|
239
239
|
|
240
240
|
describe "#status" do
|
241
241
|
before do
|
242
|
-
@delete.options = @delete.options.merge(
|
242
|
+
@delete.options = @delete.options.merge("profile" => fixture_path + "/.trc")
|
243
243
|
stub_get("/1/statuses/show/26755176471724032.json").
|
244
244
|
with(:query => {:include_entities => "false", :include_my_retweet => "false", :trim_user => "true"}).
|
245
245
|
to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
@@ -276,7 +276,7 @@ describe T::Delete do
|
|
276
276
|
end
|
277
277
|
context "--force" do
|
278
278
|
before do
|
279
|
-
@delete.options = @delete.options.merge(
|
279
|
+
@delete.options = @delete.options.merge("force" => true)
|
280
280
|
end
|
281
281
|
it "should request the correct resource" do
|
282
282
|
@delete.status("26755176471724032")
|
data/spec/list_spec.rb
CHANGED
@@ -22,7 +22,7 @@ describe T::List do
|
|
22
22
|
|
23
23
|
describe "#add" do
|
24
24
|
before do
|
25
|
-
@list.options = @list.options.merge(
|
25
|
+
@list.options = @list.options.merge("profile" => fixture_path + "/.trc")
|
26
26
|
stub_get("/1/account/verify_credentials.json").
|
27
27
|
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
28
28
|
stub_post("/1/lists/members/create_all.json").
|
@@ -43,7 +43,7 @@ describe T::List do
|
|
43
43
|
end
|
44
44
|
context "--id" do
|
45
45
|
before do
|
46
|
-
@list.options = @list.options.merge(
|
46
|
+
@list.options = @list.options.merge("id" => true)
|
47
47
|
stub_post("/1/lists/members/create_all.json").
|
48
48
|
with(:body => {:user_id => "7505382", :slug => "presidents", :owner_screen_name => "sferik"}).
|
49
49
|
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
@@ -74,7 +74,7 @@ describe T::List do
|
|
74
74
|
|
75
75
|
describe "#create" do
|
76
76
|
before do
|
77
|
-
@list.options = @list.options.merge(
|
77
|
+
@list.options = @list.options.merge("profile" => fixture_path + "/.trc")
|
78
78
|
stub_post("/1/lists/create.json").
|
79
79
|
with(:body => {:name => "presidents"}).
|
80
80
|
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
@@ -93,7 +93,7 @@ describe T::List do
|
|
93
93
|
|
94
94
|
describe "#information" do
|
95
95
|
before do
|
96
|
-
@list.options = @list.options.merge(
|
96
|
+
@list.options = @list.options.merge("profile" => fixture_path + "/.trc")
|
97
97
|
stub_get("/1/lists/show.json").
|
98
98
|
with(:query => {:owner_screen_name => "testcli", :slug => "presidents"}).
|
99
99
|
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
@@ -128,7 +128,7 @@ URL https://twitter.com/sferik/presidents
|
|
128
128
|
end
|
129
129
|
context "--id" do
|
130
130
|
before do
|
131
|
-
@list.options = @list.options.merge(
|
131
|
+
@list.options = @list.options.merge("id" => true)
|
132
132
|
stub_get("/1/lists/show.json").
|
133
133
|
with(:query => {:owner_id => "7505382", :slug => "presidents"}).
|
134
134
|
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
@@ -143,7 +143,7 @@ URL https://twitter.com/sferik/presidents
|
|
143
143
|
end
|
144
144
|
context "--csv" do
|
145
145
|
before do
|
146
|
-
@list.options = @list.options.merge(
|
146
|
+
@list.options = @list.options.merge("csv" => true)
|
147
147
|
end
|
148
148
|
it "should have the correct output" do
|
149
149
|
@list.information("presidents")
|
@@ -173,7 +173,7 @@ ID,Description,Slug,Screen name,Created at,Members,Subscribers,Following,Mode,UR
|
|
173
173
|
end
|
174
174
|
context "--csv" do
|
175
175
|
before do
|
176
|
-
@list.options = @list.options.merge(
|
176
|
+
@list.options = @list.options.merge("csv" => true)
|
177
177
|
end
|
178
178
|
it "should output in CSV format" do
|
179
179
|
@list.members("presidents")
|
@@ -186,7 +186,7 @@ ID,Since,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
|
|
186
186
|
end
|
187
187
|
context "--favorites" do
|
188
188
|
before do
|
189
|
-
@list.options = @list.options.merge(
|
189
|
+
@list.options = @list.options.merge("favorites" => true)
|
190
190
|
end
|
191
191
|
it "should sort by number of favorites" do
|
192
192
|
@list.members("presidents")
|
@@ -195,7 +195,7 @@ ID,Since,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
|
|
195
195
|
end
|
196
196
|
context "--followers" do
|
197
197
|
before do
|
198
|
-
@list.options = @list.options.merge(
|
198
|
+
@list.options = @list.options.merge("followers" => true)
|
199
199
|
end
|
200
200
|
it "should sort by number of followers" do
|
201
201
|
@list.members("presidents")
|
@@ -204,7 +204,7 @@ ID,Since,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
|
|
204
204
|
end
|
205
205
|
context "--friends" do
|
206
206
|
before do
|
207
|
-
@list.options = @list.options.merge(
|
207
|
+
@list.options = @list.options.merge("friends" => true)
|
208
208
|
end
|
209
209
|
it "should sort by number of friends" do
|
210
210
|
@list.members("presidents")
|
@@ -213,7 +213,7 @@ ID,Since,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
|
|
213
213
|
end
|
214
214
|
context "--listed" do
|
215
215
|
before do
|
216
|
-
@list.options = @list.options.merge(
|
216
|
+
@list.options = @list.options.merge("listed" => true)
|
217
217
|
end
|
218
218
|
it "should sort by number of list memberships" do
|
219
219
|
@list.members("presidents")
|
@@ -222,7 +222,7 @@ ID,Since,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
|
|
222
222
|
end
|
223
223
|
context "--long" do
|
224
224
|
before do
|
225
|
-
@list.options = @list.options.merge(
|
225
|
+
@list.options = @list.options.merge("long" => true)
|
226
226
|
end
|
227
227
|
it "should output in long format" do
|
228
228
|
@list.members("presidents")
|
@@ -235,7 +235,7 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
235
235
|
end
|
236
236
|
context "--posted" do
|
237
237
|
before do
|
238
|
-
@list.options = @list.options.merge(
|
238
|
+
@list.options = @list.options.merge("posted" => true)
|
239
239
|
end
|
240
240
|
it "should sort by the time wshen Twitter account was created" do
|
241
241
|
@list.members("presidents")
|
@@ -244,7 +244,7 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
244
244
|
end
|
245
245
|
context "--reverse" do
|
246
246
|
before do
|
247
|
-
@list.options = @list.options.merge(
|
247
|
+
@list.options = @list.options.merge("reverse" => true)
|
248
248
|
end
|
249
249
|
it "should reverse the order of the sort" do
|
250
250
|
@list.members("presidents")
|
@@ -253,7 +253,7 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
253
253
|
end
|
254
254
|
context "--tweets" do
|
255
255
|
before do
|
256
|
-
@list.options = @list.options.merge(
|
256
|
+
@list.options = @list.options.merge("tweets" => true)
|
257
257
|
end
|
258
258
|
it "should sort by number of Tweets" do
|
259
259
|
@list.members("presidents")
|
@@ -262,7 +262,7 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
262
262
|
end
|
263
263
|
context "--unsorted" do
|
264
264
|
before do
|
265
|
-
@list.options = @list.options.merge(
|
265
|
+
@list.options = @list.options.merge("unsorted" => true)
|
266
266
|
end
|
267
267
|
it "should not be sorted" do
|
268
268
|
@list.members("presidents")
|
@@ -278,7 +278,7 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
278
278
|
end
|
279
279
|
context "--id" do
|
280
280
|
before do
|
281
|
-
@list.options = @list.options.merge(
|
281
|
+
@list.options = @list.options.merge("id" => true)
|
282
282
|
stub_get("/1/lists/members.json").
|
283
283
|
with(:query => {:cursor => "-1", :include_entities => "false", :owner_id => "7505382", :skip_status => "true", :slug => "presidents"}).
|
284
284
|
to_return(:body => fixture("users_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
@@ -295,7 +295,7 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
295
295
|
|
296
296
|
describe "#remove" do
|
297
297
|
before do
|
298
|
-
@list.options = @list.options.merge(
|
298
|
+
@list.options = @list.options.merge("profile" => fixture_path + "/.trc")
|
299
299
|
stub_get("/1/account/verify_credentials.json").
|
300
300
|
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
301
301
|
end
|
@@ -319,7 +319,7 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
319
319
|
end
|
320
320
|
context "--id" do
|
321
321
|
before do
|
322
|
-
@list.options = @list.options.merge(
|
322
|
+
@list.options = @list.options.merge("id" => true)
|
323
323
|
stub_post("/1/lists/members/destroy_all.json").
|
324
324
|
with(:body => {:user_id => "7505382", :slug => "presidents", :owner_screen_name => "sferik"}).
|
325
325
|
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
@@ -350,6 +350,7 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
350
350
|
|
351
351
|
describe "#timeline" do
|
352
352
|
before do
|
353
|
+
@list.options = @list.options.merge("no-color" => true)
|
353
354
|
stub_get("/1/lists/statuses.json").
|
354
355
|
with(:query => {:owner_screen_name => "testcli", :per_page => "20", :slug => "presidents", :include_entities => "false"}).
|
355
356
|
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
@@ -384,7 +385,7 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
384
385
|
end
|
385
386
|
context "--csv" do
|
386
387
|
before do
|
387
|
-
@list.options = @list.options.merge(
|
388
|
+
@list.options = @list.options.merge("csv" => true)
|
388
389
|
end
|
389
390
|
it "should output in long format" do
|
390
391
|
@list.timeline("presidents")
|
@@ -412,7 +413,7 @@ ID,Posted at,Screen name,Text
|
|
412
413
|
end
|
413
414
|
context "--long" do
|
414
415
|
before do
|
415
|
-
@list.options = @list.options.merge(
|
416
|
+
@list.options = @list.options.merge("long" => true)
|
416
417
|
end
|
417
418
|
it "should output in long format" do
|
418
419
|
@list.timeline("presidents")
|
@@ -440,7 +441,7 @@ ID Posted at Screen name Text
|
|
440
441
|
end
|
441
442
|
context "--number" do
|
442
443
|
before do
|
443
|
-
@list.options = @list.options.merge(
|
444
|
+
@list.options = @list.options.merge("number" => 1)
|
444
445
|
stub_get("/1/lists/statuses.json").
|
445
446
|
with(:query => {:owner_screen_name => "testcli", :per_page => "1", :slug => "presidents", :include_entities => "false"}).
|
446
447
|
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
@@ -454,7 +455,7 @@ ID Posted at Screen name Text
|
|
454
455
|
end
|
455
456
|
context "--reverse" do
|
456
457
|
before do
|
457
|
-
@list.options = @list.options.merge(
|
458
|
+
@list.options = @list.options.merge("reverse" => true)
|
458
459
|
end
|
459
460
|
it "should reverse the order of the sort" do
|
460
461
|
@list.timeline("presidents")
|
@@ -488,7 +489,7 @@ ID Posted at Screen name Text
|
|
488
489
|
end
|
489
490
|
context "--id" do
|
490
491
|
before do
|
491
|
-
@list.options = @list.options.merge(
|
492
|
+
@list.options = @list.options.merge("id" => true)
|
492
493
|
stub_get("/1/lists/statuses.json").
|
493
494
|
with(:query => {:owner_id => "7505382", :per_page => "20", :slug => "presidents", :include_entities => "false"}).
|
494
495
|
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
data/spec/rcfile_spec.rb
CHANGED
@@ -51,6 +51,20 @@ describe RCFile do
|
|
51
51
|
}
|
52
52
|
rcfile['testcli'].keys.should == ['abc123']
|
53
53
|
end
|
54
|
+
it 'should not be world readable or writable' do
|
55
|
+
rcfile = RCFile.instance
|
56
|
+
rcfile.path = project_path + "/tmp/trc"
|
57
|
+
rcfile['testcli'] = {
|
58
|
+
'abc123' => {
|
59
|
+
:username => 'testcli',
|
60
|
+
:consumer_key => 'abc123',
|
61
|
+
:consumer_secret => 'def456',
|
62
|
+
:token => 'ghi789',
|
63
|
+
:secret => 'jkl012',
|
64
|
+
}
|
65
|
+
}
|
66
|
+
File.stat(rcfile.path).mode.should == 33152
|
67
|
+
end
|
54
68
|
end
|
55
69
|
|
56
70
|
describe '#configuration' do
|
@@ -61,58 +75,58 @@ describe RCFile do
|
|
61
75
|
end
|
62
76
|
end
|
63
77
|
|
64
|
-
describe '#
|
78
|
+
describe '#active_consumer_key' do
|
65
79
|
it 'should return default consumer key' do
|
66
80
|
rcfile = RCFile.instance
|
67
81
|
rcfile.path = fixture_path + "/.trc"
|
68
|
-
rcfile.
|
82
|
+
rcfile.active_consumer_key.should == 'abc123'
|
69
83
|
end
|
70
84
|
end
|
71
85
|
|
72
|
-
describe '#
|
86
|
+
describe '#active_consumer_secret' do
|
73
87
|
it 'should return default consumer secret' do
|
74
88
|
rcfile = RCFile.instance
|
75
89
|
rcfile.path = fixture_path + "/.trc"
|
76
|
-
rcfile.
|
90
|
+
rcfile.active_consumer_secret.should == 'asdfasd223sd2'
|
77
91
|
end
|
78
92
|
end
|
79
93
|
|
80
|
-
describe '#
|
94
|
+
describe '#active_profile' do
|
81
95
|
it 'should return default profile' do
|
82
96
|
rcfile = RCFile.instance
|
83
97
|
rcfile.path = fixture_path + "/.trc"
|
84
|
-
rcfile.
|
98
|
+
rcfile.active_profile.should == ['testcli', 'abc123']
|
85
99
|
end
|
86
100
|
end
|
87
101
|
|
88
|
-
describe '#
|
102
|
+
describe '#active_profile=' do
|
89
103
|
it 'should set default profile' do
|
90
104
|
rcfile = RCFile.instance
|
91
105
|
rcfile.path = project_path + "/tmp/trc"
|
92
|
-
rcfile.
|
93
|
-
rcfile.
|
106
|
+
rcfile.active_profile = {'username' => 'testcli', 'consumer_key' => 'abc123'}
|
107
|
+
rcfile.active_profile.should == ['testcli', 'abc123']
|
94
108
|
end
|
95
109
|
it 'should write the data to disk' do
|
96
110
|
rcfile = RCFile.instance
|
97
111
|
rcfile.path = project_path + "/tmp/trc"
|
98
|
-
rcfile.
|
99
|
-
rcfile.
|
112
|
+
rcfile.active_profile = {'username' => 'testcli', 'consumer_key' => 'abc123'}
|
113
|
+
rcfile.active_profile.should == ['testcli', 'abc123']
|
100
114
|
end
|
101
115
|
end
|
102
116
|
|
103
|
-
describe '#
|
117
|
+
describe '#active_token' do
|
104
118
|
it 'should return default token' do
|
105
119
|
rcfile = RCFile.instance
|
106
120
|
rcfile.path = fixture_path + "/.trc"
|
107
|
-
rcfile.
|
121
|
+
rcfile.active_token.should == '428004849-cebdct6bwobn'
|
108
122
|
end
|
109
123
|
end
|
110
124
|
|
111
|
-
describe '#
|
125
|
+
describe '#active_secret' do
|
112
126
|
it 'should return default secret' do
|
113
127
|
rcfile = RCFile.instance
|
114
128
|
rcfile.path = fixture_path + "/.trc"
|
115
|
-
rcfile.
|
129
|
+
rcfile.active_secret.should == 'epzrjvxtumoc'
|
116
130
|
end
|
117
131
|
end
|
118
132
|
|
data/spec/search_spec.rb
CHANGED
@@ -54,7 +54,7 @@ describe T::Search do
|
|
54
54
|
end
|
55
55
|
context "--csv" do
|
56
56
|
before do
|
57
|
-
@search.options = @search.options.merge(
|
57
|
+
@search.options = @search.options.merge("csv" => true)
|
58
58
|
end
|
59
59
|
it "should output in CSV format" do
|
60
60
|
@search.all("twitter")
|
@@ -84,7 +84,7 @@ ID,Posted at,Screen name,Text
|
|
84
84
|
end
|
85
85
|
context "--long" do
|
86
86
|
before do
|
87
|
-
@search.options = @search.options.merge(
|
87
|
+
@search.options = @search.options.merge("long" => true)
|
88
88
|
end
|
89
89
|
it "should output in long format" do
|
90
90
|
@search.all("twitter")
|
@@ -110,7 +110,7 @@ ID Posted at Screen name Text
|
|
110
110
|
end
|
111
111
|
context "--number" do
|
112
112
|
before do
|
113
|
-
@search.options = @search.options.merge(
|
113
|
+
@search.options = @search.options.merge("number" => 1)
|
114
114
|
stub_request(:get, "https://search.twitter.com/search.json").
|
115
115
|
with(:query => {:q => "twitter", :include_entities => "false", :rpp => "1"}).
|
116
116
|
to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
@@ -126,6 +126,7 @@ ID Posted at Screen name Text
|
|
126
126
|
|
127
127
|
describe "#favorites" do
|
128
128
|
before do
|
129
|
+
@search.options = @search.options.merge("no-color" => true)
|
129
130
|
1.upto(16).each do |page|
|
130
131
|
stub_get("/1/favorites.json").
|
131
132
|
with(:query => {:count => "200", :page => "#{page}"}).
|
@@ -163,7 +164,7 @@ ID Posted at Screen name Text
|
|
163
164
|
end
|
164
165
|
context "--csv" do
|
165
166
|
before do
|
166
|
-
@search.options = @search.options.merge(
|
167
|
+
@search.options = @search.options.merge("csv" => true)
|
167
168
|
end
|
168
169
|
it "should output in CSV format" do
|
169
170
|
@search.favorites("twitter")
|
@@ -190,7 +191,7 @@ ID,Posted at,Screen name,Text
|
|
190
191
|
end
|
191
192
|
context "--long" do
|
192
193
|
before do
|
193
|
-
@search.options = @search.options.merge(
|
194
|
+
@search.options = @search.options.merge("long" => true)
|
194
195
|
end
|
195
196
|
it "should output in long format" do
|
196
197
|
@search.favorites("twitter")
|
@@ -232,6 +233,7 @@ ID Posted at Screen name Text
|
|
232
233
|
|
233
234
|
describe "#mentions" do
|
234
235
|
before do
|
236
|
+
@search.options = @search.options.merge("no-color" => true)
|
235
237
|
1.upto(16).each do |page|
|
236
238
|
stub_get("/1/statuses/mentions.json").
|
237
239
|
with(:query => {:count => "200", :page => "#{page}"}).
|
@@ -269,7 +271,7 @@ ID Posted at Screen name Text
|
|
269
271
|
end
|
270
272
|
context "--csv" do
|
271
273
|
before do
|
272
|
-
@search.options = @search.options.merge(
|
274
|
+
@search.options = @search.options.merge("csv" => true)
|
273
275
|
end
|
274
276
|
it "should output in CSV format" do
|
275
277
|
@search.mentions("twitter")
|
@@ -296,7 +298,7 @@ ID,Posted at,Screen name,Text
|
|
296
298
|
end
|
297
299
|
context "--long" do
|
298
300
|
before do
|
299
|
-
@search.options = @search.options.merge(
|
301
|
+
@search.options = @search.options.merge("long" => true)
|
300
302
|
end
|
301
303
|
it "should output in long format" do
|
302
304
|
@search.mentions("twitter")
|
@@ -338,6 +340,7 @@ ID Posted at Screen name Text
|
|
338
340
|
|
339
341
|
describe "#retweets" do
|
340
342
|
before do
|
343
|
+
@search.options = @search.options.merge("no-color" => true)
|
341
344
|
1.upto(16).each do |page|
|
342
345
|
stub_get("/1/statuses/retweeted_by_me.json").
|
343
346
|
with(:query => {:count => "200", :page => "#{page}"}).
|
@@ -375,7 +378,7 @@ ID Posted at Screen name Text
|
|
375
378
|
end
|
376
379
|
context "--csv" do
|
377
380
|
before do
|
378
|
-
@search.options = @search.options.merge(
|
381
|
+
@search.options = @search.options.merge("csv" => true)
|
379
382
|
end
|
380
383
|
it "should output in CSV format" do
|
381
384
|
@search.retweets("twitter")
|
@@ -402,7 +405,7 @@ ID,Posted at,Screen name,Text
|
|
402
405
|
end
|
403
406
|
context "--long" do
|
404
407
|
before do
|
405
|
-
@search.options = @search.options.merge(
|
408
|
+
@search.options = @search.options.merge("long" => true)
|
406
409
|
end
|
407
410
|
it "should output in long format" do
|
408
411
|
@search.retweets("twitter")
|
@@ -444,6 +447,7 @@ ID Posted at Screen name Text
|
|
444
447
|
|
445
448
|
describe "#timeline" do
|
446
449
|
before do
|
450
|
+
@search.options = @search.options.merge("no-color" => true)
|
447
451
|
1.upto(16).each do |page|
|
448
452
|
stub_get("/1/statuses/home_timeline.json").
|
449
453
|
with(:query => {:count => "200", :page => "#{page}"}).
|
@@ -481,7 +485,7 @@ ID Posted at Screen name Text
|
|
481
485
|
end
|
482
486
|
context "--csv" do
|
483
487
|
before do
|
484
|
-
@search.options = @search.options.merge(
|
488
|
+
@search.options = @search.options.merge("csv" => true)
|
485
489
|
end
|
486
490
|
it "should output in CSV format" do
|
487
491
|
@search.timeline("twitter")
|
@@ -508,7 +512,7 @@ ID,Posted at,Screen name,Text
|
|
508
512
|
end
|
509
513
|
context "--long" do
|
510
514
|
before do
|
511
|
-
@search.options = @search.options.merge(
|
515
|
+
@search.options = @search.options.merge("long" => true)
|
512
516
|
end
|
513
517
|
it "should output in long format" do
|
514
518
|
@search.timeline("twitter")
|
@@ -550,6 +554,7 @@ ID Posted at Screen name Text
|
|
550
554
|
|
551
555
|
describe "#user" do
|
552
556
|
before do
|
557
|
+
@search.options = @search.options.merge("no-color" => true)
|
553
558
|
1.upto(16).each do |page|
|
554
559
|
stub_get("/1/statuses/user_timeline.json").
|
555
560
|
with(:query => {:screen_name => "sferik", :count => "200", :page => "#{page}"}).
|
@@ -587,7 +592,7 @@ ID Posted at Screen name Text
|
|
587
592
|
end
|
588
593
|
context "--csv" do
|
589
594
|
before do
|
590
|
-
@search.options = @search.options.merge(
|
595
|
+
@search.options = @search.options.merge("csv" => true)
|
591
596
|
end
|
592
597
|
it "should output in CSV format" do
|
593
598
|
@search.user("sferik", "twitter")
|
@@ -614,7 +619,7 @@ ID,Posted at,Screen name,Text
|
|
614
619
|
end
|
615
620
|
context "--id" do
|
616
621
|
before do
|
617
|
-
@search.options = @search.options.merge(
|
622
|
+
@search.options = @search.options.merge("id" => true)
|
618
623
|
1.upto(16).each do |page|
|
619
624
|
stub_get("/1/statuses/user_timeline.json").
|
620
625
|
with(:query => {:user_id => "7505382", :count => "200", :page => "#{page}"}).
|
@@ -632,7 +637,7 @@ ID,Posted at,Screen name,Text
|
|
632
637
|
end
|
633
638
|
context "--long" do
|
634
639
|
before do
|
635
|
-
@search.options = @search.options.merge(
|
640
|
+
@search.options = @search.options.merge("long" => true)
|
636
641
|
end
|
637
642
|
it "should output in long format" do
|
638
643
|
@search.user("sferik", "twitter")
|