t 2.2.1 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.md +2 -2
- data/bin/t +2 -2
- data/lib/t/cli.rb +211 -129
- data/lib/t/delete.rb +6 -6
- data/lib/t/list.rb +16 -15
- data/lib/t/printable.rb +11 -11
- data/lib/t/rcfile.rb +1 -1
- data/lib/t/requestable.rb +1 -1
- data/lib/t/search.rb +35 -28
- data/lib/t/set.rb +1 -1
- data/lib/t/stream.rb +15 -15
- data/lib/t/utils.rb +7 -3
- data/lib/t/version.rb +2 -2
- data/spec/cli_spec.rb +742 -206
- data/spec/delete_spec.rb +3 -3
- data/spec/helper.rb +1 -1
- data/t.gemspec +1 -1
- metadata +5 -6
- metadata.gz.sig +0 -0
data/lib/t/utils.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module T
|
2
2
|
module Utils
|
3
|
-
|
3
|
+
private
|
4
4
|
|
5
5
|
# https://github.com/rails/rails/blob/bd8a970/actionpack/lib/action_view/helpers/date_helper.rb
|
6
6
|
def distance_of_time_in_words(from_time, to_time = Time.now) # rubocop:disable CyclomaticComplexity
|
@@ -58,7 +58,7 @@ module T
|
|
58
58
|
|
59
59
|
def format_users!(users, options)
|
60
60
|
require 't/core_ext/string'
|
61
|
-
options['id'] ? users.
|
61
|
+
options['id'] ? users.collect!(&:to_i) : users.collect!(&:strip_ats)
|
62
62
|
end
|
63
63
|
|
64
64
|
def extract_owner(list, options)
|
@@ -79,7 +79,7 @@ module T
|
|
79
79
|
|
80
80
|
def number_with_delimiter(number, delimiter = ',')
|
81
81
|
digits = number.to_s.split(//)
|
82
|
-
groups = digits.reverse.each_slice(3).
|
82
|
+
groups = digits.reverse.each_slice(3).collect { |g| g.join('') }
|
83
83
|
groups.join(delimiter).reverse
|
84
84
|
end
|
85
85
|
|
@@ -109,5 +109,9 @@ module T
|
|
109
109
|
say "Open: #{uri}"
|
110
110
|
end
|
111
111
|
end
|
112
|
+
|
113
|
+
def parallel_map(enumerable)
|
114
|
+
enumerable.collect { |object| Thread.new { yield object } }.collect(&:value)
|
115
|
+
end
|
112
116
|
end
|
113
117
|
end
|
data/lib/t/version.rb
CHANGED
data/spec/cli_spec.rb
CHANGED
@@ -132,7 +132,7 @@ testcli
|
|
132
132
|
end
|
133
133
|
it 'has the correct output' do
|
134
134
|
@cli.block('sferik')
|
135
|
-
expect($stdout.string).to match
|
135
|
+
expect($stdout.string).to match(/^@testcli blocked 1 user/)
|
136
136
|
end
|
137
137
|
context '--id' do
|
138
138
|
before do
|
@@ -484,158 +484,6 @@ ID Posted at Screen name Text
|
|
484
484
|
end
|
485
485
|
end
|
486
486
|
|
487
|
-
describe '#groupies' do
|
488
|
-
before do
|
489
|
-
stub_get('/1.1/account/verify_credentials.json').to_return(:body => fixture('sferik.json'))
|
490
|
-
stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('followers_ids.json'))
|
491
|
-
stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
|
492
|
-
stub_post('/1.1/users/lookup.json').with(:body => {:user_id => '213747670,428004849'}).to_return(:body => fixture('users.json'))
|
493
|
-
end
|
494
|
-
it 'requests the correct resource' do
|
495
|
-
@cli.groupies
|
496
|
-
expect(a_get('/1.1/account/verify_credentials.json')).to have_been_made
|
497
|
-
expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
|
498
|
-
expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
|
499
|
-
expect(a_post('/1.1/users/lookup.json').with(:body => {:user_id => '213747670,428004849'})).to have_been_made
|
500
|
-
end
|
501
|
-
it 'has the correct output' do
|
502
|
-
@cli.groupies
|
503
|
-
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
504
|
-
end
|
505
|
-
context '--csv' do
|
506
|
-
before do
|
507
|
-
@cli.options = @cli.options.merge('csv' => true)
|
508
|
-
end
|
509
|
-
it 'outputs in CSV format' do
|
510
|
-
@cli.groupies
|
511
|
-
expect($stdout.string).to eq <<-eos
|
512
|
-
ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name,Verified,Protected,Bio,Status,Location,URL
|
513
|
-
14100886,2008-03-08 16:34:22 +0000,2012-07-07 20:33:19 +0000,6940,192,358,3427,5457,pengwynn,Wynn Netherland,false,false,"Christian, husband, father, GitHubber, Co-host of @thechangelog, Co-author of Sass, Compass, #CSS book http://wynn.fm/sass-meap",@akosmasoftware Sass book! @hcatlin @nex3 are the brains behind Sass. :-),"Denton, TX",http://wynnnetherland.com
|
514
|
-
7505382,2007-07-16 12:59:01 +0000,2012-07-08 18:29:20 +0000,7890,3755,118,212,2262,sferik,Erik Michaels-Ober,false,false,Vagabond.,@goldman You're near my home town! Say hi to Woodstock for me.,San Francisco,https://github.com/sferik
|
515
|
-
eos
|
516
|
-
end
|
517
|
-
end
|
518
|
-
context '--long' do
|
519
|
-
before do
|
520
|
-
@cli.options = @cli.options.merge('long' => true)
|
521
|
-
end
|
522
|
-
it 'outputs in long format' do
|
523
|
-
@cli.groupies
|
524
|
-
expect($stdout.string).to eq <<-eos
|
525
|
-
ID Since Last tweeted at Tweets Favorites Listed Following...
|
526
|
-
14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
|
527
|
-
7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
|
528
|
-
eos
|
529
|
-
end
|
530
|
-
end
|
531
|
-
context '--reverse' do
|
532
|
-
before do
|
533
|
-
@cli.options = @cli.options.merge('reverse' => true)
|
534
|
-
end
|
535
|
-
it 'reverses the order of the sort' do
|
536
|
-
@cli.groupies
|
537
|
-
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
538
|
-
end
|
539
|
-
end
|
540
|
-
context '--sort=favorites' do
|
541
|
-
before do
|
542
|
-
@cli.options = @cli.options.merge('sort' => 'favorites')
|
543
|
-
end
|
544
|
-
it 'sorts by the number of favorites' do
|
545
|
-
@cli.groupies
|
546
|
-
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
547
|
-
end
|
548
|
-
end
|
549
|
-
context '--sort=followers' do
|
550
|
-
before do
|
551
|
-
@cli.options = @cli.options.merge('sort' => 'followers')
|
552
|
-
end
|
553
|
-
it 'sorts by the number of followers' do
|
554
|
-
@cli.groupies
|
555
|
-
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
556
|
-
end
|
557
|
-
end
|
558
|
-
context '--sort=friends' do
|
559
|
-
before do
|
560
|
-
@cli.options = @cli.options.merge('sort' => 'friends')
|
561
|
-
end
|
562
|
-
it 'sorts by the number of friends' do
|
563
|
-
@cli.groupies
|
564
|
-
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
565
|
-
end
|
566
|
-
end
|
567
|
-
context '--sort=listed' do
|
568
|
-
before do
|
569
|
-
@cli.options = @cli.options.merge('sort' => 'listed')
|
570
|
-
end
|
571
|
-
it 'sorts by the number of list memberships' do
|
572
|
-
@cli.groupies
|
573
|
-
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
574
|
-
end
|
575
|
-
end
|
576
|
-
context '--sort=since' do
|
577
|
-
before do
|
578
|
-
@cli.options = @cli.options.merge('sort' => 'since')
|
579
|
-
end
|
580
|
-
it 'sorts by the time when Twitter acount was created' do
|
581
|
-
@cli.groupies
|
582
|
-
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
583
|
-
end
|
584
|
-
end
|
585
|
-
context '--sort=tweets' do
|
586
|
-
before do
|
587
|
-
@cli.options = @cli.options.merge('sort' => 'tweets')
|
588
|
-
end
|
589
|
-
it 'sorts by the number of Tweets' do
|
590
|
-
@cli.groupies
|
591
|
-
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
592
|
-
end
|
593
|
-
end
|
594
|
-
context '--sort=tweeted' do
|
595
|
-
before do
|
596
|
-
@cli.options = @cli.options.merge('sort' => 'tweeted')
|
597
|
-
end
|
598
|
-
it 'sorts by the time of the last Tweet' do
|
599
|
-
@cli.groupies
|
600
|
-
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
601
|
-
end
|
602
|
-
end
|
603
|
-
context '--unsorted' do
|
604
|
-
before do
|
605
|
-
@cli.options = @cli.options.merge('unsorted' => true)
|
606
|
-
end
|
607
|
-
it 'is not sorted' do
|
608
|
-
@cli.groupies
|
609
|
-
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
610
|
-
end
|
611
|
-
end
|
612
|
-
context 'with a user passed' do
|
613
|
-
before do
|
614
|
-
stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('followers_ids.json'))
|
615
|
-
stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
|
616
|
-
end
|
617
|
-
it 'requests the correct resource' do
|
618
|
-
@cli.groupies('sferik')
|
619
|
-
expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
|
620
|
-
expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
|
621
|
-
expect(a_post('/1.1/users/lookup.json').with(:body => {:user_id => '213747670,428004849'})).to have_been_made
|
622
|
-
end
|
623
|
-
context '--id' do
|
624
|
-
before do
|
625
|
-
@cli.options = @cli.options.merge('id' => true)
|
626
|
-
stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('followers_ids.json'))
|
627
|
-
stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('friends_ids.json'))
|
628
|
-
end
|
629
|
-
it 'requests the correct resource' do
|
630
|
-
@cli.groupies('7505382')
|
631
|
-
expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
|
632
|
-
expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
|
633
|
-
expect(a_post('/1.1/users/lookup.json').with(:body => {:user_id => '213747670,428004849'})).to have_been_made
|
634
|
-
end
|
635
|
-
end
|
636
|
-
end
|
637
|
-
end
|
638
|
-
|
639
487
|
describe '#dm' do
|
640
488
|
before do
|
641
489
|
@cli.options = @cli.options.merge('profile' => fixture_path + '/.trc')
|
@@ -807,7 +655,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
807
655
|
end
|
808
656
|
it 'has the correct output' do
|
809
657
|
@cli.favorite('26755176471724032')
|
810
|
-
expect($stdout.string).to match
|
658
|
+
expect($stdout.string).to match(/^@testcli favorited 1 tweet.$/)
|
811
659
|
end
|
812
660
|
end
|
813
661
|
|
@@ -1123,7 +971,7 @@ ID Posted at Screen name Text
|
|
1123
971
|
end
|
1124
972
|
it 'has the correct output' do
|
1125
973
|
@cli.follow('sferik', 'pengwynn')
|
1126
|
-
expect($stdout.string).to match
|
974
|
+
expect($stdout.string).to match(/^@testcli is now following 1 more user\.$/)
|
1127
975
|
end
|
1128
976
|
context '--id' do
|
1129
977
|
before do
|
@@ -1301,20 +1149,20 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1301
1149
|
end
|
1302
1150
|
end
|
1303
1151
|
|
1304
|
-
describe '#
|
1152
|
+
describe '#followings_following' do
|
1305
1153
|
before do
|
1306
|
-
stub_get('/1.1/
|
1154
|
+
stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'testcli'}).to_return(:body => fixture('friends_ids.json'))
|
1307
1155
|
stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
|
1308
1156
|
stub_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'}).to_return(:body => fixture('users.json'))
|
1309
1157
|
end
|
1310
1158
|
it 'requests the correct resource' do
|
1311
|
-
@cli.
|
1312
|
-
expect(a_get('/1.1/
|
1159
|
+
@cli.followings_following('sferik')
|
1160
|
+
expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'testcli'})).to have_been_made
|
1313
1161
|
expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
|
1314
1162
|
expect(a_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'})).to have_been_made
|
1315
1163
|
end
|
1316
1164
|
it 'has the correct output' do
|
1317
|
-
@cli.
|
1165
|
+
@cli.followings_following('sferik')
|
1318
1166
|
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1319
1167
|
end
|
1320
1168
|
context '--csv' do
|
@@ -1322,7 +1170,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1322
1170
|
@cli.options = @cli.options.merge('csv' => true)
|
1323
1171
|
end
|
1324
1172
|
it 'outputs in CSV format' do
|
1325
|
-
@cli.
|
1173
|
+
@cli.followings_following('sferik')
|
1326
1174
|
expect($stdout.string).to eq <<-eos
|
1327
1175
|
ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name,Verified,Protected,Bio,Status,Location,URL
|
1328
1176
|
14100886,2008-03-08 16:34:22 +0000,2012-07-07 20:33:19 +0000,6940,192,358,3427,5457,pengwynn,Wynn Netherland,false,false,"Christian, husband, father, GitHubber, Co-host of @thechangelog, Co-author of Sass, Compass, #CSS book http://wynn.fm/sass-meap",@akosmasoftware Sass book! @hcatlin @nex3 are the brains behind Sass. :-),"Denton, TX",http://wynnnetherland.com
|
@@ -1335,7 +1183,7 @@ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name
|
|
1335
1183
|
@cli.options = @cli.options.merge('long' => true)
|
1336
1184
|
end
|
1337
1185
|
it 'outputs in long format' do
|
1338
|
-
@cli.
|
1186
|
+
@cli.followings_following('sferik')
|
1339
1187
|
expect($stdout.string).to eq <<-eos
|
1340
1188
|
ID Since Last tweeted at Tweets Favorites Listed Following...
|
1341
1189
|
14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
|
@@ -1348,7 +1196,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1348
1196
|
@cli.options = @cli.options.merge('reverse' => true)
|
1349
1197
|
end
|
1350
1198
|
it 'reverses the order of the sort' do
|
1351
|
-
@cli.
|
1199
|
+
@cli.followings_following('sferik')
|
1352
1200
|
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1353
1201
|
end
|
1354
1202
|
end
|
@@ -1357,7 +1205,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1357
1205
|
@cli.options = @cli.options.merge('sort' => 'favorites')
|
1358
1206
|
end
|
1359
1207
|
it 'sorts by the number of favorites' do
|
1360
|
-
@cli.
|
1208
|
+
@cli.followings_following('sferik')
|
1361
1209
|
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1362
1210
|
end
|
1363
1211
|
end
|
@@ -1366,7 +1214,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1366
1214
|
@cli.options = @cli.options.merge('sort' => 'followers')
|
1367
1215
|
end
|
1368
1216
|
it 'sorts by the number of followers' do
|
1369
|
-
@cli.
|
1217
|
+
@cli.followings_following('sferik')
|
1370
1218
|
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1371
1219
|
end
|
1372
1220
|
end
|
@@ -1375,7 +1223,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1375
1223
|
@cli.options = @cli.options.merge('sort' => 'friends')
|
1376
1224
|
end
|
1377
1225
|
it 'sorts by the number of friends' do
|
1378
|
-
@cli.
|
1226
|
+
@cli.followings_following('sferik')
|
1379
1227
|
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1380
1228
|
end
|
1381
1229
|
end
|
@@ -1384,7 +1232,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1384
1232
|
@cli.options = @cli.options.merge('sort' => 'listed')
|
1385
1233
|
end
|
1386
1234
|
it 'sorts by the number of list memberships' do
|
1387
|
-
@cli.
|
1235
|
+
@cli.followings_following('sferik')
|
1388
1236
|
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1389
1237
|
end
|
1390
1238
|
end
|
@@ -1393,7 +1241,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1393
1241
|
@cli.options = @cli.options.merge('sort' => 'since')
|
1394
1242
|
end
|
1395
1243
|
it 'sorts by the time when Twitter acount was created' do
|
1396
|
-
@cli.
|
1244
|
+
@cli.followings_following('sferik')
|
1397
1245
|
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1398
1246
|
end
|
1399
1247
|
end
|
@@ -1402,7 +1250,458 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1402
1250
|
@cli.options = @cli.options.merge('sort' => 'tweets')
|
1403
1251
|
end
|
1404
1252
|
it 'sorts by the number of Tweets' do
|
1253
|
+
@cli.followings_following('sferik')
|
1254
|
+
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1255
|
+
end
|
1256
|
+
end
|
1257
|
+
context '--sort=tweeted' do
|
1258
|
+
before do
|
1259
|
+
@cli.options = @cli.options.merge('sort' => 'tweeted')
|
1260
|
+
end
|
1261
|
+
it 'sorts by the time of the last Tweet' do
|
1262
|
+
@cli.followings_following('sferik')
|
1263
|
+
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1264
|
+
end
|
1265
|
+
end
|
1266
|
+
context '--unsorted' do
|
1267
|
+
before do
|
1268
|
+
@cli.options = @cli.options.merge('unsorted' => true)
|
1269
|
+
end
|
1270
|
+
it 'is not sorted' do
|
1271
|
+
@cli.followings_following('sferik')
|
1272
|
+
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1273
|
+
end
|
1274
|
+
end
|
1275
|
+
context 'with two users passed' do
|
1276
|
+
before do
|
1277
|
+
stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'pengwynn'}).to_return(:body => fixture('friends_ids.json'))
|
1278
|
+
stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
|
1279
|
+
end
|
1280
|
+
it 'requests the correct resource' do
|
1281
|
+
@cli.followings_following('sferik', 'pengwynn')
|
1282
|
+
expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'pengwynn'})).to have_been_made
|
1283
|
+
expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
|
1284
|
+
expect(a_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'})).to have_been_made
|
1285
|
+
end
|
1286
|
+
context '--id' do
|
1287
|
+
before do
|
1288
|
+
@cli.options = @cli.options.merge('id' => true)
|
1289
|
+
stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '14100886'}).to_return(:body => fixture('friends_ids.json'))
|
1290
|
+
stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('friends_ids.json'))
|
1291
|
+
end
|
1292
|
+
it 'requests the correct resource' do
|
1293
|
+
@cli.followings_following('7505382', '14100886')
|
1294
|
+
expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '14100886'})).to have_been_made
|
1295
|
+
expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
|
1296
|
+
expect(a_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'})).to have_been_made
|
1297
|
+
end
|
1298
|
+
end
|
1299
|
+
end
|
1300
|
+
end
|
1301
|
+
|
1302
|
+
describe '#followers' do
|
1303
|
+
before do
|
1304
|
+
stub_get('/1.1/account/verify_credentials.json').to_return(:body => fixture('sferik.json'))
|
1305
|
+
stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
|
1306
|
+
stub_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'}).to_return(:body => fixture('users.json'))
|
1307
|
+
end
|
1308
|
+
it 'requests the correct resource' do
|
1309
|
+
@cli.followers
|
1310
|
+
expect(a_get('/1.1/account/verify_credentials.json')).to have_been_made
|
1311
|
+
expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
|
1312
|
+
expect(a_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'})).to have_been_made
|
1313
|
+
end
|
1314
|
+
it 'has the correct output' do
|
1315
|
+
@cli.followers
|
1316
|
+
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1317
|
+
end
|
1318
|
+
context '--csv' do
|
1319
|
+
before do
|
1320
|
+
@cli.options = @cli.options.merge('csv' => true)
|
1321
|
+
end
|
1322
|
+
it 'outputs in CSV format' do
|
1323
|
+
@cli.followers
|
1324
|
+
expect($stdout.string).to eq <<-eos
|
1325
|
+
ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name,Verified,Protected,Bio,Status,Location,URL
|
1326
|
+
14100886,2008-03-08 16:34:22 +0000,2012-07-07 20:33:19 +0000,6940,192,358,3427,5457,pengwynn,Wynn Netherland,false,false,"Christian, husband, father, GitHubber, Co-host of @thechangelog, Co-author of Sass, Compass, #CSS book http://wynn.fm/sass-meap",@akosmasoftware Sass book! @hcatlin @nex3 are the brains behind Sass. :-),"Denton, TX",http://wynnnetherland.com
|
1327
|
+
7505382,2007-07-16 12:59:01 +0000,2012-07-08 18:29:20 +0000,7890,3755,118,212,2262,sferik,Erik Michaels-Ober,false,false,Vagabond.,@goldman You're near my home town! Say hi to Woodstock for me.,San Francisco,https://github.com/sferik
|
1328
|
+
eos
|
1329
|
+
end
|
1330
|
+
end
|
1331
|
+
context '--long' do
|
1332
|
+
before do
|
1333
|
+
@cli.options = @cli.options.merge('long' => true)
|
1334
|
+
end
|
1335
|
+
it 'outputs in long format' do
|
1336
|
+
@cli.followers
|
1337
|
+
expect($stdout.string).to eq <<-eos
|
1338
|
+
ID Since Last tweeted at Tweets Favorites Listed Following...
|
1339
|
+
14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
|
1340
|
+
7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
|
1341
|
+
eos
|
1342
|
+
end
|
1343
|
+
end
|
1344
|
+
context '--reverse' do
|
1345
|
+
before do
|
1346
|
+
@cli.options = @cli.options.merge('reverse' => true)
|
1347
|
+
end
|
1348
|
+
it 'reverses the order of the sort' do
|
1405
1349
|
@cli.followers
|
1350
|
+
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1351
|
+
end
|
1352
|
+
end
|
1353
|
+
context '--sort=favorites' do
|
1354
|
+
before do
|
1355
|
+
@cli.options = @cli.options.merge('sort' => 'favorites')
|
1356
|
+
end
|
1357
|
+
it 'sorts by the number of favorites' do
|
1358
|
+
@cli.followers
|
1359
|
+
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1360
|
+
end
|
1361
|
+
end
|
1362
|
+
context '--sort=followers' do
|
1363
|
+
before do
|
1364
|
+
@cli.options = @cli.options.merge('sort' => 'followers')
|
1365
|
+
end
|
1366
|
+
it 'sorts by the number of followers' do
|
1367
|
+
@cli.followers
|
1368
|
+
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1369
|
+
end
|
1370
|
+
end
|
1371
|
+
context '--sort=friends' do
|
1372
|
+
before do
|
1373
|
+
@cli.options = @cli.options.merge('sort' => 'friends')
|
1374
|
+
end
|
1375
|
+
it 'sorts by the number of friends' do
|
1376
|
+
@cli.followers
|
1377
|
+
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1378
|
+
end
|
1379
|
+
end
|
1380
|
+
context '--sort=listed' do
|
1381
|
+
before do
|
1382
|
+
@cli.options = @cli.options.merge('sort' => 'listed')
|
1383
|
+
end
|
1384
|
+
it 'sorts by the number of list memberships' do
|
1385
|
+
@cli.followers
|
1386
|
+
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1387
|
+
end
|
1388
|
+
end
|
1389
|
+
context '--sort=since' do
|
1390
|
+
before do
|
1391
|
+
@cli.options = @cli.options.merge('sort' => 'since')
|
1392
|
+
end
|
1393
|
+
it 'sorts by the time when Twitter acount was created' do
|
1394
|
+
@cli.followers
|
1395
|
+
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1396
|
+
end
|
1397
|
+
end
|
1398
|
+
context '--sort=tweets' do
|
1399
|
+
before do
|
1400
|
+
@cli.options = @cli.options.merge('sort' => 'tweets')
|
1401
|
+
end
|
1402
|
+
it 'sorts by the number of Tweets' do
|
1403
|
+
@cli.followers
|
1404
|
+
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1405
|
+
end
|
1406
|
+
end
|
1407
|
+
context '--sort=tweeted' do
|
1408
|
+
before do
|
1409
|
+
@cli.options = @cli.options.merge('sort' => 'tweeted')
|
1410
|
+
end
|
1411
|
+
it 'sorts by the time of the last Tweet' do
|
1412
|
+
@cli.followers
|
1413
|
+
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1414
|
+
end
|
1415
|
+
end
|
1416
|
+
context '--unsorted' do
|
1417
|
+
before do
|
1418
|
+
@cli.options = @cli.options.merge('unsorted' => true)
|
1419
|
+
end
|
1420
|
+
it 'is not sorted' do
|
1421
|
+
@cli.followers
|
1422
|
+
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1423
|
+
end
|
1424
|
+
end
|
1425
|
+
context 'with a user passed' do
|
1426
|
+
before do
|
1427
|
+
stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
|
1428
|
+
stub_post('/1.1/users/lookup.json').with(:body => {:user_id => '213747670,428004849'}).to_return(:body => fixture('users.json'))
|
1429
|
+
end
|
1430
|
+
it 'requests the correct resource' do
|
1431
|
+
@cli.followers('sferik')
|
1432
|
+
expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
|
1433
|
+
expect(a_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'})).to have_been_made
|
1434
|
+
end
|
1435
|
+
context '--id' do
|
1436
|
+
before do
|
1437
|
+
@cli.options = @cli.options.merge('id' => true)
|
1438
|
+
stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('friends_ids.json'))
|
1439
|
+
end
|
1440
|
+
it 'requests the correct resource' do
|
1441
|
+
@cli.followers('7505382')
|
1442
|
+
expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
|
1443
|
+
expect(a_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'})).to have_been_made
|
1444
|
+
end
|
1445
|
+
end
|
1446
|
+
end
|
1447
|
+
end
|
1448
|
+
|
1449
|
+
describe '#friends' do
|
1450
|
+
before do
|
1451
|
+
stub_get('/1.1/account/verify_credentials.json').to_return(:body => fixture('sferik.json'))
|
1452
|
+
stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
|
1453
|
+
stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
|
1454
|
+
stub_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'}).to_return(:body => fixture('users.json'))
|
1455
|
+
end
|
1456
|
+
it 'requests the correct resource' do
|
1457
|
+
@cli.friends
|
1458
|
+
expect(a_get('/1.1/account/verify_credentials.json')).to have_been_made
|
1459
|
+
expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
|
1460
|
+
expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
|
1461
|
+
expect(a_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'})).to have_been_made
|
1462
|
+
end
|
1463
|
+
it 'has the correct output' do
|
1464
|
+
@cli.friends
|
1465
|
+
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1466
|
+
end
|
1467
|
+
context '--csv' do
|
1468
|
+
before do
|
1469
|
+
@cli.options = @cli.options.merge('csv' => true)
|
1470
|
+
end
|
1471
|
+
it 'outputs in CSV format' do
|
1472
|
+
@cli.friends
|
1473
|
+
expect($stdout.string).to eq <<-eos
|
1474
|
+
ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name,Verified,Protected,Bio,Status,Location,URL
|
1475
|
+
14100886,2008-03-08 16:34:22 +0000,2012-07-07 20:33:19 +0000,6940,192,358,3427,5457,pengwynn,Wynn Netherland,false,false,"Christian, husband, father, GitHubber, Co-host of @thechangelog, Co-author of Sass, Compass, #CSS book http://wynn.fm/sass-meap",@akosmasoftware Sass book! @hcatlin @nex3 are the brains behind Sass. :-),"Denton, TX",http://wynnnetherland.com
|
1476
|
+
7505382,2007-07-16 12:59:01 +0000,2012-07-08 18:29:20 +0000,7890,3755,118,212,2262,sferik,Erik Michaels-Ober,false,false,Vagabond.,@goldman You're near my home town! Say hi to Woodstock for me.,San Francisco,https://github.com/sferik
|
1477
|
+
eos
|
1478
|
+
end
|
1479
|
+
end
|
1480
|
+
context '--long' do
|
1481
|
+
before do
|
1482
|
+
@cli.options = @cli.options.merge('long' => true)
|
1483
|
+
end
|
1484
|
+
it 'outputs in long format' do
|
1485
|
+
@cli.friends
|
1486
|
+
expect($stdout.string).to eq <<-eos
|
1487
|
+
ID Since Last tweeted at Tweets Favorites Listed Following...
|
1488
|
+
14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
|
1489
|
+
7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
|
1490
|
+
eos
|
1491
|
+
end
|
1492
|
+
end
|
1493
|
+
context '--reverse' do
|
1494
|
+
before do
|
1495
|
+
@cli.options = @cli.options.merge('reverse' => true)
|
1496
|
+
end
|
1497
|
+
it 'reverses the order of the sort' do
|
1498
|
+
@cli.friends
|
1499
|
+
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1500
|
+
end
|
1501
|
+
end
|
1502
|
+
context '--sort=favorites' do
|
1503
|
+
before do
|
1504
|
+
@cli.options = @cli.options.merge('sort' => 'favorites')
|
1505
|
+
end
|
1506
|
+
it 'sorts by the number of favorites' do
|
1507
|
+
@cli.friends
|
1508
|
+
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1509
|
+
end
|
1510
|
+
end
|
1511
|
+
context '--sort=followers' do
|
1512
|
+
before do
|
1513
|
+
@cli.options = @cli.options.merge('sort' => 'followers')
|
1514
|
+
end
|
1515
|
+
it 'sorts by the number of followers' do
|
1516
|
+
@cli.friends
|
1517
|
+
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1518
|
+
end
|
1519
|
+
end
|
1520
|
+
context '--sort=friends' do
|
1521
|
+
before do
|
1522
|
+
@cli.options = @cli.options.merge('sort' => 'friends')
|
1523
|
+
end
|
1524
|
+
it 'sorts by the number of friends' do
|
1525
|
+
@cli.friends
|
1526
|
+
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1527
|
+
end
|
1528
|
+
end
|
1529
|
+
context '--sort=listed' do
|
1530
|
+
before do
|
1531
|
+
@cli.options = @cli.options.merge('sort' => 'listed')
|
1532
|
+
end
|
1533
|
+
it 'sorts by the number of list memberships' do
|
1534
|
+
@cli.friends
|
1535
|
+
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1536
|
+
end
|
1537
|
+
end
|
1538
|
+
context '--sort=since' do
|
1539
|
+
before do
|
1540
|
+
@cli.options = @cli.options.merge('sort' => 'since')
|
1541
|
+
end
|
1542
|
+
it 'sorts by the time when Twitter acount was created' do
|
1543
|
+
@cli.friends
|
1544
|
+
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1545
|
+
end
|
1546
|
+
end
|
1547
|
+
context '--sort=tweets' do
|
1548
|
+
before do
|
1549
|
+
@cli.options = @cli.options.merge('sort' => 'tweets')
|
1550
|
+
end
|
1551
|
+
it 'sorts by the number of Tweets' do
|
1552
|
+
@cli.friends
|
1553
|
+
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1554
|
+
end
|
1555
|
+
end
|
1556
|
+
context '--sort=tweeted' do
|
1557
|
+
before do
|
1558
|
+
@cli.options = @cli.options.merge('sort' => 'tweeted')
|
1559
|
+
end
|
1560
|
+
it 'sorts by the time of the last Tweet' do
|
1561
|
+
@cli.friends
|
1562
|
+
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1563
|
+
end
|
1564
|
+
end
|
1565
|
+
context '--unsorted' do
|
1566
|
+
before do
|
1567
|
+
@cli.options = @cli.options.merge('unsorted' => true)
|
1568
|
+
end
|
1569
|
+
it 'is not sorted' do
|
1570
|
+
@cli.friends
|
1571
|
+
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1572
|
+
end
|
1573
|
+
end
|
1574
|
+
context 'with a user passed' do
|
1575
|
+
before do
|
1576
|
+
stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
|
1577
|
+
stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
|
1578
|
+
end
|
1579
|
+
it 'requests the correct resource' do
|
1580
|
+
@cli.friends('sferik')
|
1581
|
+
expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
|
1582
|
+
expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
|
1583
|
+
expect(a_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'})).to have_been_made
|
1584
|
+
end
|
1585
|
+
context '--id' do
|
1586
|
+
before do
|
1587
|
+
@cli.options = @cli.options.merge('id' => true)
|
1588
|
+
stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('friends_ids.json'))
|
1589
|
+
stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('friends_ids.json'))
|
1590
|
+
end
|
1591
|
+
it 'requests the correct resource' do
|
1592
|
+
@cli.friends('7505382')
|
1593
|
+
expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
|
1594
|
+
expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
|
1595
|
+
expect(a_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'})).to have_been_made
|
1596
|
+
end
|
1597
|
+
end
|
1598
|
+
end
|
1599
|
+
end
|
1600
|
+
|
1601
|
+
describe '#groupies' do
|
1602
|
+
before do
|
1603
|
+
stub_get('/1.1/account/verify_credentials.json').to_return(:body => fixture('sferik.json'))
|
1604
|
+
stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('followers_ids.json'))
|
1605
|
+
stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
|
1606
|
+
stub_post('/1.1/users/lookup.json').with(:body => {:user_id => '213747670,428004849'}).to_return(:body => fixture('users.json'))
|
1607
|
+
end
|
1608
|
+
it 'requests the correct resource' do
|
1609
|
+
@cli.groupies
|
1610
|
+
expect(a_get('/1.1/account/verify_credentials.json')).to have_been_made
|
1611
|
+
expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
|
1612
|
+
expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
|
1613
|
+
expect(a_post('/1.1/users/lookup.json').with(:body => {:user_id => '213747670,428004849'})).to have_been_made
|
1614
|
+
end
|
1615
|
+
it 'has the correct output' do
|
1616
|
+
@cli.groupies
|
1617
|
+
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1618
|
+
end
|
1619
|
+
context '--csv' do
|
1620
|
+
before do
|
1621
|
+
@cli.options = @cli.options.merge('csv' => true)
|
1622
|
+
end
|
1623
|
+
it 'outputs in CSV format' do
|
1624
|
+
@cli.groupies
|
1625
|
+
expect($stdout.string).to eq <<-eos
|
1626
|
+
ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name,Verified,Protected,Bio,Status,Location,URL
|
1627
|
+
14100886,2008-03-08 16:34:22 +0000,2012-07-07 20:33:19 +0000,6940,192,358,3427,5457,pengwynn,Wynn Netherland,false,false,"Christian, husband, father, GitHubber, Co-host of @thechangelog, Co-author of Sass, Compass, #CSS book http://wynn.fm/sass-meap",@akosmasoftware Sass book! @hcatlin @nex3 are the brains behind Sass. :-),"Denton, TX",http://wynnnetherland.com
|
1628
|
+
7505382,2007-07-16 12:59:01 +0000,2012-07-08 18:29:20 +0000,7890,3755,118,212,2262,sferik,Erik Michaels-Ober,false,false,Vagabond.,@goldman You're near my home town! Say hi to Woodstock for me.,San Francisco,https://github.com/sferik
|
1629
|
+
eos
|
1630
|
+
end
|
1631
|
+
end
|
1632
|
+
context '--long' do
|
1633
|
+
before do
|
1634
|
+
@cli.options = @cli.options.merge('long' => true)
|
1635
|
+
end
|
1636
|
+
it 'outputs in long format' do
|
1637
|
+
@cli.groupies
|
1638
|
+
expect($stdout.string).to eq <<-eos
|
1639
|
+
ID Since Last tweeted at Tweets Favorites Listed Following...
|
1640
|
+
14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
|
1641
|
+
7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
|
1642
|
+
eos
|
1643
|
+
end
|
1644
|
+
end
|
1645
|
+
context '--reverse' do
|
1646
|
+
before do
|
1647
|
+
@cli.options = @cli.options.merge('reverse' => true)
|
1648
|
+
end
|
1649
|
+
it 'reverses the order of the sort' do
|
1650
|
+
@cli.groupies
|
1651
|
+
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1652
|
+
end
|
1653
|
+
end
|
1654
|
+
context '--sort=favorites' do
|
1655
|
+
before do
|
1656
|
+
@cli.options = @cli.options.merge('sort' => 'favorites')
|
1657
|
+
end
|
1658
|
+
it 'sorts by the number of favorites' do
|
1659
|
+
@cli.groupies
|
1660
|
+
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1661
|
+
end
|
1662
|
+
end
|
1663
|
+
context '--sort=followers' do
|
1664
|
+
before do
|
1665
|
+
@cli.options = @cli.options.merge('sort' => 'followers')
|
1666
|
+
end
|
1667
|
+
it 'sorts by the number of followers' do
|
1668
|
+
@cli.groupies
|
1669
|
+
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1670
|
+
end
|
1671
|
+
end
|
1672
|
+
context '--sort=friends' do
|
1673
|
+
before do
|
1674
|
+
@cli.options = @cli.options.merge('sort' => 'friends')
|
1675
|
+
end
|
1676
|
+
it 'sorts by the number of friends' do
|
1677
|
+
@cli.groupies
|
1678
|
+
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1679
|
+
end
|
1680
|
+
end
|
1681
|
+
context '--sort=listed' do
|
1682
|
+
before do
|
1683
|
+
@cli.options = @cli.options.merge('sort' => 'listed')
|
1684
|
+
end
|
1685
|
+
it 'sorts by the number of list memberships' do
|
1686
|
+
@cli.groupies
|
1687
|
+
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1688
|
+
end
|
1689
|
+
end
|
1690
|
+
context '--sort=since' do
|
1691
|
+
before do
|
1692
|
+
@cli.options = @cli.options.merge('sort' => 'since')
|
1693
|
+
end
|
1694
|
+
it 'sorts by the time when Twitter acount was created' do
|
1695
|
+
@cli.groupies
|
1696
|
+
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1697
|
+
end
|
1698
|
+
end
|
1699
|
+
context '--sort=tweets' do
|
1700
|
+
before do
|
1701
|
+
@cli.options = @cli.options.merge('sort' => 'tweets')
|
1702
|
+
end
|
1703
|
+
it 'sorts by the number of Tweets' do
|
1704
|
+
@cli.groupies
|
1406
1705
|
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1407
1706
|
end
|
1408
1707
|
end
|
@@ -1411,7 +1710,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1411
1710
|
@cli.options = @cli.options.merge('sort' => 'tweeted')
|
1412
1711
|
end
|
1413
1712
|
it 'sorts by the time of the last Tweet' do
|
1414
|
-
@cli.
|
1713
|
+
@cli.groupies
|
1415
1714
|
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1416
1715
|
end
|
1417
1716
|
end
|
@@ -1420,50 +1719,52 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1420
1719
|
@cli.options = @cli.options.merge('unsorted' => true)
|
1421
1720
|
end
|
1422
1721
|
it 'is not sorted' do
|
1423
|
-
@cli.
|
1722
|
+
@cli.groupies
|
1424
1723
|
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1425
1724
|
end
|
1426
1725
|
end
|
1427
1726
|
context 'with a user passed' do
|
1428
1727
|
before do
|
1429
|
-
stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('
|
1430
|
-
|
1728
|
+
stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('followers_ids.json'))
|
1729
|
+
stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
|
1431
1730
|
end
|
1432
1731
|
it 'requests the correct resource' do
|
1433
|
-
@cli.
|
1732
|
+
@cli.groupies('sferik')
|
1434
1733
|
expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
|
1435
|
-
expect(
|
1734
|
+
expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
|
1735
|
+
expect(a_post('/1.1/users/lookup.json').with(:body => {:user_id => '213747670,428004849'})).to have_been_made
|
1436
1736
|
end
|
1437
1737
|
context '--id' do
|
1438
1738
|
before do
|
1439
1739
|
@cli.options = @cli.options.merge('id' => true)
|
1440
|
-
stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('
|
1740
|
+
stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('followers_ids.json'))
|
1741
|
+
stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('friends_ids.json'))
|
1441
1742
|
end
|
1442
1743
|
it 'requests the correct resource' do
|
1443
|
-
@cli.
|
1744
|
+
@cli.groupies('7505382')
|
1444
1745
|
expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
|
1445
|
-
expect(
|
1746
|
+
expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
|
1747
|
+
expect(a_post('/1.1/users/lookup.json').with(:body => {:user_id => '213747670,428004849'})).to have_been_made
|
1446
1748
|
end
|
1447
1749
|
end
|
1448
1750
|
end
|
1449
1751
|
end
|
1450
1752
|
|
1451
|
-
describe '#
|
1753
|
+
describe '#intersection' do
|
1452
1754
|
before do
|
1453
|
-
|
1755
|
+
@cli.options = @cli.options.merge('type' => 'followings')
|
1756
|
+
stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'testcli'}).to_return(:body => fixture('friends_ids.json'))
|
1454
1757
|
stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
|
1455
|
-
stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
|
1456
1758
|
stub_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'}).to_return(:body => fixture('users.json'))
|
1457
1759
|
end
|
1458
1760
|
it 'requests the correct resource' do
|
1459
|
-
@cli.
|
1460
|
-
expect(a_get('/1.1/
|
1761
|
+
@cli.intersection('sferik')
|
1762
|
+
expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'testcli'})).to have_been_made
|
1461
1763
|
expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
|
1462
|
-
expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
|
1463
1764
|
expect(a_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'})).to have_been_made
|
1464
1765
|
end
|
1465
1766
|
it 'has the correct output' do
|
1466
|
-
@cli.
|
1767
|
+
@cli.intersection('sferik')
|
1467
1768
|
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1468
1769
|
end
|
1469
1770
|
context '--csv' do
|
@@ -1471,7 +1772,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1471
1772
|
@cli.options = @cli.options.merge('csv' => true)
|
1472
1773
|
end
|
1473
1774
|
it 'outputs in CSV format' do
|
1474
|
-
@cli.
|
1775
|
+
@cli.intersection('sferik')
|
1475
1776
|
expect($stdout.string).to eq <<-eos
|
1476
1777
|
ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name,Verified,Protected,Bio,Status,Location,URL
|
1477
1778
|
14100886,2008-03-08 16:34:22 +0000,2012-07-07 20:33:19 +0000,6940,192,358,3427,5457,pengwynn,Wynn Netherland,false,false,"Christian, husband, father, GitHubber, Co-host of @thechangelog, Co-author of Sass, Compass, #CSS book http://wynn.fm/sass-meap",@akosmasoftware Sass book! @hcatlin @nex3 are the brains behind Sass. :-),"Denton, TX",http://wynnnetherland.com
|
@@ -1484,7 +1785,7 @@ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name
|
|
1484
1785
|
@cli.options = @cli.options.merge('long' => true)
|
1485
1786
|
end
|
1486
1787
|
it 'outputs in long format' do
|
1487
|
-
@cli.
|
1788
|
+
@cli.intersection('sferik')
|
1488
1789
|
expect($stdout.string).to eq <<-eos
|
1489
1790
|
ID Since Last tweeted at Tweets Favorites Listed Following...
|
1490
1791
|
14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
|
@@ -1497,7 +1798,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1497
1798
|
@cli.options = @cli.options.merge('reverse' => true)
|
1498
1799
|
end
|
1499
1800
|
it 'reverses the order of the sort' do
|
1500
|
-
@cli.
|
1801
|
+
@cli.intersection('sferik')
|
1501
1802
|
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1502
1803
|
end
|
1503
1804
|
end
|
@@ -1506,7 +1807,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1506
1807
|
@cli.options = @cli.options.merge('sort' => 'favorites')
|
1507
1808
|
end
|
1508
1809
|
it 'sorts by the number of favorites' do
|
1509
|
-
@cli.
|
1810
|
+
@cli.intersection('sferik')
|
1510
1811
|
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1511
1812
|
end
|
1512
1813
|
end
|
@@ -1515,7 +1816,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1515
1816
|
@cli.options = @cli.options.merge('sort' => 'followers')
|
1516
1817
|
end
|
1517
1818
|
it 'sorts by the number of followers' do
|
1518
|
-
@cli.
|
1819
|
+
@cli.intersection('sferik')
|
1519
1820
|
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1520
1821
|
end
|
1521
1822
|
end
|
@@ -1524,7 +1825,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1524
1825
|
@cli.options = @cli.options.merge('sort' => 'friends')
|
1525
1826
|
end
|
1526
1827
|
it 'sorts by the number of friends' do
|
1527
|
-
@cli.
|
1828
|
+
@cli.intersection('sferik')
|
1528
1829
|
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1529
1830
|
end
|
1530
1831
|
end
|
@@ -1533,7 +1834,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1533
1834
|
@cli.options = @cli.options.merge('sort' => 'listed')
|
1534
1835
|
end
|
1535
1836
|
it 'sorts by the number of list memberships' do
|
1536
|
-
@cli.
|
1837
|
+
@cli.intersection('sferik')
|
1537
1838
|
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1538
1839
|
end
|
1539
1840
|
end
|
@@ -1542,7 +1843,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1542
1843
|
@cli.options = @cli.options.merge('sort' => 'since')
|
1543
1844
|
end
|
1544
1845
|
it 'sorts by the time when Twitter acount was created' do
|
1545
|
-
@cli.
|
1846
|
+
@cli.intersection('sferik')
|
1546
1847
|
expect($stdout.string.chomp).to eq 'sferik pengwynn'
|
1547
1848
|
end
|
1548
1849
|
end
|
@@ -1551,7 +1852,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1551
1852
|
@cli.options = @cli.options.merge('sort' => 'tweets')
|
1552
1853
|
end
|
1553
1854
|
it 'sorts by the number of Tweets' do
|
1554
|
-
@cli.
|
1855
|
+
@cli.intersection('sferik')
|
1555
1856
|
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1556
1857
|
end
|
1557
1858
|
end
|
@@ -1560,7 +1861,25 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1560
1861
|
@cli.options = @cli.options.merge('sort' => 'tweeted')
|
1561
1862
|
end
|
1562
1863
|
it 'sorts by the time of the last Tweet' do
|
1563
|
-
@cli.
|
1864
|
+
@cli.intersection('sferik')
|
1865
|
+
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1866
|
+
end
|
1867
|
+
end
|
1868
|
+
context '--type=followers' do
|
1869
|
+
before do
|
1870
|
+
@cli.options = @cli.options.merge('type' => 'followers')
|
1871
|
+
stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'testcli'}).to_return(:body => fixture('followers_ids.json'))
|
1872
|
+
stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('followers_ids.json'))
|
1873
|
+
stub_post('/1.1/users/lookup.json').with(:body => {:user_id => '213747670,428004849'}).to_return(:body => fixture('users.json'))
|
1874
|
+
end
|
1875
|
+
it 'requests the correct resource' do
|
1876
|
+
@cli.intersection('sferik')
|
1877
|
+
expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'testcli'})).to have_been_made
|
1878
|
+
expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
|
1879
|
+
expect(a_post('/1.1/users/lookup.json').with(:body => {:user_id => '213747670,428004849'})).to have_been_made
|
1880
|
+
end
|
1881
|
+
it 'has the correct output' do
|
1882
|
+
@cli.intersection('sferik')
|
1564
1883
|
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1565
1884
|
end
|
1566
1885
|
end
|
@@ -1569,31 +1888,31 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1569
1888
|
@cli.options = @cli.options.merge('unsorted' => true)
|
1570
1889
|
end
|
1571
1890
|
it 'is not sorted' do
|
1572
|
-
@cli.
|
1891
|
+
@cli.intersection('sferik')
|
1573
1892
|
expect($stdout.string.chomp).to eq 'pengwynn sferik'
|
1574
1893
|
end
|
1575
1894
|
end
|
1576
|
-
context 'with
|
1895
|
+
context 'with two users passed' do
|
1577
1896
|
before do
|
1897
|
+
stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'pengwynn'}).to_return(:body => fixture('friends_ids.json'))
|
1578
1898
|
stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
|
1579
|
-
stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
|
1580
1899
|
end
|
1581
1900
|
it 'requests the correct resource' do
|
1582
|
-
@cli.
|
1901
|
+
@cli.intersection('sferik', 'pengwynn')
|
1902
|
+
expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'pengwynn'})).to have_been_made
|
1583
1903
|
expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
|
1584
|
-
expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
|
1585
1904
|
expect(a_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'})).to have_been_made
|
1586
1905
|
end
|
1587
1906
|
context '--id' do
|
1588
1907
|
before do
|
1589
1908
|
@cli.options = @cli.options.merge('id' => true)
|
1909
|
+
stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '14100886'}).to_return(:body => fixture('friends_ids.json'))
|
1590
1910
|
stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('friends_ids.json'))
|
1591
|
-
stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('friends_ids.json'))
|
1592
1911
|
end
|
1593
1912
|
it 'requests the correct resource' do
|
1594
|
-
@cli.
|
1913
|
+
@cli.intersection('7505382', '14100886')
|
1914
|
+
expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '14100886'})).to have_been_made
|
1595
1915
|
expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
|
1596
|
-
expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
|
1597
1916
|
expect(a_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'})).to have_been_made
|
1598
1917
|
end
|
1599
1918
|
end
|
@@ -2203,7 +2522,7 @@ ID Posted at Screen name Text
|
|
2203
2522
|
end
|
2204
2523
|
it 'has the correct output' do
|
2205
2524
|
@cli.report_spam('sferik')
|
2206
|
-
expect($stdout.string).to match
|
2525
|
+
expect($stdout.string).to match(/^@testcli reported 1 user/)
|
2207
2526
|
end
|
2208
2527
|
context '--id' do
|
2209
2528
|
before do
|
@@ -2228,7 +2547,7 @@ ID Posted at Screen name Text
|
|
2228
2547
|
end
|
2229
2548
|
it 'has the correct output' do
|
2230
2549
|
@cli.retweet('26755176471724032')
|
2231
|
-
expect($stdout.string).to match
|
2550
|
+
expect($stdout.string).to match(/^@testcli retweeted 1 tweet.$/)
|
2232
2551
|
end
|
2233
2552
|
end
|
2234
2553
|
|
@@ -2476,6 +2795,223 @@ ID Posted at Screen name Text
|
|
2476
2795
|
end
|
2477
2796
|
end
|
2478
2797
|
|
2798
|
+
describe '#retweets_of_me' do
|
2799
|
+
before do
|
2800
|
+
stub_get('/1.1/statuses/retweets_of_me.json').with(:query => {:count => '20', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
2801
|
+
end
|
2802
|
+
context 'without arguments' do
|
2803
|
+
it 'requests the correct resource' do
|
2804
|
+
@cli.retweets_of_me
|
2805
|
+
expect(a_get('/1.1/statuses/retweets_of_me.json').with(:query => {:count => '20', :include_entities => 'false'})).to have_been_made
|
2806
|
+
end
|
2807
|
+
it 'has the correct output' do
|
2808
|
+
@cli.retweets_of_me
|
2809
|
+
expect($stdout.string).to eq <<-eos
|
2810
|
+
@mutgoff
|
2811
|
+
Happy Birthday @imdane. Watch out for those @rally pranksters!
|
2812
|
+
|
2813
|
+
@ironicsans
|
2814
|
+
If you like good real-life stories, check out @NarrativelyNY's just-launched
|
2815
|
+
site http://t.co/wiUL07jE (and also visit http://t.co/ZoyQxqWA)
|
2816
|
+
|
2817
|
+
@pat_shaughnessy
|
2818
|
+
Something else to vote for: "New Rails workshops to bring more women into the
|
2819
|
+
Boston software scene" http://t.co/eNBuckHc /cc @bostonrb
|
2820
|
+
|
2821
|
+
@calebelston
|
2822
|
+
Pushing the button to launch the site. http://t.co/qLoEn5jG
|
2823
|
+
|
2824
|
+
@calebelston
|
2825
|
+
RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k
|
2826
|
+
|
2827
|
+
@fivethirtyeight
|
2828
|
+
The Weatherman is Not a Moron: http://t.co/ZwL5Gnq5. An excerpt from my book,
|
2829
|
+
THE SIGNAL AND THE NOISE (http://t.co/fNXj8vCE)
|
2830
|
+
|
2831
|
+
@codeforamerica
|
2832
|
+
RT @randomhacks: Going to Code Across Austin II: Y'all Come Hack Now, Sat,
|
2833
|
+
Sep 8 http://t.co/Sk5BM7U3 We'll see y'all there! #rhok @codeforamerica
|
2834
|
+
@TheaClay
|
2835
|
+
|
2836
|
+
@fbjork
|
2837
|
+
RT @jondot: Just published: "Pragmatic Concurrency With #Ruby"
|
2838
|
+
http://t.co/kGEykswZ /cc @JRuby @headius
|
2839
|
+
|
2840
|
+
@mbostock
|
2841
|
+
If you are wondering how we computed the split bubbles: http://t.co/BcaqSs5u
|
2842
|
+
|
2843
|
+
@FakeDorsey
|
2844
|
+
"Write drunk. Edit sober."—Ernest Hemingway
|
2845
|
+
|
2846
|
+
@al3x
|
2847
|
+
RT @wcmaier: Better banking through better ops: build something new with us
|
2848
|
+
@Simplify (remote, PDX) http://t.co/8WgzKZH3
|
2849
|
+
|
2850
|
+
@calebelston
|
2851
|
+
We just announced Mosaic, what we've been working on since the Yobongo
|
2852
|
+
acquisition. My personal post, http://t.co/ELOyIRZU @heymosaic
|
2853
|
+
|
2854
|
+
@BarackObama
|
2855
|
+
Donate $10 or more --> get your favorite car magnet: http://t.co/NfRhl2s2
|
2856
|
+
#Obama2012
|
2857
|
+
|
2858
|
+
@JEG2
|
2859
|
+
RT @tenderlove: If corporations are people, can we use them to drive in the
|
2860
|
+
carpool lane?
|
2861
|
+
|
2862
|
+
@eveningedition
|
2863
|
+
LDN—Obama's nomination; Putin woos APEC; Bombs hit Damascus; Quakes shake
|
2864
|
+
China; Canada cuts Iran ties; weekend read: http://t.co/OFs6dVW4
|
2865
|
+
|
2866
|
+
@dhh
|
2867
|
+
RT @ggreenwald: Democrats parade Osama bin Laden's corpse as their proudest
|
2868
|
+
achievement: why this goulish jingoism is so warped http://t.co/kood278s
|
2869
|
+
|
2870
|
+
@jasonfried
|
2871
|
+
The story of Mars Curiosity's gears, made by a factory in Rockford, IL:
|
2872
|
+
http://t.co/MwCRsHQg
|
2873
|
+
|
2874
|
+
@sferik
|
2875
|
+
@episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem
|
2876
|
+
to be missing "1.1" from the URL.
|
2877
|
+
|
2878
|
+
@sferik
|
2879
|
+
@episod @twitterapi Did you catch https://t.co/VHsQvZT0 as well?
|
2880
|
+
|
2881
|
+
@dwiskus
|
2882
|
+
Gentlemen, you can't fight in here! This is the war room!
|
2883
|
+
http://t.co/kMxMYyqF
|
2884
|
+
|
2885
|
+
eos
|
2886
|
+
end
|
2887
|
+
end
|
2888
|
+
context '--csv' do
|
2889
|
+
before do
|
2890
|
+
@cli.options = @cli.options.merge('csv' => true)
|
2891
|
+
end
|
2892
|
+
it 'outputs in CSV format' do
|
2893
|
+
@cli.retweets_of_me
|
2894
|
+
expect($stdout.string).to eq <<-eos
|
2895
|
+
ID,Posted at,Screen name,Text
|
2896
|
+
4611686018427387904,2012-09-07 16:35:24 +0000,mutgoff,Happy Birthday @imdane. Watch out for those @rally pranksters!
|
2897
|
+
244111183165157376,2012-09-07 16:33:36 +0000,ironicsans,"If you like good real-life stories, check out @NarrativelyNY's just-launched site http://t.co/wiUL07jE (and also visit http://t.co/ZoyQxqWA)"
|
2898
|
+
244110336414859264,2012-09-07 16:30:14 +0000,pat_shaughnessy,"Something else to vote for: ""New Rails workshops to bring more women into the Boston software scene"" http://t.co/eNBuckHc /cc @bostonrb"
|
2899
|
+
244109797308379136,2012-09-07 16:28:05 +0000,calebelston,Pushing the button to launch the site. http://t.co/qLoEn5jG
|
2900
|
+
244108728834592770,2012-09-07 16:23:50 +0000,calebelston,RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k
|
2901
|
+
244107890632294400,2012-09-07 16:20:31 +0000,fivethirtyeight,"The Weatherman is Not a Moron: http://t.co/ZwL5Gnq5. An excerpt from my book, THE SIGNAL AND THE NOISE (http://t.co/fNXj8vCE)"
|
2902
|
+
244107823733174272,2012-09-07 16:20:15 +0000,codeforamerica,"RT @randomhacks: Going to Code Across Austin II: Y'all Come Hack Now, Sat, Sep 8 http://t.co/Sk5BM7U3 We'll see y'all there! #rhok @codeforamerica @TheaClay"
|
2903
|
+
244107236262170624,2012-09-07 16:17:55 +0000,fbjork,"RT @jondot: Just published: ""Pragmatic Concurrency With #Ruby"" http://t.co/kGEykswZ /cc @JRuby @headius"
|
2904
|
+
244106476048764928,2012-09-07 16:14:53 +0000,mbostock,If you are wondering how we computed the split bubbles: http://t.co/BcaqSs5u
|
2905
|
+
244105599351148544,2012-09-07 16:11:24 +0000,FakeDorsey,"""Write drunk. Edit sober.""—Ernest Hemingway"
|
2906
|
+
244104558433951744,2012-09-07 16:07:16 +0000,al3x,"RT @wcmaier: Better banking through better ops: build something new with us @Simplify (remote, PDX) http://t.co/8WgzKZH3"
|
2907
|
+
244104146997870594,2012-09-07 16:05:38 +0000,calebelston,"We just announced Mosaic, what we've been working on since the Yobongo acquisition. My personal post, http://t.co/ELOyIRZU @heymosaic"
|
2908
|
+
244103057175113729,2012-09-07 16:01:18 +0000,BarackObama,Donate $10 or more --> get your favorite car magnet: http://t.co/NfRhl2s2 #Obama2012
|
2909
|
+
244102834398851073,2012-09-07 16:00:25 +0000,JEG2,"RT @tenderlove: If corporations are people, can we use them to drive in the carpool lane?"
|
2910
|
+
244102741125890048,2012-09-07 16:00:03 +0000,eveningedition,LDN—Obama's nomination; Putin woos APEC; Bombs hit Damascus; Quakes shake China; Canada cuts Iran ties; weekend read: http://t.co/OFs6dVW4
|
2911
|
+
244102729860009984,2012-09-07 16:00:00 +0000,dhh,RT @ggreenwald: Democrats parade Osama bin Laden's corpse as their proudest achievement: why this goulish jingoism is so warped http://t.co/kood278s
|
2912
|
+
244102490646278146,2012-09-07 15:59:03 +0000,jasonfried,"The story of Mars Curiosity's gears, made by a factory in Rockford, IL: http://t.co/MwCRsHQg"
|
2913
|
+
244102209942458368,2012-09-07 15:57:56 +0000,sferik,"@episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem to be missing ""1.1"" from the URL."
|
2914
|
+
244100411563339777,2012-09-07 15:50:47 +0000,sferik,@episod @twitterapi Did you catch https://t.co/VHsQvZT0 as well?
|
2915
|
+
244099460672679938,2012-09-07 15:47:01 +0000,dwiskus,"Gentlemen, you can't fight in here! This is the war room! http://t.co/kMxMYyqF"
|
2916
|
+
eos
|
2917
|
+
end
|
2918
|
+
end
|
2919
|
+
context '--decode-uris' do
|
2920
|
+
before do
|
2921
|
+
@cli.options = @cli.options.merge('decode_uris' => true)
|
2922
|
+
stub_get('/1.1/statuses/retweets_of_me.json').with(:query => {:count => '20', :include_entities => 'true'}).to_return(:body => fixture('statuses.json'))
|
2923
|
+
end
|
2924
|
+
it 'requests the correct resource' do
|
2925
|
+
@cli.retweets_of_me
|
2926
|
+
expect(a_get('/1.1/statuses/retweets_of_me.json').with(:query => {:count => '20', :include_entities => 'true'})).to have_been_made
|
2927
|
+
end
|
2928
|
+
end
|
2929
|
+
context '--long' do
|
2930
|
+
before do
|
2931
|
+
@cli.options = @cli.options.merge('long' => true)
|
2932
|
+
end
|
2933
|
+
it 'outputs in long format' do
|
2934
|
+
@cli.retweets_of_me
|
2935
|
+
expect($stdout.string).to eq <<-eos
|
2936
|
+
ID Posted at Screen name Text
|
2937
|
+
4611686018427387904 Sep 7 08:35 @mutgoff Happy Birthday @imdane. ...
|
2938
|
+
244111183165157376 Sep 7 08:33 @ironicsans If you like good real-li...
|
2939
|
+
244110336414859264 Sep 7 08:30 @pat_shaughnessy Something else to vote f...
|
2940
|
+
244109797308379136 Sep 7 08:28 @calebelston Pushing the button to la...
|
2941
|
+
244108728834592770 Sep 7 08:23 @calebelston RT @olivercameron: Mosai...
|
2942
|
+
244107890632294400 Sep 7 08:20 @fivethirtyeight The Weatherman is Not a ...
|
2943
|
+
244107823733174272 Sep 7 08:20 @codeforamerica RT @randomhacks: Going t...
|
2944
|
+
244107236262170624 Sep 7 08:17 @fbjork RT @jondot: Just publish...
|
2945
|
+
244106476048764928 Sep 7 08:14 @mbostock If you are wondering how...
|
2946
|
+
244105599351148544 Sep 7 08:11 @FakeDorsey "Write drunk. Edit sober...
|
2947
|
+
244104558433951744 Sep 7 08:07 @al3x RT @wcmaier: Better bank...
|
2948
|
+
244104146997870594 Sep 7 08:05 @calebelston We just announced Mosaic...
|
2949
|
+
244103057175113729 Sep 7 08:01 @BarackObama Donate $10 or more --> g...
|
2950
|
+
244102834398851073 Sep 7 08:00 @JEG2 RT @tenderlove: If corpo...
|
2951
|
+
244102741125890048 Sep 7 08:00 @eveningedition LDN—Obama's nomination; ...
|
2952
|
+
244102729860009984 Sep 7 08:00 @dhh RT @ggreenwald: Democrat...
|
2953
|
+
244102490646278146 Sep 7 07:59 @jasonfried The story of Mars Curios...
|
2954
|
+
244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now ...
|
2955
|
+
244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did ...
|
2956
|
+
244099460672679938 Sep 7 07:47 @dwiskus Gentlemen, you can't fig...
|
2957
|
+
eos
|
2958
|
+
end
|
2959
|
+
context '--reverse' do
|
2960
|
+
before do
|
2961
|
+
@cli.options = @cli.options.merge('reverse' => true)
|
2962
|
+
end
|
2963
|
+
it 'reverses the order of the sort' do
|
2964
|
+
@cli.retweets_of_me
|
2965
|
+
expect($stdout.string).to eq <<-eos
|
2966
|
+
ID Posted at Screen name Text
|
2967
|
+
244099460672679938 Sep 7 07:47 @dwiskus Gentlemen, you can't fig...
|
2968
|
+
244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did ...
|
2969
|
+
244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now ...
|
2970
|
+
244102490646278146 Sep 7 07:59 @jasonfried The story of Mars Curios...
|
2971
|
+
244102729860009984 Sep 7 08:00 @dhh RT @ggreenwald: Democrat...
|
2972
|
+
244102741125890048 Sep 7 08:00 @eveningedition LDN—Obama's nomination; ...
|
2973
|
+
244102834398851073 Sep 7 08:00 @JEG2 RT @tenderlove: If corpo...
|
2974
|
+
244103057175113729 Sep 7 08:01 @BarackObama Donate $10 or more --> g...
|
2975
|
+
244104146997870594 Sep 7 08:05 @calebelston We just announced Mosaic...
|
2976
|
+
244104558433951744 Sep 7 08:07 @al3x RT @wcmaier: Better bank...
|
2977
|
+
244105599351148544 Sep 7 08:11 @FakeDorsey "Write drunk. Edit sober...
|
2978
|
+
244106476048764928 Sep 7 08:14 @mbostock If you are wondering how...
|
2979
|
+
244107236262170624 Sep 7 08:17 @fbjork RT @jondot: Just publish...
|
2980
|
+
244107823733174272 Sep 7 08:20 @codeforamerica RT @randomhacks: Going t...
|
2981
|
+
244107890632294400 Sep 7 08:20 @fivethirtyeight The Weatherman is Not a ...
|
2982
|
+
244108728834592770 Sep 7 08:23 @calebelston RT @olivercameron: Mosai...
|
2983
|
+
244109797308379136 Sep 7 08:28 @calebelston Pushing the button to la...
|
2984
|
+
244110336414859264 Sep 7 08:30 @pat_shaughnessy Something else to vote f...
|
2985
|
+
244111183165157376 Sep 7 08:33 @ironicsans If you like good real-li...
|
2986
|
+
4611686018427387904 Sep 7 08:35 @mutgoff Happy Birthday @imdane. ...
|
2987
|
+
eos
|
2988
|
+
end
|
2989
|
+
end
|
2990
|
+
end
|
2991
|
+
context '--number' do
|
2992
|
+
before do
|
2993
|
+
stub_get('/1.1/statuses/retweets_of_me.json').with(:query => {:count => '1', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
2994
|
+
stub_get('/1.1/statuses/retweets_of_me.json').with(:query => {:count => '200', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
2995
|
+
(1..181).step(20) do |count|
|
2996
|
+
stub_get('/1.1/statuses/retweets_of_me.json').with(:query => {:count => count, :max_id => '244099460672679937', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
2997
|
+
end
|
2998
|
+
end
|
2999
|
+
it 'limits the number of results to 1' do
|
3000
|
+
@cli.options = @cli.options.merge('number' => 1)
|
3001
|
+
@cli.retweets_of_me
|
3002
|
+
expect(a_get('/1.1/statuses/retweets_of_me.json').with(:query => {:count => '1', :include_entities => 'false'})).to have_been_made
|
3003
|
+
end
|
3004
|
+
it 'limits the number of results to 201' do
|
3005
|
+
@cli.options = @cli.options.merge('number' => 201)
|
3006
|
+
@cli.retweets_of_me
|
3007
|
+
expect(a_get('/1.1/statuses/retweets_of_me.json').with(:query => {:count => '200', :include_entities => 'false'})).to have_been_made
|
3008
|
+
(1..181).step(20) do |count|
|
3009
|
+
expect(a_get('/1.1/statuses/retweets_of_me.json').with(:query => {:count => count, :max_id => '244099460672679937', :include_entities => 'false'})).to have_been_made
|
3010
|
+
end
|
3011
|
+
end
|
3012
|
+
end
|
3013
|
+
end
|
3014
|
+
|
2479
3015
|
describe '#ruler' do
|
2480
3016
|
it 'has the correct output' do
|
2481
3017
|
@cli.ruler
|
@@ -3162,7 +3698,7 @@ WOEID Parent ID Type Name Country
|
|
3162
3698
|
end
|
3163
3699
|
it 'sorts by the country name' do
|
3164
3700
|
@cli.trend_locations
|
3165
|
-
expect($stdout.string.chomp).to
|
3701
|
+
expect($stdout.string.chomp).to eq 'Worldwide Soweto San Francisco United States'
|
3166
3702
|
end
|
3167
3703
|
end
|
3168
3704
|
context '--sort=parent' do
|
@@ -3216,7 +3752,7 @@ WOEID Parent ID Type Name Country
|
|
3216
3752
|
it 'has the correct output' do
|
3217
3753
|
stub_post('/1.1/friendships/destroy.json').with(:body => {:screen_name => 'sferik'}).to_return(:body => fixture('sferik.json'))
|
3218
3754
|
@cli.unfollow('sferik')
|
3219
|
-
expect($stdout.string).to match
|
3755
|
+
expect($stdout.string).to match(/^@testcli is no longer following 1 user\.$/)
|
3220
3756
|
end
|
3221
3757
|
context '--id' do
|
3222
3758
|
before do
|