t 0.6.4 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +19 -6
- data/lib/t/cli.rb +489 -191
- data/lib/t/core_ext/string.rb +4 -0
- data/lib/t/delete.rb +38 -23
- data/lib/t/list.rb +117 -46
- data/lib/t/printable.rb +56 -5
- data/lib/t/search.rb +35 -10
- data/lib/t/version.rb +2 -2
- data/spec/cli_spec.rb +1302 -163
- data/spec/delete_spec.rb +143 -125
- data/spec/fixtures/false.json +1 -0
- data/spec/fixtures/list.json +1 -1
- data/spec/fixtures/lists.json +1 -0
- data/spec/fixtures/locations.json +1 -0
- data/spec/fixtures/not_found.json +1 -0
- data/spec/fixtures/trends.json +1 -0
- data/spec/fixtures/true.json +1 -0
- data/spec/helper.rb +4 -0
- data/spec/list_spec.rb +204 -66
- data/spec/rcfile_spec.rb +7 -7
- data/spec/search_spec.rb +189 -6
- data/t.gemspec +3 -1
- metadata +48 -4
data/lib/t/version.rb
CHANGED
data/spec/cli_spec.rb
CHANGED
@@ -35,7 +35,7 @@ testcli
|
|
35
35
|
|
36
36
|
describe "#authorize" do
|
37
37
|
before do
|
38
|
-
@cli.options = @cli.options.merge(:profile =>
|
38
|
+
@cli.options = @cli.options.merge(:profile => project_path + "/tmp/trc", :consumer_key => "abc123", :consumer_secret => "asdfasd223sd2", :prompt => true, :display_url => true)
|
39
39
|
stub_post("/oauth/request_token").
|
40
40
|
to_return(:body => fixture("request_token"))
|
41
41
|
stub_post("/oauth/access_token").
|
@@ -84,6 +84,20 @@ testcli
|
|
84
84
|
@cli.block("sferik")
|
85
85
|
$stdout.string.should =~ /^@testcli blocked 1 user/
|
86
86
|
end
|
87
|
+
context "--id" do
|
88
|
+
before do
|
89
|
+
@cli.options = @cli.options.merge(:id => true)
|
90
|
+
stub_post("/1/blocks/create.json").
|
91
|
+
with(:body => {:user_id => "7505382", :include_entities => "false"}).
|
92
|
+
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
93
|
+
end
|
94
|
+
it "should request the correct resource" do
|
95
|
+
@cli.block("7505382")
|
96
|
+
a_post("/1/blocks/create.json").
|
97
|
+
with(:body => {:user_id => "7505382", :include_entities => "false"}).
|
98
|
+
should have_been_made
|
99
|
+
end
|
100
|
+
end
|
87
101
|
end
|
88
102
|
|
89
103
|
describe "#direct_messages" do
|
@@ -113,11 +127,32 @@ testcli
|
|
113
127
|
sferik: I'm trying to debug the issue you were having with the Bundler Gemfile.lock shortref. What version of Ruby and RubyGems are you running? (about 1 year ago)
|
114
128
|
eos
|
115
129
|
end
|
130
|
+
context "--csv" do
|
131
|
+
before do
|
132
|
+
@cli.options = @cli.options.merge(:csv => true)
|
133
|
+
end
|
134
|
+
it "should output in CSV format" do
|
135
|
+
@cli.direct_messages
|
136
|
+
$stdout.string.should == <<-eos
|
137
|
+
ID,Posted at,Screen name,Text
|
138
|
+
1773478249,2010-10-17 20:48:55 +0000,sferik,Sounds good. Meeting Tuesday is fine.
|
139
|
+
1762960771,2010-10-14 21:43:30 +0000,sferik,That's great news! Let's plan to chat around 8 AM tomorrow Pacific time. Does that work for you?
|
140
|
+
1711812216,2010-10-01 15:07:12 +0000,sferik,I asked Yehuda about the stipend. I believe it has already been sent. Glad you're feeling better.
|
141
|
+
1711417617,2010-10-01 13:09:27 +0000,sferik,Just checking in. How's everything going?
|
142
|
+
1653301471,2010-09-16 16:13:27 +0000,sferik,Not sure about the payment. Feel free to ask Leah or Yehuda directly. Think you'll be able to finish up your work on graphs this weekend?
|
143
|
+
1645324992,2010-09-14 18:44:10 +0000,sferik,How are the graph enhancements coming?
|
144
|
+
1632933616,2010-09-11 17:45:46 +0000,sferik,How are the graphs coming? I'm really looking forward to seeing what you do with Raphaël.
|
145
|
+
1629239903,2010-09-10 18:21:36 +0000,sferik,Awesome! Any luck duplicating the Gemfile.lock error with Ruby 1.9.2 final?
|
146
|
+
1629166212,2010-09-10 17:56:53 +0000,sferik,I just committed a bunch of cleanup and fixes to RailsAdmin that touched many of files. Make sure you pull to avoid conflicts.
|
147
|
+
1624782206,2010-09-09 18:11:48 +0000,sferik,I'm trying to debug the issue you were having with the Bundler Gemfile.lock shortref. What version of Ruby and RubyGems are you running?
|
148
|
+
eos
|
149
|
+
end
|
150
|
+
end
|
116
151
|
context "--long" do
|
117
152
|
before do
|
118
153
|
@cli.options = @cli.options.merge(:long => true)
|
119
154
|
end
|
120
|
-
it "should
|
155
|
+
it "should output in long format" do
|
121
156
|
@cli.direct_messages
|
122
157
|
$stdout.string.should == <<-eos
|
123
158
|
ID Posted at Screen name Text
|
@@ -197,11 +232,32 @@ ID Posted at Screen name Text
|
|
197
232
|
hurrycane: I'm trying to debug the issue you were having with the Bundler Gemfile.lock shortref. What version of Ruby and RubyGems are you running? (about 1 year ago)
|
198
233
|
eos
|
199
234
|
end
|
235
|
+
context "--csv" do
|
236
|
+
before do
|
237
|
+
@cli.options = @cli.options.merge(:csv => true)
|
238
|
+
end
|
239
|
+
it "should output in CSV format" do
|
240
|
+
@cli.direct_messages_sent
|
241
|
+
$stdout.string.should == <<-eos
|
242
|
+
ID,Posted at,Screen name,Text
|
243
|
+
1773478249,2010-10-17 20:48:55 +0000,hurrycane,Sounds good. Meeting Tuesday is fine.
|
244
|
+
1762960771,2010-10-14 21:43:30 +0000,hurrycane,That's great news! Let's plan to chat around 8 AM tomorrow Pacific time. Does that work for you?
|
245
|
+
1711812216,2010-10-01 15:07:12 +0000,hurrycane,I asked Yehuda about the stipend. I believe it has already been sent. Glad you're feeling better.
|
246
|
+
1711417617,2010-10-01 13:09:27 +0000,hurrycane,Just checking in. How's everything going?
|
247
|
+
1653301471,2010-09-16 16:13:27 +0000,hurrycane,Not sure about the payment. Feel free to ask Leah or Yehuda directly. Think you'll be able to finish up your work on graphs this weekend?
|
248
|
+
1645324992,2010-09-14 18:44:10 +0000,hurrycane,How are the graph enhancements coming?
|
249
|
+
1632933616,2010-09-11 17:45:46 +0000,hurrycane,How are the graphs coming? I'm really looking forward to seeing what you do with Raphaël.
|
250
|
+
1629239903,2010-09-10 18:21:36 +0000,hurrycane,Awesome! Any luck duplicating the Gemfile.lock error with Ruby 1.9.2 final?
|
251
|
+
1629166212,2010-09-10 17:56:53 +0000,hurrycane,I just committed a bunch of cleanup and fixes to RailsAdmin that touched many of files. Make sure you pull to avoid conflicts.
|
252
|
+
1624782206,2010-09-09 18:11:48 +0000,hurrycane,I'm trying to debug the issue you were having with the Bundler Gemfile.lock shortref. What version of Ruby and RubyGems are you running?
|
253
|
+
eos
|
254
|
+
end
|
255
|
+
end
|
200
256
|
context "--long" do
|
201
257
|
before do
|
202
258
|
@cli.options = @cli.options.merge(:long => true)
|
203
259
|
end
|
204
|
-
it "should
|
260
|
+
it "should output in long format" do
|
205
261
|
@cli.direct_messages_sent
|
206
262
|
$stdout.string.should == <<-eos
|
207
263
|
ID Posted at Screen name Text
|
@@ -280,15 +336,19 @@ ID Posted at Screen name Text
|
|
280
336
|
end
|
281
337
|
it "should have the correct output" do
|
282
338
|
@cli.disciples
|
283
|
-
$stdout.string.
|
339
|
+
$stdout.string.rstrip.should == "@pengwynn @sferik"
|
284
340
|
end
|
285
|
-
context "--
|
341
|
+
context "--csv" do
|
286
342
|
before do
|
287
|
-
@cli.options = @cli.options.merge(:
|
343
|
+
@cli.options = @cli.options.merge(:csv => true)
|
288
344
|
end
|
289
|
-
it "should
|
345
|
+
it "should output in CSV format" do
|
290
346
|
@cli.disciples
|
291
|
-
$stdout.string.
|
347
|
+
$stdout.string.should == <<-eos
|
348
|
+
ID,Since,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
|
349
|
+
14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
|
350
|
+
7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
|
351
|
+
eos
|
292
352
|
end
|
293
353
|
end
|
294
354
|
context "--favorites" do
|
@@ -297,7 +357,7 @@ ID Posted at Screen name Text
|
|
297
357
|
end
|
298
358
|
it "should sort by number of favorites" do
|
299
359
|
@cli.disciples
|
300
|
-
$stdout.string.
|
360
|
+
$stdout.string.rstrip.should == "@pengwynn @sferik"
|
301
361
|
end
|
302
362
|
end
|
303
363
|
context "--followers" do
|
@@ -306,7 +366,7 @@ ID Posted at Screen name Text
|
|
306
366
|
end
|
307
367
|
it "should sort by number of followers" do
|
308
368
|
@cli.disciples
|
309
|
-
$stdout.string.
|
369
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
310
370
|
end
|
311
371
|
end
|
312
372
|
context "--friends" do
|
@@ -315,7 +375,7 @@ ID Posted at Screen name Text
|
|
315
375
|
end
|
316
376
|
it "should sort by number of friends" do
|
317
377
|
@cli.disciples
|
318
|
-
$stdout.string.
|
378
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
319
379
|
end
|
320
380
|
end
|
321
381
|
context "--listed" do
|
@@ -324,14 +384,14 @@ ID Posted at Screen name Text
|
|
324
384
|
end
|
325
385
|
it "should sort by number of list memberships" do
|
326
386
|
@cli.disciples
|
327
|
-
$stdout.string.
|
387
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
328
388
|
end
|
329
389
|
end
|
330
390
|
context "--long" do
|
331
391
|
before do
|
332
392
|
@cli.options = @cli.options.merge(:long => true)
|
333
393
|
end
|
334
|
-
it "should
|
394
|
+
it "should output in long format" do
|
335
395
|
@cli.disciples
|
336
396
|
$stdout.string.should == <<-eos
|
337
397
|
ID Since Tweets Favorites Listed Following Followers Screen name Name
|
@@ -340,13 +400,22 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
340
400
|
eos
|
341
401
|
end
|
342
402
|
end
|
403
|
+
context "--posted" do
|
404
|
+
before do
|
405
|
+
@cli.options = @cli.options.merge(:posted => true)
|
406
|
+
end
|
407
|
+
it "should sort by the time when Twitter acount was created" do
|
408
|
+
@cli.disciples
|
409
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
410
|
+
end
|
411
|
+
end
|
343
412
|
context "--reverse" do
|
344
413
|
before do
|
345
414
|
@cli.options = @cli.options.merge(:reverse => true)
|
346
415
|
end
|
347
416
|
it "should reverse the order of the sort" do
|
348
417
|
@cli.disciples
|
349
|
-
$stdout.string.
|
418
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
350
419
|
end
|
351
420
|
end
|
352
421
|
context "--tweets" do
|
@@ -355,7 +424,61 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
355
424
|
end
|
356
425
|
it "should sort by number of Tweets" do
|
357
426
|
@cli.disciples
|
358
|
-
$stdout.string.
|
427
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
428
|
+
end
|
429
|
+
end
|
430
|
+
context "--unsorted" do
|
431
|
+
before do
|
432
|
+
@cli.options = @cli.options.merge(:unsorted => true)
|
433
|
+
end
|
434
|
+
it "should not be sorted" do
|
435
|
+
@cli.disciples
|
436
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
437
|
+
end
|
438
|
+
end
|
439
|
+
context "with a user passed" do
|
440
|
+
before do
|
441
|
+
stub_get("/1/followers/ids.json").
|
442
|
+
with(:query => {:cursor => "-1", :screen_name => "sferik"}).
|
443
|
+
to_return(:body => fixture("followers_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
444
|
+
stub_get("/1/friends/ids.json").
|
445
|
+
with(:query => {:cursor => "-1", :screen_name => "sferik"}).
|
446
|
+
to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
447
|
+
end
|
448
|
+
it "should request the correct resource" do
|
449
|
+
@cli.disciples("sferik")
|
450
|
+
a_get("/1/followers/ids.json").
|
451
|
+
with(:query => {:cursor => "-1", :screen_name => "sferik"}).
|
452
|
+
should have_been_made
|
453
|
+
a_get("/1/friends/ids.json").
|
454
|
+
with(:query => {:cursor => "-1", :screen_name => "sferik"}).
|
455
|
+
should have_been_made
|
456
|
+
a_get("/1/users/lookup.json").
|
457
|
+
with(:query => {:user_id => "213747670,428004849", :include_entities => "false"}).
|
458
|
+
should have_been_made
|
459
|
+
end
|
460
|
+
context "--id" do
|
461
|
+
before do
|
462
|
+
@cli.options = @cli.options.merge(:id => true)
|
463
|
+
stub_get("/1/followers/ids.json").
|
464
|
+
with(:query => {:cursor => "-1", :user_id => "7505382"}).
|
465
|
+
to_return(:body => fixture("followers_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
466
|
+
stub_get("/1/friends/ids.json").
|
467
|
+
with(:query => {:cursor => "-1", :user_id => "7505382"}).
|
468
|
+
to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
469
|
+
end
|
470
|
+
it "should request the correct resource" do
|
471
|
+
@cli.disciples("7505382")
|
472
|
+
a_get("/1/followers/ids.json").
|
473
|
+
with(:query => {:cursor => "-1", :user_id => "7505382"}).
|
474
|
+
should have_been_made
|
475
|
+
a_get("/1/friends/ids.json").
|
476
|
+
with(:query => {:cursor => "-1", :user_id => "7505382"}).
|
477
|
+
should have_been_made
|
478
|
+
a_get("/1/users/lookup.json").
|
479
|
+
with(:query => {:user_id => "213747670,428004849", :include_entities => "false"}).
|
480
|
+
should have_been_made
|
481
|
+
end
|
359
482
|
end
|
360
483
|
end
|
361
484
|
end
|
@@ -377,6 +500,192 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
377
500
|
@cli.dm("pengwynn", "Creating a fixture for the Twitter gem")
|
378
501
|
$stdout.string.chomp.should == "Direct Message sent from @testcli to @pengwynn (about 1 year ago)."
|
379
502
|
end
|
503
|
+
context "--id" do
|
504
|
+
before do
|
505
|
+
@cli.options = @cli.options.merge(:id => true)
|
506
|
+
stub_post("/1/direct_messages/new.json").
|
507
|
+
with(:body => {:user_id => "14100886", :text => "Creating a fixture for the Twitter gem", :include_entities => "false"}).
|
508
|
+
to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
509
|
+
end
|
510
|
+
it "should request the correct resource" do
|
511
|
+
@cli.dm("14100886", "Creating a fixture for the Twitter gem")
|
512
|
+
a_post("/1/direct_messages/new.json").
|
513
|
+
with(:body => {:user_id => "14100886", :text => "Creating a fixture for the Twitter gem", :include_entities => "false"}).
|
514
|
+
should have_been_made
|
515
|
+
end
|
516
|
+
end
|
517
|
+
end
|
518
|
+
|
519
|
+
describe "#does_contain" do
|
520
|
+
before do
|
521
|
+
@cli.options = @cli.options.merge(:profile => fixture_path + "/.trc")
|
522
|
+
stub_get("/1/lists/members/show.json").
|
523
|
+
with(:query => {:owner_screen_name => "testcli", :screen_name => "testcli", :slug => "presidents"}).
|
524
|
+
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
525
|
+
end
|
526
|
+
it "should request the correct resource" do
|
527
|
+
@cli.does_contain("presidents")
|
528
|
+
a_get("/1/lists/members/show.json").
|
529
|
+
with(:query => {:owner_screen_name => "testcli", :screen_name => "testcli", :slug => "presidents"}).
|
530
|
+
should have_been_made
|
531
|
+
end
|
532
|
+
it "should have the correct output" do
|
533
|
+
@cli.does_contain("presidents")
|
534
|
+
$stdout.string.chomp.should == "Yes, @testcli/presidents contains @testcli."
|
535
|
+
end
|
536
|
+
context "--id" do
|
537
|
+
before do
|
538
|
+
@cli.options = @cli.options.merge(:id => true)
|
539
|
+
stub_get("/1/users/show.json").
|
540
|
+
with(:query => {:user_id => "7505382", :include_entities => "false"}).
|
541
|
+
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
542
|
+
stub_get("/1/lists/members/show.json").
|
543
|
+
with(:query => {:owner_screen_name => "testcli", :screen_name => "sferik", :slug => "presidents"}).
|
544
|
+
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
545
|
+
end
|
546
|
+
it "should request the correct resource" do
|
547
|
+
@cli.does_contain("presidents", "7505382")
|
548
|
+
a_get("/1/users/show.json").
|
549
|
+
with(:query => {:user_id => "7505382", :include_entities => "false"}).
|
550
|
+
should have_been_made
|
551
|
+
a_get("/1/lists/members/show.json").
|
552
|
+
with(:query => {:owner_screen_name => "testcli", :screen_name => "sferik", :slug => "presidents"}).
|
553
|
+
should have_been_made
|
554
|
+
end
|
555
|
+
end
|
556
|
+
context "with an owner passed" do
|
557
|
+
it "should have the correct output" do
|
558
|
+
@cli.does_contain("testcli/presidents", "testcli")
|
559
|
+
$stdout.string.chomp.should == "Yes, @testcli/presidents contains @testcli."
|
560
|
+
end
|
561
|
+
context "--id" do
|
562
|
+
before do
|
563
|
+
@cli.options = @cli.options.merge(:id => true)
|
564
|
+
stub_get("/1/users/show.json").
|
565
|
+
with(:query => {:user_id => "7505382", :include_entities => "false"}).
|
566
|
+
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
567
|
+
stub_get("/1/lists/members/show.json").
|
568
|
+
with(:query => {:owner_screen_name => "sferik", :screen_name => "sferik", :slug => "presidents"}).
|
569
|
+
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
570
|
+
end
|
571
|
+
it "should request the correct resource" do
|
572
|
+
@cli.does_contain("7505382/presidents", "7505382")
|
573
|
+
a_get("/1/users/show.json").
|
574
|
+
with(:query => {:user_id => "7505382", :include_entities => "false"}).
|
575
|
+
should have_been_made.times(2)
|
576
|
+
a_get("/1/lists/members/show.json").
|
577
|
+
with(:query => {:owner_screen_name => "sferik", :screen_name => "sferik", :slug => "presidents"}).
|
578
|
+
should have_been_made
|
579
|
+
end
|
580
|
+
end
|
581
|
+
end
|
582
|
+
context "with a user passed" do
|
583
|
+
it "should have the correct output" do
|
584
|
+
@cli.does_contain("presidents", "testcli")
|
585
|
+
$stdout.string.chomp.should == "Yes, @testcli/presidents contains @testcli."
|
586
|
+
end
|
587
|
+
end
|
588
|
+
context "false" do
|
589
|
+
before do
|
590
|
+
stub_get("/1/lists/members/show.json").
|
591
|
+
with(:query => {:owner_screen_name => "testcli", :screen_name => "testcli", :slug => "presidents"}).
|
592
|
+
to_return(:body => fixture("not_found.json"), :status => 404, :headers => {:content_type => "application/json; charset=utf-8"})
|
593
|
+
end
|
594
|
+
it "should exit" do
|
595
|
+
lambda do
|
596
|
+
@cli.does_contain("presidents")
|
597
|
+
end.should raise_error(SystemExit)
|
598
|
+
a_get("/1/lists/members/show.json").
|
599
|
+
with(:query => {:owner_screen_name => "testcli", :screen_name => "testcli", :slug => "presidents"}).
|
600
|
+
should have_been_made
|
601
|
+
end
|
602
|
+
end
|
603
|
+
end
|
604
|
+
|
605
|
+
describe "#does_follow" do
|
606
|
+
before do
|
607
|
+
@cli.options = @cli.options.merge(:profile => fixture_path + "/.trc")
|
608
|
+
stub_get("/1/friendships/exists.json").
|
609
|
+
with(:query => {:user_a => "ev", :user_b => "testcli"}).
|
610
|
+
to_return(:body => fixture("true.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
611
|
+
end
|
612
|
+
it "should request the correct resource" do
|
613
|
+
@cli.does_follow("ev")
|
614
|
+
a_get("/1/friendships/exists.json").
|
615
|
+
with(:query => {:user_a => "ev", :user_b => "testcli"}).
|
616
|
+
should have_been_made
|
617
|
+
end
|
618
|
+
it "should have the correct output" do
|
619
|
+
@cli.does_follow("ev")
|
620
|
+
$stdout.string.chomp.should == "Yes, @ev follows @testcli."
|
621
|
+
end
|
622
|
+
context "--id" do
|
623
|
+
before do
|
624
|
+
@cli.options = @cli.options.merge(:id => true)
|
625
|
+
stub_get("/1/users/show.json").
|
626
|
+
with(:query => {:user_id => "20", :include_entities => "false"}).
|
627
|
+
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
628
|
+
stub_get("/1/friendships/exists.json").
|
629
|
+
with(:query => {:user_a => "sferik", :user_b => "testcli"}).
|
630
|
+
to_return(:body => fixture("true.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
631
|
+
end
|
632
|
+
it "should request the correct resource" do
|
633
|
+
@cli.does_follow("20")
|
634
|
+
a_get("/1/users/show.json").
|
635
|
+
with(:query => {:user_id => "20", :include_entities => "false"}).
|
636
|
+
should have_been_made
|
637
|
+
a_get("/1/friendships/exists.json").
|
638
|
+
with(:query => {:user_a => "sferik", :user_b => "testcli"}).
|
639
|
+
should have_been_made
|
640
|
+
end
|
641
|
+
end
|
642
|
+
context "with a user passed" do
|
643
|
+
it "should have the correct output" do
|
644
|
+
@cli.does_follow("ev", "testcli")
|
645
|
+
$stdout.string.chomp.should == "Yes, @ev follows @testcli."
|
646
|
+
end
|
647
|
+
context "--id" do
|
648
|
+
before do
|
649
|
+
@cli.options = @cli.options.merge(:id => true)
|
650
|
+
stub_get("/1/users/show.json").
|
651
|
+
with(:query => {:user_id => "20", :include_entities => "false"}).
|
652
|
+
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
653
|
+
stub_get("/1/users/show.json").
|
654
|
+
with(:query => {:user_id => "428004849", :include_entities => "false"}).
|
655
|
+
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
656
|
+
stub_get("/1/friendships/exists.json").
|
657
|
+
with(:query => {:user_a => "sferik", :user_b => "sferik"}).
|
658
|
+
to_return(:body => fixture("true.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
659
|
+
end
|
660
|
+
it "should request the correct resource" do
|
661
|
+
@cli.does_follow("20", "428004849")
|
662
|
+
a_get("/1/users/show.json").
|
663
|
+
with(:query => {:user_id => "20", :include_entities => "false"}).
|
664
|
+
should have_been_made
|
665
|
+
a_get("/1/users/show.json").
|
666
|
+
with(:query => {:user_id => "428004849", :include_entities => "false"}).
|
667
|
+
should have_been_made
|
668
|
+
a_get("/1/friendships/exists.json").
|
669
|
+
with(:query => {:user_a => "sferik", :user_b => "sferik"}).
|
670
|
+
should have_been_made
|
671
|
+
end
|
672
|
+
end
|
673
|
+
end
|
674
|
+
context "false" do
|
675
|
+
before do
|
676
|
+
stub_get("/1/friendships/exists.json").
|
677
|
+
with(:query => {:user_a => "ev", :user_b => "testcli"}).
|
678
|
+
to_return(:body => fixture("false.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
679
|
+
end
|
680
|
+
it "should exit" do
|
681
|
+
lambda do
|
682
|
+
@cli.does_follow("ev")
|
683
|
+
end.should raise_error(SystemExit)
|
684
|
+
a_get("/1/friendships/exists.json").
|
685
|
+
with(:query => {:user_a => "ev", :user_b => "testcli"}).
|
686
|
+
should have_been_made
|
687
|
+
end
|
688
|
+
end
|
380
689
|
end
|
381
690
|
|
382
691
|
describe "#favorite" do
|
@@ -430,11 +739,39 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
430
739
|
kelseysilver: San Francisco here I come! (@ Newark Liberty International Airport (EWR) w/ 92 others) http://t.co/eoLANJZw (7 months ago)
|
431
740
|
eos
|
432
741
|
end
|
742
|
+
context "--csv" do
|
743
|
+
before do
|
744
|
+
@cli.options = @cli.options.merge(:csv => true)
|
745
|
+
end
|
746
|
+
it "should output in CSV format" do
|
747
|
+
@cli.favorites
|
748
|
+
$stdout.string.should == <<-eos
|
749
|
+
ID,Posted at,Screen name,Text
|
750
|
+
194548121416630272,2011-04-23 22:07:41 +0000,natevillegas,RT @gelobautista #riordan RT @WilI_Smith: Yesterday is history. Tomorrow is a mystery. Today is a gift. That's why it's called the present.
|
751
|
+
194547993607806976,2011-04-23 22:07:10 +0000,TD,@kelseysilver how long will you be in town?
|
752
|
+
194547987593183233,2011-04-23 22:07:09 +0000,rusashka,@maciej hahaha :) @gpena together we're going to cover all core 28 languages!
|
753
|
+
194547824690597888,2011-04-23 22:06:30 +0000,fat,@stevej @xc i'm going to picket when i get back.
|
754
|
+
194547658562605057,2011-04-23 22:05:51 +0000,wil,@0x9900 @paulnivin http://t.co/bwVdtAPe
|
755
|
+
194547528430137344,2011-04-23 22:05:19 +0000,wangtian,"@tianhonghe @xiangxin72 oh, you can even order specific items?"
|
756
|
+
194547402550689793,2011-04-23 22:04:49 +0000,shinypb,"@kpk Pfft, I think you're forgetting mechanical television, which depended on a clever German. http://t.co/JvLNQCDm @skilldrick @hoverbird"
|
757
|
+
194547260233760768,2011-04-23 22:04:16 +0000,0x9900,@wil @paulnivin if you want to take you seriously don't say daemontools!
|
758
|
+
194547084349804544,2011-04-23 22:03:34 +0000,kpk,@shinypb @skilldrick @hoverbird invented it
|
759
|
+
194546876782092291,2011-04-23 22:02:44 +0000,skilldrick,@shinypb Well played :) @hoverbird
|
760
|
+
194546811480969217,2011-04-23 22:02:29 +0000,sam,"Can someone project the date that I'll get a 27"" retina display?"
|
761
|
+
194546738810458112,2011-04-23 22:02:11 +0000,shinypb,"@skilldrick @hoverbird Wow, I didn't even know they *had* TV in Britain."
|
762
|
+
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
763
|
+
194546649203347456,2011-04-23 22:01:50 +0000,skilldrick,"@hoverbird @shinypb You guys must be soooo old, I don't remember the words to the duck tales intro at all."
|
764
|
+
194546583608639488,2011-04-23 22:01:34 +0000,sean,@mep Thanks for coming by. Was great to have you.
|
765
|
+
194546388707717120,2011-04-23 22:00:48 +0000,hoverbird,"@shinypb @trammell it's all suck a ""duck blur"" sometimes."
|
766
|
+
194546264212385793,2011-04-23 22:00:18 +0000,kelseysilver,San Francisco here I come! (@ Newark Liberty International Airport (EWR) w/ 92 others) http://t.co/eoLANJZw
|
767
|
+
eos
|
768
|
+
end
|
769
|
+
end
|
433
770
|
context "--long" do
|
434
771
|
before do
|
435
772
|
@cli.options = @cli.options.merge(:long => true)
|
436
773
|
end
|
437
|
-
it "should
|
774
|
+
it "should output in long format" do
|
438
775
|
@cli.favorites
|
439
776
|
$stdout.string.should == <<-eos
|
440
777
|
ID Posted at Screen name Text
|
@@ -499,19 +836,39 @@ ID Posted at Screen name Text
|
|
499
836
|
eos
|
500
837
|
end
|
501
838
|
end
|
839
|
+
context "with a user passed" do
|
840
|
+
before do
|
841
|
+
stub_get("/1/favorites/sferik.json").
|
842
|
+
with(:query => {:count => "20", :include_entities => "false"}).
|
843
|
+
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
844
|
+
end
|
845
|
+
it "should request the correct resource" do
|
846
|
+
@cli.favorites("sferik")
|
847
|
+
a_get("/1/favorites/sferik.json").
|
848
|
+
with(:query => {:count => "20", :include_entities => "false"}).
|
849
|
+
should have_been_made
|
850
|
+
end
|
851
|
+
context "--id" do
|
852
|
+
before do
|
853
|
+
@cli.options = @cli.options.merge(:id => true)
|
854
|
+
stub_get("/1/favorites/7505382.json").
|
855
|
+
with(:query => {:count => "20", :include_entities => "false"}).
|
856
|
+
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
857
|
+
end
|
858
|
+
it "should request the correct resource" do
|
859
|
+
@cli.favorites("7505382")
|
860
|
+
a_get("/1/favorites/7505382.json").
|
861
|
+
with(:query => {:count => "20", :include_entities => "false"}).
|
862
|
+
should have_been_made
|
863
|
+
end
|
864
|
+
end
|
865
|
+
end
|
502
866
|
end
|
503
867
|
|
504
868
|
describe "#follow" do
|
505
869
|
before do
|
506
870
|
@cli.options = @cli.options.merge(:profile => fixture_path + "/.trc")
|
507
871
|
end
|
508
|
-
context "no users" do
|
509
|
-
it "should exit" do
|
510
|
-
lambda do
|
511
|
-
@cli.follow
|
512
|
-
end.should raise_error
|
513
|
-
end
|
514
|
-
end
|
515
872
|
context "one user" do
|
516
873
|
it "should request the correct resource" do
|
517
874
|
stub_post("/1/friendships/create.json").
|
@@ -529,6 +886,20 @@ ID Posted at Screen name Text
|
|
529
886
|
@cli.follow("sferik")
|
530
887
|
$stdout.string.should =~ /^@testcli is now following 1 more user\.$/
|
531
888
|
end
|
889
|
+
context "--id" do
|
890
|
+
before do
|
891
|
+
@cli.options = @cli.options.merge(:id => true)
|
892
|
+
stub_post("/1/friendships/create.json").
|
893
|
+
with(:body => {:user_id => "7505382", :include_entities => "false"}).
|
894
|
+
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
895
|
+
end
|
896
|
+
it "should request the correct resource" do
|
897
|
+
@cli.follow("7505382")
|
898
|
+
a_post("/1/friendships/create.json").
|
899
|
+
with(:body => {:user_id => "7505382", :include_entities => "false"}).
|
900
|
+
should have_been_made
|
901
|
+
end
|
902
|
+
end
|
532
903
|
context "Twitter is down" do
|
533
904
|
it "should retry 3 times and then raise an error" do
|
534
905
|
stub_post("/1/friendships/create.json").
|
@@ -565,15 +936,19 @@ ID Posted at Screen name Text
|
|
565
936
|
end
|
566
937
|
it "should have the correct output" do
|
567
938
|
@cli.followings
|
568
|
-
$stdout.string.
|
939
|
+
$stdout.string.rstrip.should == "@pengwynn @sferik"
|
569
940
|
end
|
570
|
-
context "--
|
941
|
+
context "--csv" do
|
571
942
|
before do
|
572
|
-
@cli.options = @cli.options.merge(:
|
943
|
+
@cli.options = @cli.options.merge(:csv => true)
|
573
944
|
end
|
574
|
-
it "should
|
945
|
+
it "should output in CSV format" do
|
575
946
|
@cli.followings
|
576
|
-
$stdout.string.
|
947
|
+
$stdout.string.should == <<-eos
|
948
|
+
ID,Since,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
|
949
|
+
14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
|
950
|
+
7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
|
951
|
+
eos
|
577
952
|
end
|
578
953
|
end
|
579
954
|
context "--favorites" do
|
@@ -582,7 +957,7 @@ ID Posted at Screen name Text
|
|
582
957
|
end
|
583
958
|
it "should sort by number of favorites" do
|
584
959
|
@cli.followings
|
585
|
-
$stdout.string.
|
960
|
+
$stdout.string.rstrip.should == "@pengwynn @sferik"
|
586
961
|
end
|
587
962
|
end
|
588
963
|
context "--followers" do
|
@@ -591,7 +966,7 @@ ID Posted at Screen name Text
|
|
591
966
|
end
|
592
967
|
it "should sort by number of followers" do
|
593
968
|
@cli.followings
|
594
|
-
$stdout.string.
|
969
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
595
970
|
end
|
596
971
|
end
|
597
972
|
context "--friends" do
|
@@ -600,7 +975,7 @@ ID Posted at Screen name Text
|
|
600
975
|
end
|
601
976
|
it "should sort by number of friends" do
|
602
977
|
@cli.followings
|
603
|
-
$stdout.string.
|
978
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
604
979
|
end
|
605
980
|
end
|
606
981
|
context "--listed" do
|
@@ -609,14 +984,14 @@ ID Posted at Screen name Text
|
|
609
984
|
end
|
610
985
|
it "should sort by number of list memberships" do
|
611
986
|
@cli.followings
|
612
|
-
$stdout.string.
|
987
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
613
988
|
end
|
614
989
|
end
|
615
990
|
context "--long" do
|
616
991
|
before do
|
617
992
|
@cli.options = @cli.options.merge(:long => true)
|
618
993
|
end
|
619
|
-
it "should
|
994
|
+
it "should output in long format" do
|
620
995
|
@cli.followings
|
621
996
|
$stdout.string.should == <<-eos
|
622
997
|
ID Since Tweets Favorites Listed Following Followers Screen name Name
|
@@ -625,13 +1000,22 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
625
1000
|
eos
|
626
1001
|
end
|
627
1002
|
end
|
1003
|
+
context "--posted" do
|
1004
|
+
before do
|
1005
|
+
@cli.options = @cli.options.merge(:posted => true)
|
1006
|
+
end
|
1007
|
+
it "should sort by the time when Twitter acount was created" do
|
1008
|
+
@cli.followings
|
1009
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
1010
|
+
end
|
1011
|
+
end
|
628
1012
|
context "--reverse" do
|
629
1013
|
before do
|
630
1014
|
@cli.options = @cli.options.merge(:reverse => true)
|
631
1015
|
end
|
632
1016
|
it "should reverse the order of the sort" do
|
633
1017
|
@cli.followings
|
634
|
-
$stdout.string.
|
1018
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
635
1019
|
end
|
636
1020
|
end
|
637
1021
|
context "--tweets" do
|
@@ -640,7 +1024,49 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
640
1024
|
end
|
641
1025
|
it "should sort by number of Tweets" do
|
642
1026
|
@cli.followings
|
643
|
-
$stdout.string.
|
1027
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
1028
|
+
end
|
1029
|
+
end
|
1030
|
+
context "--unsorted" do
|
1031
|
+
before do
|
1032
|
+
@cli.options = @cli.options.merge(:unsorted => true)
|
1033
|
+
end
|
1034
|
+
it "should not be sorted" do
|
1035
|
+
@cli.followings
|
1036
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
1037
|
+
end
|
1038
|
+
end
|
1039
|
+
context "with a user passed" do
|
1040
|
+
before do
|
1041
|
+
stub_get("/1/friends/ids.json").
|
1042
|
+
with(:query => {:cursor => "-1", :screen_name => "sferik"}).
|
1043
|
+
to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1044
|
+
end
|
1045
|
+
it "should request the correct resource" do
|
1046
|
+
@cli.followings("sferik")
|
1047
|
+
a_get("/1/friends/ids.json").
|
1048
|
+
with(:query => {:cursor => "-1", :screen_name => "sferik"}).
|
1049
|
+
should have_been_made
|
1050
|
+
a_get("/1/users/lookup.json").
|
1051
|
+
with(:query => {:user_id => "7505382", :include_entities => "false"}).
|
1052
|
+
should have_been_made
|
1053
|
+
end
|
1054
|
+
end
|
1055
|
+
context "--id" do
|
1056
|
+
before do
|
1057
|
+
@cli.options = @cli.options.merge(:id => true)
|
1058
|
+
stub_get("/1/friends/ids.json").
|
1059
|
+
with(:query => {:cursor => "-1", :user_id => "7505382"}).
|
1060
|
+
to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1061
|
+
end
|
1062
|
+
it "should request the correct resource" do
|
1063
|
+
@cli.followings("7505382")
|
1064
|
+
a_get("/1/friends/ids.json").
|
1065
|
+
with(:query => {:cursor => "-1", :user_id => "7505382"}).
|
1066
|
+
should have_been_made
|
1067
|
+
a_get("/1/users/lookup.json").
|
1068
|
+
with(:query => {:user_id => "7505382", :include_entities => "false"}).
|
1069
|
+
should have_been_made
|
644
1070
|
end
|
645
1071
|
end
|
646
1072
|
end
|
@@ -665,15 +1091,19 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
665
1091
|
end
|
666
1092
|
it "should have the correct output" do
|
667
1093
|
@cli.followers
|
668
|
-
$stdout.string.
|
1094
|
+
$stdout.string.rstrip.should == "@pengwynn @sferik"
|
669
1095
|
end
|
670
|
-
context "--
|
1096
|
+
context "--csv" do
|
671
1097
|
before do
|
672
|
-
@cli.options = @cli.options.merge(:
|
1098
|
+
@cli.options = @cli.options.merge(:csv => true)
|
673
1099
|
end
|
674
|
-
it "should
|
1100
|
+
it "should output in CSV format" do
|
675
1101
|
@cli.followers
|
676
|
-
$stdout.string.
|
1102
|
+
$stdout.string.should == <<-eos
|
1103
|
+
ID,Since,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
|
1104
|
+
14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
|
1105
|
+
7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
|
1106
|
+
eos
|
677
1107
|
end
|
678
1108
|
end
|
679
1109
|
context "--favorites" do
|
@@ -682,7 +1112,7 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
682
1112
|
end
|
683
1113
|
it "should sort by number of favorites" do
|
684
1114
|
@cli.followers
|
685
|
-
$stdout.string.
|
1115
|
+
$stdout.string.rstrip.should == "@pengwynn @sferik"
|
686
1116
|
end
|
687
1117
|
end
|
688
1118
|
context "--followers" do
|
@@ -691,7 +1121,7 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
691
1121
|
end
|
692
1122
|
it "should sort by number of followers" do
|
693
1123
|
@cli.followers
|
694
|
-
$stdout.string.
|
1124
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
695
1125
|
end
|
696
1126
|
end
|
697
1127
|
context "--friends" do
|
@@ -700,7 +1130,7 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
700
1130
|
end
|
701
1131
|
it "should sort by number of friends" do
|
702
1132
|
@cli.followers
|
703
|
-
$stdout.string.
|
1133
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
704
1134
|
end
|
705
1135
|
end
|
706
1136
|
context "--listed" do
|
@@ -709,14 +1139,14 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
709
1139
|
end
|
710
1140
|
it "should sort by number of list memberships" do
|
711
1141
|
@cli.followers
|
712
|
-
$stdout.string.
|
1142
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
713
1143
|
end
|
714
1144
|
end
|
715
1145
|
context "--long" do
|
716
1146
|
before do
|
717
1147
|
@cli.options = @cli.options.merge(:long => true)
|
718
1148
|
end
|
719
|
-
it "should
|
1149
|
+
it "should output in long format" do
|
720
1150
|
@cli.followers
|
721
1151
|
$stdout.string.should == <<-eos
|
722
1152
|
ID Since Tweets Favorites Listed Following Followers Screen name Name
|
@@ -725,13 +1155,22 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
725
1155
|
eos
|
726
1156
|
end
|
727
1157
|
end
|
1158
|
+
context "--posted" do
|
1159
|
+
before do
|
1160
|
+
@cli.options = @cli.options.merge(:posted => true)
|
1161
|
+
end
|
1162
|
+
it "should sort by the time when Twitter acount was created" do
|
1163
|
+
@cli.followers
|
1164
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
1165
|
+
end
|
1166
|
+
end
|
728
1167
|
context "--reverse" do
|
729
1168
|
before do
|
730
1169
|
@cli.options = @cli.options.merge(:reverse => true)
|
731
1170
|
end
|
732
1171
|
it "should reverse the order of the sort" do
|
733
1172
|
@cli.followers
|
734
|
-
$stdout.string.
|
1173
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
735
1174
|
end
|
736
1175
|
end
|
737
1176
|
context "--tweets" do
|
@@ -740,7 +1179,52 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
740
1179
|
end
|
741
1180
|
it "should sort by number of Tweets" do
|
742
1181
|
@cli.followers
|
743
|
-
$stdout.string.
|
1182
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
1183
|
+
end
|
1184
|
+
end
|
1185
|
+
context "--unsorted" do
|
1186
|
+
before do
|
1187
|
+
@cli.options = @cli.options.merge(:unsorted => true)
|
1188
|
+
end
|
1189
|
+
it "should not be sorted" do
|
1190
|
+
@cli.followers
|
1191
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
1192
|
+
end
|
1193
|
+
end
|
1194
|
+
context "with a user passed" do
|
1195
|
+
before do
|
1196
|
+
stub_get("/1/followers/ids.json").
|
1197
|
+
with(:query => {:cursor => "-1", :screen_name => "sferik"}).
|
1198
|
+
to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1199
|
+
stub_get("/1/users/lookup.json").
|
1200
|
+
with(:query => {:user_id => "213747670,428004849", :include_entities => "false"}).
|
1201
|
+
to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1202
|
+
end
|
1203
|
+
it "should request the correct resource" do
|
1204
|
+
@cli.followers("sferik")
|
1205
|
+
a_get("/1/followers/ids.json").
|
1206
|
+
with(:query => {:cursor => "-1", :screen_name => "sferik"}).
|
1207
|
+
should have_been_made
|
1208
|
+
a_get("/1/users/lookup.json").
|
1209
|
+
with(:query => {:user_id => "7505382", :include_entities => "false"}).
|
1210
|
+
should have_been_made
|
1211
|
+
end
|
1212
|
+
context "--id" do
|
1213
|
+
before do
|
1214
|
+
@cli.options = @cli.options.merge(:id => true)
|
1215
|
+
stub_get("/1/followers/ids.json").
|
1216
|
+
with(:query => {:cursor => "-1", :user_id => "7505382"}).
|
1217
|
+
to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1218
|
+
end
|
1219
|
+
it "should request the correct resource" do
|
1220
|
+
@cli.followers("7505382")
|
1221
|
+
a_get("/1/followers/ids.json").
|
1222
|
+
with(:query => {:cursor => "-1", :user_id => "7505382"}).
|
1223
|
+
should have_been_made
|
1224
|
+
a_get("/1/users/lookup.json").
|
1225
|
+
with(:query => {:user_id => "7505382", :include_entities => "false"}).
|
1226
|
+
should have_been_made
|
1227
|
+
end
|
744
1228
|
end
|
745
1229
|
end
|
746
1230
|
end
|
@@ -771,15 +1255,19 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
771
1255
|
end
|
772
1256
|
it "should have the correct output" do
|
773
1257
|
@cli.friends
|
774
|
-
$stdout.string.
|
1258
|
+
$stdout.string.rstrip.should == "@pengwynn @sferik"
|
775
1259
|
end
|
776
|
-
context "--
|
1260
|
+
context "--csv" do
|
777
1261
|
before do
|
778
|
-
@cli.options = @cli.options.merge(:
|
1262
|
+
@cli.options = @cli.options.merge(:csv => true)
|
779
1263
|
end
|
780
|
-
it "should
|
1264
|
+
it "should output in CSV format" do
|
781
1265
|
@cli.friends
|
782
|
-
$stdout.string.
|
1266
|
+
$stdout.string.should == <<-eos
|
1267
|
+
ID,Since,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
|
1268
|
+
14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
|
1269
|
+
7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
|
1270
|
+
eos
|
783
1271
|
end
|
784
1272
|
end
|
785
1273
|
context "--favorites" do
|
@@ -788,7 +1276,7 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
788
1276
|
end
|
789
1277
|
it "should sort by number of favorites" do
|
790
1278
|
@cli.friends
|
791
|
-
$stdout.string.
|
1279
|
+
$stdout.string.rstrip.should == "@pengwynn @sferik"
|
792
1280
|
end
|
793
1281
|
end
|
794
1282
|
context "--followers" do
|
@@ -797,7 +1285,7 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
797
1285
|
end
|
798
1286
|
it "should sort by number of followers" do
|
799
1287
|
@cli.friends
|
800
|
-
$stdout.string.
|
1288
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
801
1289
|
end
|
802
1290
|
end
|
803
1291
|
context "--friends" do
|
@@ -806,7 +1294,7 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
806
1294
|
end
|
807
1295
|
it "should sort by number of friends" do
|
808
1296
|
@cli.friends
|
809
|
-
$stdout.string.
|
1297
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
810
1298
|
end
|
811
1299
|
end
|
812
1300
|
context "--listed" do
|
@@ -815,14 +1303,14 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
815
1303
|
end
|
816
1304
|
it "should sort by number of list memberships" do
|
817
1305
|
@cli.friends
|
818
|
-
$stdout.string.
|
1306
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
819
1307
|
end
|
820
1308
|
end
|
821
1309
|
context "--long" do
|
822
1310
|
before do
|
823
1311
|
@cli.options = @cli.options.merge(:long => true)
|
824
1312
|
end
|
825
|
-
it "should
|
1313
|
+
it "should output in long format" do
|
826
1314
|
@cli.friends
|
827
1315
|
$stdout.string.should == <<-eos
|
828
1316
|
ID Since Tweets Favorites Listed Following Followers Screen name Name
|
@@ -831,13 +1319,22 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
831
1319
|
eos
|
832
1320
|
end
|
833
1321
|
end
|
1322
|
+
context "--posted" do
|
1323
|
+
before do
|
1324
|
+
@cli.options = @cli.options.merge(:posted => true)
|
1325
|
+
end
|
1326
|
+
it "should sort by the time when Twitter acount was created" do
|
1327
|
+
@cli.friends
|
1328
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
1329
|
+
end
|
1330
|
+
end
|
834
1331
|
context "--reverse" do
|
835
1332
|
before do
|
836
1333
|
@cli.options = @cli.options.merge(:reverse => true)
|
837
1334
|
end
|
838
1335
|
it "should reverse the order of the sort" do
|
839
1336
|
@cli.friends
|
840
|
-
$stdout.string.
|
1337
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
841
1338
|
end
|
842
1339
|
end
|
843
1340
|
context "--tweets" do
|
@@ -846,7 +1343,61 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
846
1343
|
end
|
847
1344
|
it "should sort by number of Tweets" do
|
848
1345
|
@cli.friends
|
849
|
-
$stdout.string.
|
1346
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
1347
|
+
end
|
1348
|
+
end
|
1349
|
+
context "--unsorted" do
|
1350
|
+
before do
|
1351
|
+
@cli.options = @cli.options.merge(:unsorted => true)
|
1352
|
+
end
|
1353
|
+
it "should not be sorted" do
|
1354
|
+
@cli.friends
|
1355
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
1356
|
+
end
|
1357
|
+
end
|
1358
|
+
context "with a user passed" do
|
1359
|
+
before do
|
1360
|
+
stub_get("/1/friends/ids.json").
|
1361
|
+
with(:query => {:cursor => "-1", :screen_name => "sferik"}).
|
1362
|
+
to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1363
|
+
stub_get("/1/followers/ids.json").
|
1364
|
+
with(:query => {:cursor => "-1", :screen_name => "sferik"}).
|
1365
|
+
to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1366
|
+
end
|
1367
|
+
it "should request the correct resource" do
|
1368
|
+
@cli.friends("sferik")
|
1369
|
+
a_get("/1/friends/ids.json").
|
1370
|
+
with(:query => {:cursor => "-1", :screen_name => "sferik"}).
|
1371
|
+
should have_been_made
|
1372
|
+
a_get("/1/followers/ids.json").
|
1373
|
+
with(:query => {:cursor => "-1", :screen_name => "sferik"}).
|
1374
|
+
should have_been_made
|
1375
|
+
a_get("/1/users/lookup.json").
|
1376
|
+
with(:query => {:user_id => "7505382", :include_entities => "false"}).
|
1377
|
+
should have_been_made
|
1378
|
+
end
|
1379
|
+
context "--id" do
|
1380
|
+
before do
|
1381
|
+
@cli.options = @cli.options.merge(:id => true)
|
1382
|
+
stub_get("/1/friends/ids.json").
|
1383
|
+
with(:query => {:cursor => "-1", :user_id => "7505382"}).
|
1384
|
+
to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1385
|
+
stub_get("/1/followers/ids.json").
|
1386
|
+
with(:query => {:cursor => "-1", :user_id => "7505382"}).
|
1387
|
+
to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1388
|
+
end
|
1389
|
+
it "should request the correct resource" do
|
1390
|
+
@cli.friends("7505382")
|
1391
|
+
a_get("/1/friends/ids.json").
|
1392
|
+
with(:query => {:cursor => "-1", :user_id => "7505382"}).
|
1393
|
+
should have_been_made
|
1394
|
+
a_get("/1/followers/ids.json").
|
1395
|
+
with(:query => {:cursor => "-1", :user_id => "7505382"}).
|
1396
|
+
should have_been_made
|
1397
|
+
a_get("/1/users/lookup.json").
|
1398
|
+
with(:query => {:user_id => "7505382", :include_entities => "false"}).
|
1399
|
+
should have_been_made
|
1400
|
+
end
|
850
1401
|
end
|
851
1402
|
end
|
852
1403
|
end
|
@@ -877,15 +1428,19 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
877
1428
|
end
|
878
1429
|
it "should have the correct output" do
|
879
1430
|
@cli.leaders
|
880
|
-
$stdout.string.
|
1431
|
+
$stdout.string.rstrip.should == "@pengwynn @sferik"
|
881
1432
|
end
|
882
|
-
context "--
|
1433
|
+
context "--csv" do
|
883
1434
|
before do
|
884
|
-
@cli.options = @cli.options.merge(:
|
1435
|
+
@cli.options = @cli.options.merge(:csv => true)
|
885
1436
|
end
|
886
|
-
it "should
|
1437
|
+
it "should output in CSV format" do
|
887
1438
|
@cli.leaders
|
888
|
-
$stdout.string.
|
1439
|
+
$stdout.string.should == <<-eos
|
1440
|
+
ID,Since,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
|
1441
|
+
14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
|
1442
|
+
7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
|
1443
|
+
eos
|
889
1444
|
end
|
890
1445
|
end
|
891
1446
|
context "--favorites" do
|
@@ -894,7 +1449,7 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
894
1449
|
end
|
895
1450
|
it "should sort by number of favorites" do
|
896
1451
|
@cli.leaders
|
897
|
-
$stdout.string.
|
1452
|
+
$stdout.string.rstrip.should == "@pengwynn @sferik"
|
898
1453
|
end
|
899
1454
|
end
|
900
1455
|
context "--followers" do
|
@@ -903,7 +1458,7 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
903
1458
|
end
|
904
1459
|
it "should sort by number of followers" do
|
905
1460
|
@cli.leaders
|
906
|
-
$stdout.string.
|
1461
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
907
1462
|
end
|
908
1463
|
end
|
909
1464
|
context "--friends" do
|
@@ -912,7 +1467,7 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
912
1467
|
end
|
913
1468
|
it "should sort by number of friends" do
|
914
1469
|
@cli.leaders
|
915
|
-
$stdout.string.
|
1470
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
916
1471
|
end
|
917
1472
|
end
|
918
1473
|
context "--listed" do
|
@@ -921,14 +1476,14 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
921
1476
|
end
|
922
1477
|
it "should sort by number of list memberships" do
|
923
1478
|
@cli.leaders
|
924
|
-
$stdout.string.
|
1479
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
925
1480
|
end
|
926
1481
|
end
|
927
1482
|
context "--long" do
|
928
1483
|
before do
|
929
1484
|
@cli.options = @cli.options.merge(:long => true)
|
930
1485
|
end
|
931
|
-
it "should
|
1486
|
+
it "should output in long format" do
|
932
1487
|
@cli.leaders
|
933
1488
|
$stdout.string.should == <<-eos
|
934
1489
|
ID Since Tweets Favorites Listed Following Followers Screen name Name
|
@@ -937,13 +1492,22 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
937
1492
|
eos
|
938
1493
|
end
|
939
1494
|
end
|
1495
|
+
context "--posted" do
|
1496
|
+
before do
|
1497
|
+
@cli.options = @cli.options.merge(:posted => true)
|
1498
|
+
end
|
1499
|
+
it "should sort by the time when Twitter acount was created" do
|
1500
|
+
@cli.leaders
|
1501
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
1502
|
+
end
|
1503
|
+
end
|
940
1504
|
context "--reverse" do
|
941
1505
|
before do
|
942
1506
|
@cli.options = @cli.options.merge(:reverse => true)
|
943
1507
|
end
|
944
1508
|
it "should reverse the order of the sort" do
|
945
1509
|
@cli.leaders
|
946
|
-
$stdout.string.
|
1510
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
947
1511
|
end
|
948
1512
|
end
|
949
1513
|
context "--tweets" do
|
@@ -952,26 +1516,205 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
952
1516
|
end
|
953
1517
|
it "should sort by number of Tweets" do
|
954
1518
|
@cli.leaders
|
955
|
-
$stdout.string.
|
1519
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
1520
|
+
end
|
1521
|
+
end
|
1522
|
+
context "--unsorted" do
|
1523
|
+
before do
|
1524
|
+
@cli.options = @cli.options.merge(:unsorted => true)
|
1525
|
+
end
|
1526
|
+
it "should not be sorted" do
|
1527
|
+
@cli.leaders
|
1528
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
1529
|
+
end
|
1530
|
+
end
|
1531
|
+
context "with a user passed" do
|
1532
|
+
before do
|
1533
|
+
stub_get("/1/friends/ids.json").
|
1534
|
+
with(:query => {:cursor => "-1", :screen_name => "sferik"}).
|
1535
|
+
to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1536
|
+
stub_get("/1/followers/ids.json").
|
1537
|
+
with(:query => {:cursor => "-1", :screen_name => "sferik"}).
|
1538
|
+
to_return(:body => fixture("followers_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1539
|
+
end
|
1540
|
+
it "should request the correct resource" do
|
1541
|
+
@cli.leaders("sferik")
|
1542
|
+
a_get("/1/friends/ids.json").
|
1543
|
+
with(:query => {:cursor => "-1", :screen_name => "sferik"}).
|
1544
|
+
should have_been_made
|
1545
|
+
a_get("/1/followers/ids.json").
|
1546
|
+
with(:query => {:cursor => "-1", :screen_name => "sferik"}).
|
1547
|
+
should have_been_made
|
1548
|
+
a_get("/1/users/lookup.json").
|
1549
|
+
with(:query => {:user_id => "7505382", :include_entities => "false"}).
|
1550
|
+
should have_been_made
|
1551
|
+
end
|
1552
|
+
context "--id" do
|
1553
|
+
before do
|
1554
|
+
@cli.options = @cli.options.merge(:id => true)
|
1555
|
+
stub_get("/1/friends/ids.json").
|
1556
|
+
with(:query => {:cursor => "-1", :user_id => "7505382"}).
|
1557
|
+
to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1558
|
+
stub_get("/1/followers/ids.json").
|
1559
|
+
with(:query => {:cursor => "-1", :user_id => "7505382"}).
|
1560
|
+
to_return(:body => fixture("followers_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1561
|
+
end
|
1562
|
+
it "should request the correct resource" do
|
1563
|
+
@cli.leaders("7505382")
|
1564
|
+
a_get("/1/friends/ids.json").
|
1565
|
+
with(:query => {:cursor => "-1", :user_id => "7505382"}).
|
1566
|
+
should have_been_made
|
1567
|
+
a_get("/1/followers/ids.json").
|
1568
|
+
with(:query => {:cursor => "-1", :user_id => "7505382"}).
|
1569
|
+
should have_been_made
|
1570
|
+
a_get("/1/users/lookup.json").
|
1571
|
+
with(:query => {:user_id => "7505382", :include_entities => "false"}).
|
1572
|
+
should have_been_made
|
1573
|
+
end
|
956
1574
|
end
|
957
1575
|
end
|
958
1576
|
end
|
959
1577
|
|
960
|
-
describe "#
|
1578
|
+
describe "#lists" do
|
961
1579
|
before do
|
962
|
-
stub_get("/1/
|
963
|
-
with(:query => {:
|
964
|
-
to_return(:body => fixture("
|
1580
|
+
stub_get("/1/lists.json").
|
1581
|
+
with(:query => {:cursor => "-1"}).
|
1582
|
+
to_return(:body => fixture("lists.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
965
1583
|
end
|
966
1584
|
it "should request the correct resource" do
|
967
|
-
@cli.
|
968
|
-
a_get("/1/
|
969
|
-
with(:query => {:
|
1585
|
+
@cli.lists
|
1586
|
+
a_get("/1/lists.json").
|
1587
|
+
with(:query => {:cursor => "-1"}).
|
970
1588
|
should have_been_made
|
971
1589
|
end
|
972
1590
|
it "should have the correct output" do
|
973
|
-
@cli.
|
974
|
-
$stdout.string.should ==
|
1591
|
+
@cli.lists
|
1592
|
+
$stdout.string.rstrip.should == "@sferik/code-for-america @sferik/presidents"
|
1593
|
+
end
|
1594
|
+
context "--csv" do
|
1595
|
+
before do
|
1596
|
+
@cli.options = @cli.options.merge(:csv => true)
|
1597
|
+
end
|
1598
|
+
it "should output in CSV format" do
|
1599
|
+
@cli.lists
|
1600
|
+
$stdout.string.should == <<-eos
|
1601
|
+
ID,Created at,Screen name,Slug,Members,Subscribers,Mode,Description
|
1602
|
+
21718825,2010-09-14 21:46:56 +0000,sferik,code-for-america,26,5,public,Code for America
|
1603
|
+
8863586,2010-03-15 12:10:13 +0000,sferik,presidents,2,1,public,Presidents of the United States of America
|
1604
|
+
eos
|
1605
|
+
end
|
1606
|
+
end
|
1607
|
+
context "--long" do
|
1608
|
+
before do
|
1609
|
+
@cli.options = @cli.options.merge(:long => true)
|
1610
|
+
end
|
1611
|
+
it "should output in long format" do
|
1612
|
+
@cli.lists
|
1613
|
+
$stdout.string.should == <<-eos
|
1614
|
+
ID Created at Slug Members Subscribers Mode Description
|
1615
|
+
21718825 Sep 14 2010 @sferik/code-for-america 26 5 public Code for America
|
1616
|
+
8863586 Mar 15 2010 @sferik/presidents 2 1 public Presidents of the United States of America
|
1617
|
+
eos
|
1618
|
+
end
|
1619
|
+
end
|
1620
|
+
context "--members" do
|
1621
|
+
before do
|
1622
|
+
@cli.options = @cli.options.merge(:members => true)
|
1623
|
+
end
|
1624
|
+
it "should sort by the time when Twitter acount was created" do
|
1625
|
+
@cli.lists
|
1626
|
+
$stdout.string.rstrip.should == "@sferik/presidents @sferik/code-for-america"
|
1627
|
+
end
|
1628
|
+
end
|
1629
|
+
context "--mode" do
|
1630
|
+
before do
|
1631
|
+
@cli.options = @cli.options.merge(:mode => true)
|
1632
|
+
end
|
1633
|
+
it "should sort by the time when Twitter acount was created" do
|
1634
|
+
@cli.lists
|
1635
|
+
$stdout.string.rstrip.should == "@sferik/code-for-america @sferik/presidents"
|
1636
|
+
end
|
1637
|
+
end
|
1638
|
+
context "--posted" do
|
1639
|
+
before do
|
1640
|
+
@cli.options = @cli.options.merge(:posted => true)
|
1641
|
+
end
|
1642
|
+
it "should sort by the time when Twitter acount was created" do
|
1643
|
+
@cli.lists
|
1644
|
+
$stdout.string.rstrip.should == "@sferik/presidents @sferik/code-for-america"
|
1645
|
+
end
|
1646
|
+
end
|
1647
|
+
context "--reverse" do
|
1648
|
+
before do
|
1649
|
+
@cli.options = @cli.options.merge(:reverse => true)
|
1650
|
+
end
|
1651
|
+
it "should reverse the order of the sort" do
|
1652
|
+
@cli.lists
|
1653
|
+
$stdout.string.rstrip.should == "@sferik/presidents @sferik/code-for-america"
|
1654
|
+
end
|
1655
|
+
end
|
1656
|
+
context "--subscribers" do
|
1657
|
+
before do
|
1658
|
+
@cli.options = @cli.options.merge(:subscribers => true)
|
1659
|
+
end
|
1660
|
+
it "should sort by the time when Twitter acount was created" do
|
1661
|
+
@cli.lists
|
1662
|
+
$stdout.string.rstrip.should == "@sferik/presidents @sferik/code-for-america"
|
1663
|
+
end
|
1664
|
+
end
|
1665
|
+
context "--unsorted" do
|
1666
|
+
before do
|
1667
|
+
@cli.options = @cli.options.merge(:unsorted => true)
|
1668
|
+
end
|
1669
|
+
it "should not be sorted" do
|
1670
|
+
@cli.lists
|
1671
|
+
$stdout.string.rstrip.should == "@sferik/code-for-america @sferik/presidents"
|
1672
|
+
end
|
1673
|
+
end
|
1674
|
+
context "with a user passed" do
|
1675
|
+
before do
|
1676
|
+
stub_get("/1/lists.json").
|
1677
|
+
with(:query => {:cursor => "-1", :screen_name => "sferik"}).
|
1678
|
+
to_return(:body => fixture("lists.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1679
|
+
end
|
1680
|
+
it "should request the correct resource" do
|
1681
|
+
@cli.lists("sferik")
|
1682
|
+
a_get("/1/lists.json").
|
1683
|
+
with(:query => {:cursor => "-1", :screen_name => "sferik"}).
|
1684
|
+
should have_been_made
|
1685
|
+
end
|
1686
|
+
context "--id" do
|
1687
|
+
before do
|
1688
|
+
@cli.options = @cli.options.merge(:id => true)
|
1689
|
+
stub_get("/1/lists.json").
|
1690
|
+
with(:query => {:cursor => "-1", :user_id => "7505382"}).
|
1691
|
+
to_return(:body => fixture("lists.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1692
|
+
end
|
1693
|
+
it "should request the correct resource" do
|
1694
|
+
@cli.lists("7505382")
|
1695
|
+
a_get("/1/lists.json").
|
1696
|
+
with(:query => {:cursor => "-1", :user_id => "7505382"}).
|
1697
|
+
should have_been_made
|
1698
|
+
end
|
1699
|
+
end
|
1700
|
+
end
|
1701
|
+
end
|
1702
|
+
|
1703
|
+
describe "#mentions" do
|
1704
|
+
before do
|
1705
|
+
stub_get("/1/statuses/mentions.json").
|
1706
|
+
with(:query => {:count => "20", :include_entities => "false"}).
|
1707
|
+
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1708
|
+
end
|
1709
|
+
it "should request the correct resource" do
|
1710
|
+
@cli.mentions
|
1711
|
+
a_get("/1/statuses/mentions.json").
|
1712
|
+
with(:query => {:count => "20", :include_entities => "false"}).
|
1713
|
+
should have_been_made
|
1714
|
+
end
|
1715
|
+
it "should have the correct output" do
|
1716
|
+
@cli.mentions
|
1717
|
+
$stdout.string.should == <<-eos
|
975
1718
|
natevillegas: RT @gelobautista #riordan RT @WilI_Smith: Yesterday is history. Tomorrow is a mystery. Today is a gift. That's why it's called the present. (7 months ago)
|
976
1719
|
TD: @kelseysilver how long will you be in town? (7 months ago)
|
977
1720
|
rusashka: @maciej hahaha :) @gpena together we're going to cover all core 28 languages! (7 months ago)
|
@@ -991,11 +1734,39 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
991
1734
|
kelseysilver: San Francisco here I come! (@ Newark Liberty International Airport (EWR) w/ 92 others) http://t.co/eoLANJZw (7 months ago)
|
992
1735
|
eos
|
993
1736
|
end
|
1737
|
+
context "--csv" do
|
1738
|
+
before do
|
1739
|
+
@cli.options = @cli.options.merge(:csv => true)
|
1740
|
+
end
|
1741
|
+
it "should output in CSV format" do
|
1742
|
+
@cli.mentions
|
1743
|
+
$stdout.string.should == <<-eos
|
1744
|
+
ID,Posted at,Screen name,Text
|
1745
|
+
194548121416630272,2011-04-23 22:07:41 +0000,natevillegas,RT @gelobautista #riordan RT @WilI_Smith: Yesterday is history. Tomorrow is a mystery. Today is a gift. That's why it's called the present.
|
1746
|
+
194547993607806976,2011-04-23 22:07:10 +0000,TD,@kelseysilver how long will you be in town?
|
1747
|
+
194547987593183233,2011-04-23 22:07:09 +0000,rusashka,@maciej hahaha :) @gpena together we're going to cover all core 28 languages!
|
1748
|
+
194547824690597888,2011-04-23 22:06:30 +0000,fat,@stevej @xc i'm going to picket when i get back.
|
1749
|
+
194547658562605057,2011-04-23 22:05:51 +0000,wil,@0x9900 @paulnivin http://t.co/bwVdtAPe
|
1750
|
+
194547528430137344,2011-04-23 22:05:19 +0000,wangtian,"@tianhonghe @xiangxin72 oh, you can even order specific items?"
|
1751
|
+
194547402550689793,2011-04-23 22:04:49 +0000,shinypb,"@kpk Pfft, I think you're forgetting mechanical television, which depended on a clever German. http://t.co/JvLNQCDm @skilldrick @hoverbird"
|
1752
|
+
194547260233760768,2011-04-23 22:04:16 +0000,0x9900,@wil @paulnivin if you want to take you seriously don't say daemontools!
|
1753
|
+
194547084349804544,2011-04-23 22:03:34 +0000,kpk,@shinypb @skilldrick @hoverbird invented it
|
1754
|
+
194546876782092291,2011-04-23 22:02:44 +0000,skilldrick,@shinypb Well played :) @hoverbird
|
1755
|
+
194546811480969217,2011-04-23 22:02:29 +0000,sam,"Can someone project the date that I'll get a 27"" retina display?"
|
1756
|
+
194546738810458112,2011-04-23 22:02:11 +0000,shinypb,"@skilldrick @hoverbird Wow, I didn't even know they *had* TV in Britain."
|
1757
|
+
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
1758
|
+
194546649203347456,2011-04-23 22:01:50 +0000,skilldrick,"@hoverbird @shinypb You guys must be soooo old, I don't remember the words to the duck tales intro at all."
|
1759
|
+
194546583608639488,2011-04-23 22:01:34 +0000,sean,@mep Thanks for coming by. Was great to have you.
|
1760
|
+
194546388707717120,2011-04-23 22:00:48 +0000,hoverbird,"@shinypb @trammell it's all suck a ""duck blur"" sometimes."
|
1761
|
+
194546264212385793,2011-04-23 22:00:18 +0000,kelseysilver,San Francisco here I come! (@ Newark Liberty International Airport (EWR) w/ 92 others) http://t.co/eoLANJZw
|
1762
|
+
eos
|
1763
|
+
end
|
1764
|
+
end
|
994
1765
|
context "--long" do
|
995
1766
|
before do
|
996
1767
|
@cli.options = @cli.options.merge(:long => true)
|
997
1768
|
end
|
998
|
-
it "should
|
1769
|
+
it "should output in long format" do
|
999
1770
|
@cli.mentions
|
1000
1771
|
$stdout.string.should == <<-eos
|
1001
1772
|
ID Posted at Screen name Text
|
@@ -1064,13 +1835,46 @@ ID Posted at Screen name Text
|
|
1064
1835
|
|
1065
1836
|
describe "#open" do
|
1066
1837
|
before do
|
1067
|
-
@cli.options = @cli.options.merge(:
|
1838
|
+
@cli.options = @cli.options.merge(:display_url => true)
|
1068
1839
|
end
|
1069
|
-
it "should
|
1840
|
+
it "should have the correct output" do
|
1070
1841
|
lambda do
|
1071
1842
|
@cli.open("sferik")
|
1072
1843
|
end.should_not raise_error
|
1073
1844
|
end
|
1845
|
+
context "--id" do
|
1846
|
+
before do
|
1847
|
+
@cli.options = @cli.options.merge(:id => true)
|
1848
|
+
stub_get("/1/users/show.json").
|
1849
|
+
with(:query => {:user_id => "420", :include_entities => "false"}).
|
1850
|
+
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1851
|
+
end
|
1852
|
+
it "should request the correct resource" do
|
1853
|
+
@cli.open("420")
|
1854
|
+
a_get("/1/users/show.json").
|
1855
|
+
with(:query => {:user_id => "420", :include_entities => "false"}).
|
1856
|
+
should have_been_made
|
1857
|
+
end
|
1858
|
+
end
|
1859
|
+
context "--status" do
|
1860
|
+
before do
|
1861
|
+
@cli.options = @cli.options.merge(:status => true)
|
1862
|
+
stub_get("/1/statuses/show/55709764298092545.json").
|
1863
|
+
with(:query => {:include_entities => "false", :include_my_retweet => "false"}).
|
1864
|
+
to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1865
|
+
end
|
1866
|
+
it "should request the correct resource" do
|
1867
|
+
@cli.open("55709764298092545")
|
1868
|
+
a_get("/1/statuses/show/55709764298092545.json").
|
1869
|
+
with(:query => {:include_entities => "false", :include_my_retweet => "false"}).
|
1870
|
+
should have_been_made
|
1871
|
+
end
|
1872
|
+
it "should have the correct output" do
|
1873
|
+
lambda do
|
1874
|
+
@cli.open("55709764298092545")
|
1875
|
+
end.should_not raise_error
|
1876
|
+
end
|
1877
|
+
end
|
1074
1878
|
end
|
1075
1879
|
|
1076
1880
|
describe "#reply" do
|
@@ -1104,6 +1908,28 @@ ID Posted at Screen name Text
|
|
1104
1908
|
@cli.reply("55709764298092545", "Testing")
|
1105
1909
|
$stdout.string.should =~ /^Reply created by @testcli to @sferik \(8 months ago\)\.$/
|
1106
1910
|
end
|
1911
|
+
context "--all" do
|
1912
|
+
before do
|
1913
|
+
@cli.options = @cli.options.merge(:all => true)
|
1914
|
+
end
|
1915
|
+
it "should request the correct resource" do
|
1916
|
+
@cli.reply("55709764298092545", "Testing")
|
1917
|
+
a_get("/1/statuses/show/55709764298092545.json").
|
1918
|
+
with(:query => {:include_entities => "false", :include_my_retweet => "false"}).
|
1919
|
+
should have_been_made
|
1920
|
+
a_post("/1/statuses/update.json").
|
1921
|
+
with(:body => {:in_reply_to_status_id => "55709764298092545", :status => "@sferik Testing", :lat => "37.76969909668", :long => "-122.39330291748", :include_entities => "false", :trim_user => "true"}).
|
1922
|
+
should have_been_made
|
1923
|
+
a_request(:get, "http://checkip.dyndns.org/").
|
1924
|
+
should have_been_made
|
1925
|
+
a_request(:get, "http://www.geoplugin.net/xml.gp?ip=50.131.22.169").
|
1926
|
+
should have_been_made
|
1927
|
+
end
|
1928
|
+
it "should have the correct output" do
|
1929
|
+
@cli.reply("55709764298092545", "Testing")
|
1930
|
+
$stdout.string.should =~ /^Reply created by @testcli to @sferik \(8 months ago\)\.$/
|
1931
|
+
end
|
1932
|
+
end
|
1107
1933
|
end
|
1108
1934
|
|
1109
1935
|
describe "#report_spam" do
|
@@ -1123,6 +1949,20 @@ ID Posted at Screen name Text
|
|
1123
1949
|
@cli.report_spam("sferik")
|
1124
1950
|
$stdout.string.should =~ /^@testcli reported 1 user/
|
1125
1951
|
end
|
1952
|
+
context "--id" do
|
1953
|
+
before do
|
1954
|
+
@cli.options = @cli.options.merge(:id => true)
|
1955
|
+
stub_post("/1/report_spam.json").
|
1956
|
+
with(:body => {:user_id => "7505382", :include_entities => "false"}).
|
1957
|
+
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1958
|
+
end
|
1959
|
+
it "should request the correct resource" do
|
1960
|
+
@cli.report_spam("7505382")
|
1961
|
+
a_post("/1/report_spam.json").
|
1962
|
+
with(:body => {:user_id => "7505382", :include_entities => "false"}).
|
1963
|
+
should have_been_made
|
1964
|
+
end
|
1965
|
+
end
|
1126
1966
|
end
|
1127
1967
|
|
1128
1968
|
describe "#retweet" do
|
@@ -1178,11 +2018,39 @@ ID Posted at Screen name Text
|
|
1178
2018
|
eos
|
1179
2019
|
end
|
1180
2020
|
end
|
2021
|
+
context "--csv" do
|
2022
|
+
before do
|
2023
|
+
@cli.options = @cli.options.merge(:csv => true)
|
2024
|
+
end
|
2025
|
+
it "should output in CSV format" do
|
2026
|
+
@cli.retweets
|
2027
|
+
$stdout.string.should == <<-eos
|
2028
|
+
ID,Posted at,Screen name,Text
|
2029
|
+
194548121416630272,2011-04-23 22:07:41 +0000,natevillegas,RT @gelobautista #riordan RT @WilI_Smith: Yesterday is history. Tomorrow is a mystery. Today is a gift. That's why it's called the present.
|
2030
|
+
194547993607806976,2011-04-23 22:07:10 +0000,TD,@kelseysilver how long will you be in town?
|
2031
|
+
194547987593183233,2011-04-23 22:07:09 +0000,rusashka,@maciej hahaha :) @gpena together we're going to cover all core 28 languages!
|
2032
|
+
194547824690597888,2011-04-23 22:06:30 +0000,fat,@stevej @xc i'm going to picket when i get back.
|
2033
|
+
194547658562605057,2011-04-23 22:05:51 +0000,wil,@0x9900 @paulnivin http://t.co/bwVdtAPe
|
2034
|
+
194547528430137344,2011-04-23 22:05:19 +0000,wangtian,"@tianhonghe @xiangxin72 oh, you can even order specific items?"
|
2035
|
+
194547402550689793,2011-04-23 22:04:49 +0000,shinypb,"@kpk Pfft, I think you're forgetting mechanical television, which depended on a clever German. http://t.co/JvLNQCDm @skilldrick @hoverbird"
|
2036
|
+
194547260233760768,2011-04-23 22:04:16 +0000,0x9900,@wil @paulnivin if you want to take you seriously don't say daemontools!
|
2037
|
+
194547084349804544,2011-04-23 22:03:34 +0000,kpk,@shinypb @skilldrick @hoverbird invented it
|
2038
|
+
194546876782092291,2011-04-23 22:02:44 +0000,skilldrick,@shinypb Well played :) @hoverbird
|
2039
|
+
194546811480969217,2011-04-23 22:02:29 +0000,sam,"Can someone project the date that I'll get a 27"" retina display?"
|
2040
|
+
194546738810458112,2011-04-23 22:02:11 +0000,shinypb,"@skilldrick @hoverbird Wow, I didn't even know they *had* TV in Britain."
|
2041
|
+
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
2042
|
+
194546649203347456,2011-04-23 22:01:50 +0000,skilldrick,"@hoverbird @shinypb You guys must be soooo old, I don't remember the words to the duck tales intro at all."
|
2043
|
+
194546583608639488,2011-04-23 22:01:34 +0000,sean,@mep Thanks for coming by. Was great to have you.
|
2044
|
+
194546388707717120,2011-04-23 22:00:48 +0000,hoverbird,"@shinypb @trammell it's all suck a ""duck blur"" sometimes."
|
2045
|
+
194546264212385793,2011-04-23 22:00:18 +0000,kelseysilver,San Francisco here I come! (@ Newark Liberty International Airport (EWR) w/ 92 others) http://t.co/eoLANJZw
|
2046
|
+
eos
|
2047
|
+
end
|
2048
|
+
end
|
1181
2049
|
context "--long" do
|
1182
2050
|
before do
|
1183
2051
|
@cli.options = @cli.options.merge(:long => true)
|
1184
2052
|
end
|
1185
|
-
it "should
|
2053
|
+
it "should output in long format" do
|
1186
2054
|
@cli.retweets
|
1187
2055
|
$stdout.string.should == <<-eos
|
1188
2056
|
ID Posted at Screen name Text
|
@@ -1247,7 +2115,7 @@ ID Posted at Screen name Text
|
|
1247
2115
|
eos
|
1248
2116
|
end
|
1249
2117
|
end
|
1250
|
-
context "with a
|
2118
|
+
context "with a user passed" do
|
1251
2119
|
before do
|
1252
2120
|
stub_get("/1/statuses/retweeted_by_user.json").
|
1253
2121
|
with(:query => {:count => "20", :include_entities => "false", :screen_name => "sferik"}).
|
@@ -1259,31 +2127,31 @@ ID Posted at Screen name Text
|
|
1259
2127
|
with(:query => {:count => "20", :include_entities => "false", :screen_name => "sferik"}).
|
1260
2128
|
should have_been_made
|
1261
2129
|
end
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
sam: Can someone project the date that I'll get a 27" retina display? (7 months ago)
|
1276
|
-
shinypb: @skilldrick @hoverbird Wow, I didn't even know they *had* TV in Britain. (7 months ago)
|
1277
|
-
bartt: @noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come. (7 months ago)
|
1278
|
-
skilldrick: @hoverbird @shinypb You guys must be soooo old, I don't remember the words to the duck tales intro at all. (7 months ago)
|
1279
|
-
sean: @mep Thanks for coming by. Was great to have you. (7 months ago)
|
1280
|
-
hoverbird: @shinypb @trammell it's all suck a "duck blur" sometimes. (7 months ago)
|
1281
|
-
kelseysilver: San Francisco here I come! (@ Newark Liberty International Airport (EWR) w/ 92 others) http://t.co/eoLANJZw (7 months ago)
|
1282
|
-
eos
|
2130
|
+
context "--id" do
|
2131
|
+
before do
|
2132
|
+
@cli.options = @cli.options.merge(:id => true)
|
2133
|
+
stub_get("/1/statuses/retweeted_by_user.json").
|
2134
|
+
with(:query => {:count => "20", :include_entities => "false", :user_id => "7505382"}).
|
2135
|
+
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2136
|
+
end
|
2137
|
+
it "should request the correct resource" do
|
2138
|
+
@cli.retweets("7505382")
|
2139
|
+
a_get("/1/statuses/retweeted_by_user.json").
|
2140
|
+
with(:query => {:count => "20", :include_entities => "false", :user_id => "7505382"}).
|
2141
|
+
should have_been_made
|
2142
|
+
end
|
1283
2143
|
end
|
1284
2144
|
end
|
1285
2145
|
end
|
1286
2146
|
|
2147
|
+
describe "#ruler" do
|
2148
|
+
it "should have the correct output" do
|
2149
|
+
@cli.ruler
|
2150
|
+
$stdout.string.chomp.size.should == 140
|
2151
|
+
$stdout.string.chomp.should == "----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|"
|
2152
|
+
end
|
2153
|
+
end
|
2154
|
+
|
1287
2155
|
describe "#status" do
|
1288
2156
|
before do
|
1289
2157
|
stub_get("/1/statuses/show/55709764298092545.json").
|
@@ -1308,31 +2176,54 @@ Source Twitter for iPhone
|
|
1308
2176
|
URL https://twitter.com/sferik/status/55709764298092545
|
1309
2177
|
eos
|
1310
2178
|
end
|
2179
|
+
context "--csv" do
|
2180
|
+
before do
|
2181
|
+
@cli.options = @cli.options.merge(:csv => true)
|
2182
|
+
end
|
2183
|
+
it "should have the correct output" do
|
2184
|
+
@cli.status("55709764298092545")
|
2185
|
+
$stdout.string.should == <<-eos
|
2186
|
+
ID,Text,Screen name,Posted at,Location,Retweets,Source,URL
|
2187
|
+
55709764298092545,The problem with your code is that it's doing exactly what you told it to do.,sferik,2011-04-06 19:13:37 +0000,,320,Twitter for iPhone,https://twitter.com/sferik/status/55709764298092545
|
2188
|
+
eos
|
2189
|
+
end
|
2190
|
+
end
|
1311
2191
|
end
|
1312
2192
|
|
1313
2193
|
describe "#suggest" do
|
1314
2194
|
before do
|
2195
|
+
stub_get("/1/account/verify_credentials.json").
|
2196
|
+
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1315
2197
|
stub_get("/1/users/recommendations.json").
|
1316
|
-
with(:query => {:limit => "20", :include_entities => "false"}).
|
2198
|
+
with(:query => {:limit => "20", :include_entities => "false", :screen_name => "sferik"}).
|
1317
2199
|
to_return(:body => fixture("recommendations.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1318
2200
|
end
|
1319
2201
|
it "should request the correct resource" do
|
1320
2202
|
@cli.suggest
|
2203
|
+
stub_get("/1/account/verify_credentials.json").
|
2204
|
+
should have_been_made
|
1321
2205
|
a_get("/1/users/recommendations.json").
|
1322
|
-
with(:query => {:limit => "20", :include_entities => "false"}).
|
2206
|
+
with(:query => {:limit => "20", :include_entities => "false", :screen_name => "sferik"}).
|
1323
2207
|
should have_been_made
|
1324
2208
|
end
|
1325
2209
|
it "should have the correct output" do
|
1326
2210
|
@cli.suggest
|
1327
|
-
$stdout.string.
|
2211
|
+
$stdout.string.rstrip.should == "@antpires @jtrupiano @maccman @mlroach @stuntmann82"
|
1328
2212
|
end
|
1329
|
-
context "--
|
2213
|
+
context "--csv" do
|
1330
2214
|
before do
|
1331
|
-
@cli.options = @cli.options.merge(:
|
2215
|
+
@cli.options = @cli.options.merge(:csv => true)
|
1332
2216
|
end
|
1333
|
-
it "should
|
2217
|
+
it "should output in CSV format" do
|
1334
2218
|
@cli.suggest
|
1335
|
-
$stdout.string.
|
2219
|
+
$stdout.string.should == <<-eos
|
2220
|
+
ID,Since,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
|
2221
|
+
40514587,2009-05-16 18:24:33 +0000,183,2,2,198,158,antpires,AntonioPires
|
2222
|
+
14736332,2008-05-11 19:46:06 +0000,3850,117,99,545,802,jtrupiano,John Trupiano
|
2223
|
+
2006261,2007-03-23 12:36:14 +0000,4497,9,171,967,2028,maccman,Alex MacCaw
|
2224
|
+
14451152,2008-04-20 12:05:38 +0000,6251,10,20,403,299,mlroach,Matt Laroche
|
2225
|
+
16052754,2008-08-30 08:22:57 +0000,24,0,1,5,42,stuntmann82,stuntmann82
|
2226
|
+
eos
|
1336
2227
|
end
|
1337
2228
|
end
|
1338
2229
|
context "--favorites" do
|
@@ -1341,7 +2232,7 @@ URL https://twitter.com/sferik/status/55709764298092545
|
|
1341
2232
|
end
|
1342
2233
|
it "should sort by number of favorites" do
|
1343
2234
|
@cli.suggest
|
1344
|
-
$stdout.string.
|
2235
|
+
$stdout.string.rstrip.should == "@stuntmann82 @antpires @maccman @mlroach @jtrupiano"
|
1345
2236
|
end
|
1346
2237
|
end
|
1347
2238
|
context "--followers" do
|
@@ -1350,7 +2241,7 @@ URL https://twitter.com/sferik/status/55709764298092545
|
|
1350
2241
|
end
|
1351
2242
|
it "should sort by number of followers" do
|
1352
2243
|
@cli.suggest
|
1353
|
-
$stdout.string.
|
2244
|
+
$stdout.string.rstrip.should == "@stuntmann82 @antpires @mlroach @jtrupiano @maccman"
|
1354
2245
|
end
|
1355
2246
|
end
|
1356
2247
|
context "--friends" do
|
@@ -1359,7 +2250,7 @@ URL https://twitter.com/sferik/status/55709764298092545
|
|
1359
2250
|
end
|
1360
2251
|
it "should sort by number of friends" do
|
1361
2252
|
@cli.suggest
|
1362
|
-
$stdout.string.
|
2253
|
+
$stdout.string.rstrip.should == "@stuntmann82 @antpires @mlroach @jtrupiano @maccman"
|
1363
2254
|
end
|
1364
2255
|
end
|
1365
2256
|
context "--listed" do
|
@@ -1368,14 +2259,14 @@ URL https://twitter.com/sferik/status/55709764298092545
|
|
1368
2259
|
end
|
1369
2260
|
it "should sort by number of list memberships" do
|
1370
2261
|
@cli.suggest
|
1371
|
-
$stdout.string.
|
2262
|
+
$stdout.string.rstrip.should == "@stuntmann82 @antpires @mlroach @jtrupiano @maccman"
|
1372
2263
|
end
|
1373
2264
|
end
|
1374
2265
|
context "--long" do
|
1375
2266
|
before do
|
1376
2267
|
@cli.options = @cli.options.merge(:long => true)
|
1377
2268
|
end
|
1378
|
-
it "should
|
2269
|
+
it "should output in long format" do
|
1379
2270
|
@cli.suggest
|
1380
2271
|
$stdout.string.should == <<-eos
|
1381
2272
|
ID Since Tweets Favorites Listed Following Followers Screen name Name
|
@@ -1391,23 +2282,32 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
1391
2282
|
before do
|
1392
2283
|
@cli.options = @cli.options.merge(:number => 1)
|
1393
2284
|
stub_get("/1/users/recommendations.json").
|
1394
|
-
with(:query => {:limit => "1", :include_entities => "false"}).
|
2285
|
+
with(:query => {:limit => "1", :include_entities => "false", :screen_name => "sferik"}).
|
1395
2286
|
to_return(:body => fixture("recommendations.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1396
2287
|
end
|
1397
2288
|
it "should limit the number of results" do
|
1398
2289
|
@cli.suggest
|
1399
2290
|
a_get("/1/users/recommendations.json").
|
1400
|
-
with(:query => {:limit => "1", :include_entities => "false"}).
|
2291
|
+
with(:query => {:limit => "1", :include_entities => "false", :screen_name => "sferik"}).
|
1401
2292
|
should have_been_made
|
1402
2293
|
end
|
1403
2294
|
end
|
2295
|
+
context "--posted" do
|
2296
|
+
before do
|
2297
|
+
@cli.options = @cli.options.merge(:posted => true)
|
2298
|
+
end
|
2299
|
+
it "should sort by the time when Twitter acount was created" do
|
2300
|
+
@cli.suggest
|
2301
|
+
$stdout.string.rstrip.should == "@maccman @mlroach @jtrupiano @stuntmann82 @antpires"
|
2302
|
+
end
|
2303
|
+
end
|
1404
2304
|
context "--reverse" do
|
1405
2305
|
before do
|
1406
2306
|
@cli.options = @cli.options.merge(:reverse => true)
|
1407
2307
|
end
|
1408
2308
|
it "should reverse the order of the sort" do
|
1409
2309
|
@cli.suggest
|
1410
|
-
$stdout.string.
|
2310
|
+
$stdout.string.rstrip.should == "@stuntmann82 @mlroach @maccman @jtrupiano @antpires"
|
1411
2311
|
end
|
1412
2312
|
end
|
1413
2313
|
context "--tweets" do
|
@@ -1416,7 +2316,42 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
1416
2316
|
end
|
1417
2317
|
it "should sort by number of Tweets" do
|
1418
2318
|
@cli.suggest
|
1419
|
-
$stdout.string.
|
2319
|
+
$stdout.string.rstrip.should == "@stuntmann82 @antpires @jtrupiano @maccman @mlroach"
|
2320
|
+
end
|
2321
|
+
end
|
2322
|
+
context "--unsorted" do
|
2323
|
+
before do
|
2324
|
+
@cli.options = @cli.options.merge(:unsorted => true)
|
2325
|
+
end
|
2326
|
+
it "should not be sorted" do
|
2327
|
+
@cli.suggest
|
2328
|
+
$stdout.string.rstrip.should == "@jtrupiano @mlroach @antpires @maccman @stuntmann82"
|
2329
|
+
end
|
2330
|
+
end
|
2331
|
+
context "with a user passed" do
|
2332
|
+
it "should request the correct resource" do
|
2333
|
+
@cli.suggest("sferik")
|
2334
|
+
a_get("/1/users/recommendations.json").
|
2335
|
+
with(:query => {:limit => "20", :include_entities => "false", :screen_name => "sferik"}).
|
2336
|
+
should have_been_made
|
2337
|
+
end
|
2338
|
+
it "should have the correct output" do
|
2339
|
+
@cli.suggest("sferik")
|
2340
|
+
$stdout.string.rstrip.should == "@antpires @jtrupiano @maccman @mlroach @stuntmann82"
|
2341
|
+
end
|
2342
|
+
context "--id" do
|
2343
|
+
before do
|
2344
|
+
@cli.options = @cli.options.merge(:id => true)
|
2345
|
+
stub_get("/1/users/recommendations.json").
|
2346
|
+
with(:query => {:limit => "20", :include_entities => "false", :user_id => "7505382"}).
|
2347
|
+
to_return(:body => fixture("recommendations.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2348
|
+
end
|
2349
|
+
it "should request the correct resource" do
|
2350
|
+
@cli.suggest("7505382")
|
2351
|
+
a_get("/1/users/recommendations.json").
|
2352
|
+
with(:query => {:limit => "20", :include_entities => "false", :user_id => "7505382"}).
|
2353
|
+
should have_been_made
|
2354
|
+
end
|
1420
2355
|
end
|
1421
2356
|
end
|
1422
2357
|
end
|
@@ -1457,11 +2392,39 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
1457
2392
|
eos
|
1458
2393
|
end
|
1459
2394
|
end
|
2395
|
+
context "--csv" do
|
2396
|
+
before do
|
2397
|
+
@cli.options = @cli.options.merge(:csv => true)
|
2398
|
+
end
|
2399
|
+
it "should output in CSV format" do
|
2400
|
+
@cli.timeline
|
2401
|
+
$stdout.string.should == <<-eos
|
2402
|
+
ID,Posted at,Screen name,Text
|
2403
|
+
194548121416630272,2011-04-23 22:07:41 +0000,natevillegas,RT @gelobautista #riordan RT @WilI_Smith: Yesterday is history. Tomorrow is a mystery. Today is a gift. That's why it's called the present.
|
2404
|
+
194547993607806976,2011-04-23 22:07:10 +0000,TD,@kelseysilver how long will you be in town?
|
2405
|
+
194547987593183233,2011-04-23 22:07:09 +0000,rusashka,@maciej hahaha :) @gpena together we're going to cover all core 28 languages!
|
2406
|
+
194547824690597888,2011-04-23 22:06:30 +0000,fat,@stevej @xc i'm going to picket when i get back.
|
2407
|
+
194547658562605057,2011-04-23 22:05:51 +0000,wil,@0x9900 @paulnivin http://t.co/bwVdtAPe
|
2408
|
+
194547528430137344,2011-04-23 22:05:19 +0000,wangtian,"@tianhonghe @xiangxin72 oh, you can even order specific items?"
|
2409
|
+
194547402550689793,2011-04-23 22:04:49 +0000,shinypb,"@kpk Pfft, I think you're forgetting mechanical television, which depended on a clever German. http://t.co/JvLNQCDm @skilldrick @hoverbird"
|
2410
|
+
194547260233760768,2011-04-23 22:04:16 +0000,0x9900,@wil @paulnivin if you want to take you seriously don't say daemontools!
|
2411
|
+
194547084349804544,2011-04-23 22:03:34 +0000,kpk,@shinypb @skilldrick @hoverbird invented it
|
2412
|
+
194546876782092291,2011-04-23 22:02:44 +0000,skilldrick,@shinypb Well played :) @hoverbird
|
2413
|
+
194546811480969217,2011-04-23 22:02:29 +0000,sam,"Can someone project the date that I'll get a 27"" retina display?"
|
2414
|
+
194546738810458112,2011-04-23 22:02:11 +0000,shinypb,"@skilldrick @hoverbird Wow, I didn't even know they *had* TV in Britain."
|
2415
|
+
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
2416
|
+
194546649203347456,2011-04-23 22:01:50 +0000,skilldrick,"@hoverbird @shinypb You guys must be soooo old, I don't remember the words to the duck tales intro at all."
|
2417
|
+
194546583608639488,2011-04-23 22:01:34 +0000,sean,@mep Thanks for coming by. Was great to have you.
|
2418
|
+
194546388707717120,2011-04-23 22:00:48 +0000,hoverbird,"@shinypb @trammell it's all suck a ""duck blur"" sometimes."
|
2419
|
+
194546264212385793,2011-04-23 22:00:18 +0000,kelseysilver,San Francisco here I come! (@ Newark Liberty International Airport (EWR) w/ 92 others) http://t.co/eoLANJZw
|
2420
|
+
eos
|
2421
|
+
end
|
2422
|
+
end
|
1460
2423
|
context "--long" do
|
1461
2424
|
before do
|
1462
2425
|
@cli.options = @cli.options.merge(:long => true)
|
1463
2426
|
end
|
1464
|
-
it "should
|
2427
|
+
it "should output in long format" do
|
1465
2428
|
@cli.timeline
|
1466
2429
|
$stdout.string.should == <<-eos
|
1467
2430
|
ID Posted at Screen name Text
|
@@ -1526,7 +2489,7 @@ ID Posted at Screen name Text
|
|
1526
2489
|
eos
|
1527
2490
|
end
|
1528
2491
|
end
|
1529
|
-
context "with user" do
|
2492
|
+
context "with a user passed" do
|
1530
2493
|
before do
|
1531
2494
|
stub_get("/1/statuses/user_timeline.json").
|
1532
2495
|
with(:query => {:count => "20", :include_entities => "false", :screen_name => "sferik"}).
|
@@ -1538,42 +2501,142 @@ ID Posted at Screen name Text
|
|
1538
2501
|
with(:query => {:count => "20", :include_entities => "false", :screen_name => "sferik"}).
|
1539
2502
|
should have_been_made
|
1540
2503
|
end
|
2504
|
+
context "--id" do
|
2505
|
+
before do
|
2506
|
+
@cli.options = @cli.options.merge(:id => true)
|
2507
|
+
stub_get("/1/statuses/user_timeline.json").
|
2508
|
+
with(:query => {:count => "20", :include_entities => "false", :user_id => "7505382"}).
|
2509
|
+
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2510
|
+
end
|
2511
|
+
it "should request the correct resource" do
|
2512
|
+
@cli.timeline("7505382")
|
2513
|
+
a_get("/1/statuses/user_timeline.json").
|
2514
|
+
with(:query => {:count => "20", :include_entities => "false", :user_id => "7505382"}).
|
2515
|
+
should have_been_made
|
2516
|
+
end
|
2517
|
+
end
|
2518
|
+
end
|
2519
|
+
end
|
2520
|
+
|
2521
|
+
describe "#trends" do
|
2522
|
+
before do
|
2523
|
+
stub_get("/1/trends/1.json").
|
2524
|
+
to_return(:body => fixture("trends.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2525
|
+
end
|
2526
|
+
it "should request the correct resource" do
|
2527
|
+
@cli.trends
|
2528
|
+
a_get("/1/trends/1.json").
|
2529
|
+
should have_been_made
|
2530
|
+
end
|
2531
|
+
it "should have the correct output" do
|
2532
|
+
@cli.trends
|
2533
|
+
$stdout.string.rstrip.should == "#sevenwordsaftersex Walkman Allen Iverson"
|
2534
|
+
end
|
2535
|
+
context "--exclude_hashtags" do
|
2536
|
+
before do
|
2537
|
+
@cli.options = @cli.options.merge(:exclude_hashtags => true)
|
2538
|
+
stub_get("/1/trends/1.json").
|
2539
|
+
with(:query => {:exclude => "hashtags"}).
|
2540
|
+
to_return(:body => fixture("trends.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2541
|
+
end
|
2542
|
+
it "should request the correct resource" do
|
2543
|
+
@cli.trends
|
2544
|
+
a_get("/1/trends/1.json").
|
2545
|
+
with(:query => {:exclude => "hashtags"}).
|
2546
|
+
should have_been_made
|
2547
|
+
end
|
1541
2548
|
it "should have the correct output" do
|
1542
|
-
@cli.
|
1543
|
-
$stdout.string.should ==
|
1544
|
-
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
2549
|
+
@cli.trends
|
2550
|
+
$stdout.string.rstrip.should == "#sevenwordsaftersex Walkman Allen Iverson"
|
2551
|
+
end
|
2552
|
+
end
|
2553
|
+
context "with a WOEID passed" do
|
2554
|
+
before do
|
2555
|
+
stub_get("/1/trends/2487956.json").
|
2556
|
+
to_return(:body => fixture("trends.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2557
|
+
end
|
2558
|
+
it "should request the correct resource" do
|
2559
|
+
@cli.trends("2487956")
|
2560
|
+
a_get("/1/trends/2487956.json").
|
2561
|
+
should have_been_made
|
2562
|
+
end
|
2563
|
+
it "should have the correct output" do
|
2564
|
+
@cli.trends("2487956")
|
2565
|
+
$stdout.string.rstrip.should == "#sevenwordsaftersex Walkman Allen Iverson"
|
2566
|
+
end
|
2567
|
+
end
|
2568
|
+
end
|
2569
|
+
|
2570
|
+
describe "#trend_locations" do
|
2571
|
+
before do
|
2572
|
+
stub_get("/1/trends/available.json").
|
2573
|
+
to_return(:body => fixture("locations.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2574
|
+
end
|
2575
|
+
it "should request the correct resource" do
|
2576
|
+
@cli.trend_locations
|
2577
|
+
a_get("/1/trends/available.json").
|
2578
|
+
should have_been_made
|
2579
|
+
end
|
2580
|
+
it "should have the correct output" do
|
2581
|
+
@cli.trend_locations
|
2582
|
+
$stdout.string.rstrip.should == "Boston New York San Francisco United States Worldwide"
|
2583
|
+
end
|
2584
|
+
context "--csv" do
|
2585
|
+
before do
|
2586
|
+
@cli.options = @cli.options.merge(:csv => true)
|
2587
|
+
end
|
2588
|
+
it "should output in CSV format" do
|
2589
|
+
@cli.trend_locations
|
2590
|
+
$stdout.string.rstrip.should == <<-eos.rstrip
|
2591
|
+
WOEID,Parent ID,Type,Name,Country
|
2592
|
+
2367105,,Town,Boston,United States
|
2593
|
+
2459115,,Town,New York,United States
|
2594
|
+
2487956,,Town,San Francisco,United States
|
2595
|
+
23424977,,Country,United States,United States
|
2596
|
+
1,,Supername,Worldwide,""
|
1561
2597
|
eos
|
1562
2598
|
end
|
1563
2599
|
end
|
2600
|
+
context "--long" do
|
2601
|
+
before do
|
2602
|
+
@cli.options = @cli.options.merge(:long => true)
|
2603
|
+
end
|
2604
|
+
it "should output in long format" do
|
2605
|
+
@cli.trend_locations
|
2606
|
+
$stdout.string.rstrip.should == <<-eos.rstrip
|
2607
|
+
WOEID Parent ID Type Name Country
|
2608
|
+
2367105 Town Boston United States
|
2609
|
+
2459115 Town New York United States
|
2610
|
+
2487956 Town San Francisco United States
|
2611
|
+
23424977 Country United States United States
|
2612
|
+
1 Supername Worldwide
|
2613
|
+
eos
|
2614
|
+
end
|
2615
|
+
end
|
2616
|
+
context "--reverse" do
|
2617
|
+
before do
|
2618
|
+
@cli.options = @cli.options.merge(:reverse => true)
|
2619
|
+
end
|
2620
|
+
it "should reverse the order of the sort" do
|
2621
|
+
@cli.trend_locations
|
2622
|
+
$stdout.string.rstrip.should == "Worldwide United States San Francisco New York Boston"
|
2623
|
+
end
|
2624
|
+
end
|
2625
|
+
context "--unsorted" do
|
2626
|
+
before do
|
2627
|
+
@cli.options = @cli.options.merge(:unsorted => true)
|
2628
|
+
end
|
2629
|
+
it "should not be sorted" do
|
2630
|
+
@cli.trend_locations
|
2631
|
+
$stdout.string.rstrip.should == "Boston Worldwide New York United States San Francisco"
|
2632
|
+
end
|
2633
|
+
end
|
1564
2634
|
end
|
1565
2635
|
|
1566
2636
|
describe "#unfollow" do
|
1567
2637
|
before do
|
1568
2638
|
@cli.options = @cli.options.merge(:profile => fixture_path + "/.trc")
|
1569
2639
|
end
|
1570
|
-
context "no users" do
|
1571
|
-
it "should exit" do
|
1572
|
-
lambda do
|
1573
|
-
@cli.unfollow
|
1574
|
-
end.should raise_error
|
1575
|
-
end
|
1576
|
-
end
|
1577
2640
|
context "one user" do
|
1578
2641
|
it "should request the correct resource" do
|
1579
2642
|
stub_delete("/1/friendships/destroy.json").
|
@@ -1591,6 +2654,20 @@ ID Posted at Screen name Text
|
|
1591
2654
|
@cli.unfollow("sferik")
|
1592
2655
|
$stdout.string.should =~ /^@testcli is no longer following 1 user\.$/
|
1593
2656
|
end
|
2657
|
+
context "--id" do
|
2658
|
+
before do
|
2659
|
+
@cli.options = @cli.options.merge(:id => true)
|
2660
|
+
stub_delete("/1/friendships/destroy.json").
|
2661
|
+
with(:query => {:user_id => "7505382", :include_entities => "false"}).
|
2662
|
+
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2663
|
+
end
|
2664
|
+
it "should request the correct resource" do
|
2665
|
+
@cli.unfollow("7505382")
|
2666
|
+
a_delete("/1/friendships/destroy.json").
|
2667
|
+
with(:query => {:user_id => "7505382", :include_entities => "false"}).
|
2668
|
+
should have_been_made
|
2669
|
+
end
|
2670
|
+
end
|
1594
2671
|
context "Twitter is down" do
|
1595
2672
|
it "should retry 3 times and then raise an error" do
|
1596
2673
|
stub_delete("/1/friendships/destroy.json").
|
@@ -1648,15 +2725,19 @@ ID Posted at Screen name Text
|
|
1648
2725
|
end
|
1649
2726
|
it "should have the correct output" do
|
1650
2727
|
@cli.users("sferik", "pengwynn")
|
1651
|
-
$stdout.string.
|
2728
|
+
$stdout.string.rstrip.should == "@pengwynn @sferik"
|
1652
2729
|
end
|
1653
|
-
context "--
|
2730
|
+
context "--csv" do
|
1654
2731
|
before do
|
1655
|
-
@cli.options = @cli.options.merge(:
|
2732
|
+
@cli.options = @cli.options.merge(:csv => true)
|
1656
2733
|
end
|
1657
|
-
it "should
|
2734
|
+
it "should output in CSV format" do
|
1658
2735
|
@cli.users("sferik", "pengwynn")
|
1659
|
-
$stdout.string.
|
2736
|
+
$stdout.string.should == <<-eos
|
2737
|
+
ID,Since,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
|
2738
|
+
14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
|
2739
|
+
7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
|
2740
|
+
eos
|
1660
2741
|
end
|
1661
2742
|
end
|
1662
2743
|
context "--favorites" do
|
@@ -1665,7 +2746,7 @@ ID Posted at Screen name Text
|
|
1665
2746
|
end
|
1666
2747
|
it "should sort by number of favorites" do
|
1667
2748
|
@cli.users("sferik", "pengwynn")
|
1668
|
-
$stdout.string.
|
2749
|
+
$stdout.string.rstrip.should == "@pengwynn @sferik"
|
1669
2750
|
end
|
1670
2751
|
end
|
1671
2752
|
context "--followers" do
|
@@ -1674,7 +2755,7 @@ ID Posted at Screen name Text
|
|
1674
2755
|
end
|
1675
2756
|
it "should sort by number of followers" do
|
1676
2757
|
@cli.users("sferik", "pengwynn")
|
1677
|
-
$stdout.string.
|
2758
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
1678
2759
|
end
|
1679
2760
|
end
|
1680
2761
|
context "--friends" do
|
@@ -1683,7 +2764,21 @@ ID Posted at Screen name Text
|
|
1683
2764
|
end
|
1684
2765
|
it "should sort by number of friends" do
|
1685
2766
|
@cli.users("sferik", "pengwynn")
|
1686
|
-
$stdout.string.
|
2767
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
2768
|
+
end
|
2769
|
+
end
|
2770
|
+
context "--id" do
|
2771
|
+
before do
|
2772
|
+
@cli.options = @cli.options.merge(:id => true)
|
2773
|
+
stub_get("/1/users/lookup.json").
|
2774
|
+
with(:query => {:user_id => "7505382,14100886", :include_entities => "false"}).
|
2775
|
+
to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2776
|
+
end
|
2777
|
+
it "should request the correct resource" do
|
2778
|
+
@cli.users("7505382", "14100886")
|
2779
|
+
a_get("/1/users/lookup.json").
|
2780
|
+
with(:query => {:user_id => "7505382,14100886", :include_entities => "false"}).
|
2781
|
+
should have_been_made
|
1687
2782
|
end
|
1688
2783
|
end
|
1689
2784
|
context "--listed" do
|
@@ -1692,14 +2787,14 @@ ID Posted at Screen name Text
|
|
1692
2787
|
end
|
1693
2788
|
it "should sort by number of list memberships" do
|
1694
2789
|
@cli.users("sferik", "pengwynn")
|
1695
|
-
$stdout.string.
|
2790
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
1696
2791
|
end
|
1697
2792
|
end
|
1698
2793
|
context "--long" do
|
1699
2794
|
before do
|
1700
2795
|
@cli.options = @cli.options.merge(:long => true)
|
1701
2796
|
end
|
1702
|
-
it "should
|
2797
|
+
it "should output in long format" do
|
1703
2798
|
@cli.users("sferik", "pengwynn")
|
1704
2799
|
$stdout.string.should == <<-eos
|
1705
2800
|
ID Since Tweets Favorites Listed Following Followers Screen name Name
|
@@ -1708,13 +2803,22 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
1708
2803
|
eos
|
1709
2804
|
end
|
1710
2805
|
end
|
2806
|
+
context "--posted" do
|
2807
|
+
before do
|
2808
|
+
@cli.options = @cli.options.merge(:posted => true)
|
2809
|
+
end
|
2810
|
+
it "should sort by the time when Twitter acount was created" do
|
2811
|
+
@cli.users("sferik", "pengwynn")
|
2812
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
2813
|
+
end
|
2814
|
+
end
|
1711
2815
|
context "--reverse" do
|
1712
2816
|
before do
|
1713
2817
|
@cli.options = @cli.options.merge(:reverse => true)
|
1714
2818
|
end
|
1715
2819
|
it "should reverse the order of the sort" do
|
1716
2820
|
@cli.users("sferik", "pengwynn")
|
1717
|
-
$stdout.string.
|
2821
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
1718
2822
|
end
|
1719
2823
|
end
|
1720
2824
|
context "--tweets" do
|
@@ -1723,7 +2827,16 @@ ID Since Tweets Favorites Listed Following Followers Screen
|
|
1723
2827
|
end
|
1724
2828
|
it "should sort by number of Tweets" do
|
1725
2829
|
@cli.users("sferik", "pengwynn")
|
1726
|
-
$stdout.string.
|
2830
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
2831
|
+
end
|
2832
|
+
end
|
2833
|
+
context "--unsorted" do
|
2834
|
+
before do
|
2835
|
+
@cli.options = @cli.options.merge(:unsorted => true)
|
2836
|
+
end
|
2837
|
+
it "should not be sorted" do
|
2838
|
+
@cli.users("sferik", "pengwynn")
|
2839
|
+
$stdout.string.rstrip.should == "@sferik @pengwynn"
|
1727
2840
|
end
|
1728
2841
|
end
|
1729
2842
|
end
|
@@ -1754,7 +2867,6 @@ ID 7505382
|
|
1754
2867
|
Name Erik Michaels-Ober
|
1755
2868
|
Bio A mind forever voyaging through strange seas of thought, alone.
|
1756
2869
|
Location San Francisco
|
1757
|
-
URL https://github.com/sferik
|
1758
2870
|
Status Not following
|
1759
2871
|
Last update RT @tenderlove: [ANN] sqlite3-ruby => sqlite3 (10 months ago)
|
1760
2872
|
Since Jul 16 2007
|
@@ -1763,8 +2875,35 @@ Favorites 1,040
|
|
1763
2875
|
Listed 41
|
1764
2876
|
Following 197
|
1765
2877
|
Followers 1,048
|
2878
|
+
URL https://github.com/sferik
|
1766
2879
|
eos
|
1767
2880
|
end
|
2881
|
+
context "--csv" do
|
2882
|
+
before do
|
2883
|
+
@cli.options = @cli.options.merge(:csv => true)
|
2884
|
+
end
|
2885
|
+
it "should have the correct output" do
|
2886
|
+
@cli.whois("sferik")
|
2887
|
+
$stdout.string.should == <<-eos
|
2888
|
+
ID,Verified,Name,Screen name,Bio,Location,Following,Last update,Lasted updated at,Since,Tweets,Favorites,Listed,Following,Followers,URL
|
2889
|
+
7505382,false,Erik Michaels-Ober,sferik,"A mind forever voyaging through strange seas of thought, alone.",San Francisco,false,RT @tenderlove: [ANN] sqlite3-ruby => sqlite3,2011-01-16 21:38:25 +0000,2007-07-16 12:59:01 +0000,3479,1040,41,197,1048,https://github.com/sferik
|
2890
|
+
eos
|
2891
|
+
end
|
2892
|
+
end
|
2893
|
+
context "--id" do
|
2894
|
+
before do
|
2895
|
+
@cli.options = @cli.options.merge(:id => true)
|
2896
|
+
stub_get("/1/users/show.json").
|
2897
|
+
with(:query => {:user_id => "7505382", :include_entities => "false"}).
|
2898
|
+
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2899
|
+
end
|
2900
|
+
it "should request the correct resource" do
|
2901
|
+
@cli.whois("7505382")
|
2902
|
+
a_get("/1/users/show.json").
|
2903
|
+
with(:query => {:user_id => "7505382", :include_entities => "false"}).
|
2904
|
+
should have_been_made
|
2905
|
+
end
|
2906
|
+
end
|
1768
2907
|
end
|
1769
2908
|
|
1770
2909
|
end
|