t 0.9.9 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/t/version.rb CHANGED
@@ -3,17 +3,17 @@ module T
3
3
 
4
4
  # @return [Integer]
5
5
  def self.major
6
- 0
6
+ 1
7
7
  end
8
8
 
9
9
  # @return [Integer]
10
10
  def self.minor
11
- 9
11
+ 0
12
12
  end
13
13
 
14
14
  # @return [Integer]
15
15
  def self.patch
16
- 9
16
+ 0
17
17
  end
18
18
 
19
19
  # @return [String, NilClass]
data/spec/cli_spec.rb CHANGED
@@ -13,9 +13,8 @@ describe T::CLI do
13
13
  Timecop.return
14
14
  end
15
15
 
16
- before do
17
- rcfile = RCFile.instance
18
- rcfile.path = fixture_path + "/.trc"
16
+ before :each do
17
+ T::RCFile.instance.path = fixture_path + "/.trc"
19
18
  @cli = T::CLI.new
20
19
  @old_stderr = $stderr
21
20
  $stderr = StringIO.new
@@ -23,7 +22,8 @@ describe T::CLI do
23
22
  $stdout = StringIO.new
24
23
  end
25
24
 
26
- after do
25
+ after :each do
26
+ T::RCFile.instance.reset
27
27
  $stderr = @old_stderr
28
28
  $stdout = @old_stdout
29
29
  end
@@ -43,7 +43,7 @@ testcli
43
43
 
44
44
  describe "#authorize" do
45
45
  before do
46
- @cli.options = @cli.options.merge("profile" => project_path + "/tmp/trc", "consumer-key" => "abc123", "consumer-secret" => "asdfasd223sd2", "prompt" => true, "display-url" => true)
46
+ @cli.options = @cli.options.merge("profile" => project_path + "/tmp/authorize", "display-url" => true)
47
47
  stub_post("/oauth/request_token").
48
48
  to_return(:body => fixture("request_token"))
49
49
  stub_post("/oauth/access_token").
@@ -52,9 +52,15 @@ testcli
52
52
  to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
53
53
  end
54
54
  it "should request the correct resource" do
55
+ $stdout.should_receive(:print)
56
+ $stdin.should_receive(:gets).and_return("\n")
57
+ $stdout.should_receive(:print).with("Enter your consumer key: ")
58
+ $stdin.should_receive(:gets).and_return("abc123")
59
+ $stdout.should_receive(:print).with("Enter your consumer secret: ")
60
+ $stdin.should_receive(:gets).and_return("asdfasd223sd2")
55
61
  $stdout.should_receive(:print).with("Press [Enter] to open the Twitter app authorization page. ")
56
62
  $stdin.should_receive(:gets).and_return("\n")
57
- $stdout.should_receive(:print).with("Paste in the supplied PIN: ")
63
+ $stdout.should_receive(:print).with("Enter the supplied PIN: ")
58
64
  $stdin.should_receive(:gets).and_return("1234567890")
59
65
  @cli.authorize
60
66
  a_post("/oauth/request_token").
@@ -66,9 +72,15 @@ testcli
66
72
  end
67
73
  it "should not raise error" do
68
74
  lambda do
75
+ $stdout.should_receive(:print)
76
+ $stdin.should_receive(:gets).and_return("\n")
77
+ $stdout.should_receive(:print).with("Enter your consumer key: ")
78
+ $stdin.should_receive(:gets).and_return("abc123")
79
+ $stdout.should_receive(:print).with("Enter your consumer secret: ")
80
+ $stdin.should_receive(:gets).and_return("asdfasd223sd2")
69
81
  $stdout.should_receive(:print).with("Press [Enter] to open the Twitter app authorization page. ")
70
82
  $stdin.should_receive(:gets).and_return("\n")
71
- $stdout.should_receive(:print).with("Paste in the supplied PIN: ")
83
+ $stdout.should_receive(:print).with("Enter the supplied PIN: ")
72
84
  $stdin.should_receive(:gets).and_return("1234567890")
73
85
  @cli.authorize
74
86
  end.should_not raise_error
@@ -126,16 +138,42 @@ testcli
126
138
  it "should have the correct output" do
127
139
  @cli.direct_messages
128
140
  $stdout.string.should == <<-eos
129
- sferik: Sounds good. Meeting Tuesday is fine. (a year ago)
130
- sferik: That's great news! Let's plan to chat around 8 AM tomorrow Pacific time. Does that work for you? (a year ago)
131
- sferik: I asked Yehuda about the stipend. I believe it has already been sent. Glad you're feeling better. (a year ago)
132
- sferik: Just checking in. How's everything going? (a year ago)
133
- 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? (a year ago)
134
- sferik: How are the graph enhancements coming? (a year ago)
135
- sferik: How are the graphs coming? I'm really looking forward to seeing what you do with Raphaël. (a year ago)
136
- sferik: Awesome! Any luck duplicating the Gemfile.lock error with Ruby 1.9.2 final? (a year ago)
137
- sferik: I just committed a bunch of cleanup and fixes to RailsAdmin that touched many of files. Make sure you pull to avoid conflicts. (a year ago)
138
- 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? (a year ago)
141
+ \e[1m\e[33m @sferik\e[0m
142
+ Sounds good. Meeting Tuesday is fine.
143
+
144
+ \e[1m\e[33m @sferik\e[0m
145
+ That's great news! Let's plan to chat around 8 AM tomorrow Pacific time. Does
146
+ that work for you?
147
+
148
+ \e[1m\e[33m @sferik\e[0m
149
+ I asked Yehuda about the stipend. I believe it has already been sent. Glad
150
+ you're feeling better.
151
+
152
+ \e[1m\e[33m @sferik\e[0m
153
+ Just checking in. How's everything going?
154
+
155
+ \e[1m\e[33m @sferik\e[0m
156
+ Not sure about the payment. Feel free to ask Leah or Yehuda directly. Think
157
+ you'll be able to finish up your work on graphs this weekend?
158
+
159
+ \e[1m\e[33m @sferik\e[0m
160
+ How are the graph enhancements coming?
161
+
162
+ \e[1m\e[33m @sferik\e[0m
163
+ How are the graphs coming? I'm really looking forward to seeing what you do
164
+ with Raphaël.
165
+
166
+ \e[1m\e[33m @sferik\e[0m
167
+ Awesome! Any luck duplicating the Gemfile.lock error with Ruby 1.9.2 final?
168
+
169
+ \e[1m\e[33m @sferik\e[0m
170
+ I just committed a bunch of cleanup and fixes to RailsAdmin that touched many
171
+ of files. Make sure you pull to avoid conflicts.
172
+
173
+ \e[1m\e[33m @sferik\e[0m
174
+ I'm trying to debug the issue you were having with the Bundler Gemfile.lock
175
+ shortref. What version of Ruby and RubyGems are you running?
176
+
139
177
  eos
140
178
  end
141
179
  context "--csv" do
@@ -227,16 +265,42 @@ ID Posted at Screen name Text
227
265
  it "should reverse the order of the sort" do
228
266
  @cli.direct_messages
229
267
  $stdout.string.should == <<-eos
230
- 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? (a year ago)
231
- sferik: I just committed a bunch of cleanup and fixes to RailsAdmin that touched many of files. Make sure you pull to avoid conflicts. (a year ago)
232
- sferik: Awesome! Any luck duplicating the Gemfile.lock error with Ruby 1.9.2 final? (a year ago)
233
- sferik: How are the graphs coming? I'm really looking forward to seeing what you do with Raphaël. (a year ago)
234
- sferik: How are the graph enhancements coming? (a year ago)
235
- 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? (a year ago)
236
- sferik: Just checking in. How's everything going? (a year ago)
237
- sferik: I asked Yehuda about the stipend. I believe it has already been sent. Glad you're feeling better. (a year ago)
238
- sferik: That's great news! Let's plan to chat around 8 AM tomorrow Pacific time. Does that work for you? (a year ago)
239
- sferik: Sounds good. Meeting Tuesday is fine. (a year ago)
268
+ \e[1m\e[33m @sferik\e[0m
269
+ I'm trying to debug the issue you were having with the Bundler Gemfile.lock
270
+ shortref. What version of Ruby and RubyGems are you running?
271
+
272
+ \e[1m\e[33m @sferik\e[0m
273
+ I just committed a bunch of cleanup and fixes to RailsAdmin that touched many
274
+ of files. Make sure you pull to avoid conflicts.
275
+
276
+ \e[1m\e[33m @sferik\e[0m
277
+ Awesome! Any luck duplicating the Gemfile.lock error with Ruby 1.9.2 final?
278
+
279
+ \e[1m\e[33m @sferik\e[0m
280
+ How are the graphs coming? I'm really looking forward to seeing what you do
281
+ with Raphaël.
282
+
283
+ \e[1m\e[33m @sferik\e[0m
284
+ How are the graph enhancements coming?
285
+
286
+ \e[1m\e[33m @sferik\e[0m
287
+ Not sure about the payment. Feel free to ask Leah or Yehuda directly. Think
288
+ you'll be able to finish up your work on graphs this weekend?
289
+
290
+ \e[1m\e[33m @sferik\e[0m
291
+ Just checking in. How's everything going?
292
+
293
+ \e[1m\e[33m @sferik\e[0m
294
+ I asked Yehuda about the stipend. I believe it has already been sent. Glad
295
+ you're feeling better.
296
+
297
+ \e[1m\e[33m @sferik\e[0m
298
+ That's great news! Let's plan to chat around 8 AM tomorrow Pacific time. Does
299
+ that work for you?
300
+
301
+ \e[1m\e[33m @sferik\e[0m
302
+ Sounds good. Meeting Tuesday is fine.
303
+
240
304
  eos
241
305
  end
242
306
  end
@@ -260,16 +324,42 @@ ID Posted at Screen name Text
260
324
  it "should have the correct output" do
261
325
  @cli.direct_messages_sent
262
326
  $stdout.string.should == <<-eos
263
- hurrycane: Sounds good. Meeting Tuesday is fine. (a year ago)
264
- hurrycane: That's great news! Let's plan to chat around 8 AM tomorrow Pacific time. Does that work for you? (a year ago)
265
- hurrycane: I asked Yehuda about the stipend. I believe it has already been sent. Glad you're feeling better. (a year ago)
266
- hurrycane: Just checking in. How's everything going? (a year ago)
267
- 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? (a year ago)
268
- hurrycane: How are the graph enhancements coming? (a year ago)
269
- hurrycane: How are the graphs coming? I'm really looking forward to seeing what you do with Raphaël. (a year ago)
270
- hurrycane: Awesome! Any luck duplicating the Gemfile.lock error with Ruby 1.9.2 final? (a year ago)
271
- hurrycane: I just committed a bunch of cleanup and fixes to RailsAdmin that touched many of files. Make sure you pull to avoid conflicts. (a year ago)
272
- 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? (a year ago)
327
+ \e[1m\e[33m @hurrycane\e[0m
328
+ Sounds good. Meeting Tuesday is fine.
329
+
330
+ \e[1m\e[33m @hurrycane\e[0m
331
+ That's great news! Let's plan to chat around 8 AM tomorrow Pacific time. Does
332
+ that work for you?
333
+
334
+ \e[1m\e[33m @hurrycane\e[0m
335
+ I asked Yehuda about the stipend. I believe it has already been sent. Glad
336
+ you're feeling better.
337
+
338
+ \e[1m\e[33m @hurrycane\e[0m
339
+ Just checking in. How's everything going?
340
+
341
+ \e[1m\e[33m @hurrycane\e[0m
342
+ Not sure about the payment. Feel free to ask Leah or Yehuda directly. Think
343
+ you'll be able to finish up your work on graphs this weekend?
344
+
345
+ \e[1m\e[33m @hurrycane\e[0m
346
+ How are the graph enhancements coming?
347
+
348
+ \e[1m\e[33m @hurrycane\e[0m
349
+ How are the graphs coming? I'm really looking forward to seeing what you do
350
+ with Raphaël.
351
+
352
+ \e[1m\e[33m @hurrycane\e[0m
353
+ Awesome! Any luck duplicating the Gemfile.lock error with Ruby 1.9.2 final?
354
+
355
+ \e[1m\e[33m @hurrycane\e[0m
356
+ I just committed a bunch of cleanup and fixes to RailsAdmin that touched many
357
+ of files. Make sure you pull to avoid conflicts.
358
+
359
+ \e[1m\e[33m @hurrycane\e[0m
360
+ I'm trying to debug the issue you were having with the Bundler Gemfile.lock
361
+ shortref. What version of Ruby and RubyGems are you running?
362
+
273
363
  eos
274
364
  end
275
365
  context "--csv" do
@@ -361,16 +451,42 @@ ID Posted at Screen name Text
361
451
  it "should reverse the order of the sort" do
362
452
  @cli.direct_messages_sent
363
453
  $stdout.string.should == <<-eos
364
- 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? (a year ago)
365
- hurrycane: I just committed a bunch of cleanup and fixes to RailsAdmin that touched many of files. Make sure you pull to avoid conflicts. (a year ago)
366
- hurrycane: Awesome! Any luck duplicating the Gemfile.lock error with Ruby 1.9.2 final? (a year ago)
367
- hurrycane: How are the graphs coming? I'm really looking forward to seeing what you do with Raphaël. (a year ago)
368
- hurrycane: How are the graph enhancements coming? (a year ago)
369
- 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? (a year ago)
370
- hurrycane: Just checking in. How's everything going? (a year ago)
371
- hurrycane: I asked Yehuda about the stipend. I believe it has already been sent. Glad you're feeling better. (a year ago)
372
- hurrycane: That's great news! Let's plan to chat around 8 AM tomorrow Pacific time. Does that work for you? (a year ago)
373
- hurrycane: Sounds good. Meeting Tuesday is fine. (a year ago)
454
+ \e[1m\e[33m @hurrycane\e[0m
455
+ I'm trying to debug the issue you were having with the Bundler Gemfile.lock
456
+ shortref. What version of Ruby and RubyGems are you running?
457
+
458
+ \e[1m\e[33m @hurrycane\e[0m
459
+ I just committed a bunch of cleanup and fixes to RailsAdmin that touched many
460
+ of files. Make sure you pull to avoid conflicts.
461
+
462
+ \e[1m\e[33m @hurrycane\e[0m
463
+ Awesome! Any luck duplicating the Gemfile.lock error with Ruby 1.9.2 final?
464
+
465
+ \e[1m\e[33m @hurrycane\e[0m
466
+ How are the graphs coming? I'm really looking forward to seeing what you do
467
+ with Raphaël.
468
+
469
+ \e[1m\e[33m @hurrycane\e[0m
470
+ How are the graph enhancements coming?
471
+
472
+ \e[1m\e[33m @hurrycane\e[0m
473
+ Not sure about the payment. Feel free to ask Leah or Yehuda directly. Think
474
+ you'll be able to finish up your work on graphs this weekend?
475
+
476
+ \e[1m\e[33m @hurrycane\e[0m
477
+ Just checking in. How's everything going?
478
+
479
+ \e[1m\e[33m @hurrycane\e[0m
480
+ I asked Yehuda about the stipend. I believe it has already been sent. Glad
481
+ you're feeling better.
482
+
483
+ \e[1m\e[33m @hurrycane\e[0m
484
+ That's great news! Let's plan to chat around 8 AM tomorrow Pacific time. Does
485
+ that work for you?
486
+
487
+ \e[1m\e[33m @hurrycane\e[0m
488
+ Sounds good. Meeting Tuesday is fine.
489
+
374
490
  eos
375
491
  end
376
492
  end
@@ -402,7 +518,7 @@ ID Posted at Screen name Text
402
518
  end
403
519
  it "should have the correct output" do
404
520
  @cli.groupies
405
- $stdout.string.rstrip.should == "pengwynn sferik"
521
+ $stdout.string.chomp.should == "pengwynn sferik"
406
522
  end
407
523
  context "--csv" do
408
524
  before do
@@ -411,86 +527,95 @@ ID Posted at Screen name Text
411
527
  it "should output in CSV format" do
412
528
  @cli.groupies
413
529
  $stdout.string.should == <<-eos
414
- ID,Since,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
415
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
416
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
530
+ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
531
+ 14100886,2008-03-08 16:34:22 +0000,2012-07-07 20:33:19 +0000,6940,192,358,3427,5457,pengwynn,Wynn Netherland
532
+ 7505382,2007-07-16 12:59:01 +0000,2012-07-08 18:29:20 +0000,7890,3755,118,212,2262,sferik,Erik Michaels-Ober
417
533
  eos
418
534
  end
419
535
  end
420
- context "--favorites" do
536
+ context "--long" do
421
537
  before do
422
- @cli.options = @cli.options.merge("favorites" => true)
538
+ @cli.options = @cli.options.merge("long" => true)
423
539
  end
424
- it "should sort by number of favorites" do
540
+ it "should output in long format" do
425
541
  @cli.groupies
426
- $stdout.string.rstrip.should == "pengwynn sferik"
542
+ $stdout.string.should == <<-eos
543
+ ID Since Last tweeted at Tweets Favorites Listed Following...
544
+ 14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
545
+ 7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
546
+ eos
427
547
  end
428
548
  end
429
- context "--followers" do
549
+ context "--reverse" do
430
550
  before do
431
- @cli.options = @cli.options.merge("followers" => true)
551
+ @cli.options = @cli.options.merge("reverse" => true)
432
552
  end
433
- it "should sort by number of followers" do
553
+ it "should reverse the order of the sort" do
434
554
  @cli.groupies
435
- $stdout.string.rstrip.should == "sferik pengwynn"
555
+ $stdout.string.chomp.should == "sferik pengwynn"
436
556
  end
437
557
  end
438
- context "--friends" do
558
+ context "--sort=favorites" do
439
559
  before do
440
- @cli.options = @cli.options.merge("friends" => true)
560
+ @cli.options = @cli.options.merge("sort" => "favorites")
441
561
  end
442
- it "should sort by number of friends" do
562
+ it "should sort by number of favorites" do
443
563
  @cli.groupies
444
- $stdout.string.rstrip.should == "sferik pengwynn"
564
+ $stdout.string.chomp.should == "pengwynn sferik"
445
565
  end
446
566
  end
447
- context "--listed" do
567
+ context "--sort=followers" do
448
568
  before do
449
- @cli.options = @cli.options.merge("listed" => true)
569
+ @cli.options = @cli.options.merge("sort" => "followers")
450
570
  end
451
- it "should sort by number of list memberships" do
571
+ it "should sort by number of followers" do
452
572
  @cli.groupies
453
- $stdout.string.rstrip.should == "sferik pengwynn"
573
+ $stdout.string.chomp.should == "sferik pengwynn"
454
574
  end
455
575
  end
456
- context "--long" do
576
+ context "--sort=friends" do
457
577
  before do
458
- @cli.options = @cli.options.merge("long" => true)
578
+ @cli.options = @cli.options.merge("sort" => "friends")
459
579
  end
460
- it "should output in long format" do
580
+ it "should sort by number of friends" do
461
581
  @cli.groupies
462
- $stdout.string.should == <<-eos
463
- ID Since Tweets Favorites Listed Following Followers Scre...
464
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
465
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
466
- eos
582
+ $stdout.string.chomp.should == "sferik pengwynn"
467
583
  end
468
584
  end
469
- context "--posted" do
585
+ context "--sort=listed" do
470
586
  before do
471
- @cli.options = @cli.options.merge("posted" => true)
587
+ @cli.options = @cli.options.merge("sort" => "listed")
472
588
  end
473
- it "should sort by the time when Twitter acount was created" do
589
+ it "should sort by number of list memberships" do
474
590
  @cli.groupies
475
- $stdout.string.rstrip.should == "sferik pengwynn"
591
+ $stdout.string.chomp.should == "sferik pengwynn"
476
592
  end
477
593
  end
478
- context "--reverse" do
594
+ context "--sort=since" do
479
595
  before do
480
- @cli.options = @cli.options.merge("reverse" => true)
596
+ @cli.options = @cli.options.merge("sort" => "since")
481
597
  end
482
- it "should reverse the order of the sort" do
598
+ it "should sort by the time when Twitter acount was created" do
483
599
  @cli.groupies
484
- $stdout.string.rstrip.should == "sferik pengwynn"
600
+ $stdout.string.chomp.should == "sferik pengwynn"
485
601
  end
486
602
  end
487
- context "--tweets" do
603
+ context "--sort=tweets" do
488
604
  before do
489
- @cli.options = @cli.options.merge("tweets" => true)
605
+ @cli.options = @cli.options.merge("sort" => "tweets")
490
606
  end
491
607
  it "should sort by number of Tweets" do
492
608
  @cli.groupies
493
- $stdout.string.rstrip.should == "sferik pengwynn"
609
+ $stdout.string.chomp.should == "pengwynn sferik"
610
+ end
611
+ end
612
+ context "--sort=tweeted" do
613
+ before do
614
+ @cli.options = @cli.options.merge("sort" => "tweeted")
615
+ end
616
+ it "should sort by the time of the last Tweet" do
617
+ @cli.groupies
618
+ $stdout.string.chomp.should == "pengwynn sferik"
494
619
  end
495
620
  end
496
621
  context "--unsorted" do
@@ -499,7 +624,7 @@ ID Since Tweets Favorites Listed Following Followers Scre...
499
624
  end
500
625
  it "should not be sorted" do
501
626
  @cli.groupies
502
- $stdout.string.rstrip.should == "sferik pengwynn"
627
+ $stdout.string.chomp.should == "pengwynn sferik"
503
628
  end
504
629
  end
505
630
  context "with a user passed" do
@@ -564,7 +689,7 @@ ID Since Tweets Favorites Listed Following Followers Scre...
564
689
  end
565
690
  it "should have the correct output" do
566
691
  @cli.dm("pengwynn", "Creating a fixture for the Twitter gem")
567
- $stdout.string.chomp.should == "Direct Message sent from @testcli to @pengwynn (a year ago)."
692
+ $stdout.string.chomp.should == "Direct Message sent from @testcli to @pengwynn."
568
693
  end
569
694
  context "--id" do
570
695
  before do
@@ -597,7 +722,7 @@ ID Since Tweets Favorites Listed Following Followers Scre...
597
722
  end
598
723
  it "should have the correct output" do
599
724
  @cli.does_contain("presidents")
600
- $stdout.string.chomp.should == "Yes, @testcli/presidents contains @testcli."
725
+ $stdout.string.chomp.should == "Yes, presidents contains @testcli."
601
726
  end
602
727
  context "--id" do
603
728
  before do
@@ -622,7 +747,7 @@ ID Since Tweets Favorites Listed Following Followers Scre...
622
747
  context "with an owner passed" do
623
748
  it "should have the correct output" do
624
749
  @cli.does_contain("testcli/presidents", "testcli")
625
- $stdout.string.chomp.should == "Yes, @testcli/presidents contains @testcli."
750
+ $stdout.string.chomp.should == "Yes, presidents contains @testcli."
626
751
  end
627
752
  context "--id" do
628
753
  before do
@@ -631,16 +756,16 @@ ID Since Tweets Favorites Listed Following Followers Scre...
631
756
  with(:query => {:user_id => "7505382"}).
632
757
  to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
633
758
  stub_get("/1/lists/members/show.json").
634
- with(:query => {:owner_screen_name => "sferik", :screen_name => "sferik", :slug => "presidents"}).
759
+ with(:query => {:owner_id => "7505382", :screen_name => "sferik", :slug => "presidents"}).
635
760
  to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
636
761
  end
637
762
  it "should request the correct resource" do
638
763
  @cli.does_contain("7505382/presidents", "7505382")
639
764
  a_get("/1/users/show.json").
640
765
  with(:query => {:user_id => "7505382"}).
641
- should have_been_made.times(2)
766
+ should have_been_made
642
767
  a_get("/1/lists/members/show.json").
643
- with(:query => {:owner_screen_name => "sferik", :screen_name => "sferik", :slug => "presidents"}).
768
+ with(:query => {:owner_id => "7505382", :screen_name => "sferik", :slug => "presidents"}).
644
769
  should have_been_made
645
770
  end
646
771
  end
@@ -648,7 +773,7 @@ ID Since Tweets Favorites Listed Following Followers Scre...
648
773
  context "with a user passed" do
649
774
  it "should have the correct output" do
650
775
  @cli.does_contain("presidents", "testcli")
651
- $stdout.string.chomp.should == "Yes, @testcli/presidents contains @testcli."
776
+ $stdout.string.chomp.should == "Yes, presidents contains @testcli."
652
777
  end
653
778
  end
654
779
  context "false" do
@@ -785,9 +910,76 @@ ID Since Tweets Favorites Listed Following Followers Scre...
785
910
  end
786
911
  it "should have the correct output" do
787
912
  @cli.favorites
788
- $stdout.string.should =~ /@natevillegas/
789
- $stdout.string.should =~ /RT @gelobautista #riordan RT @WilI_Smith: Yesterday is history\. Tomorrow is a /
790
- $stdout.string.should =~ /mystery\. Today is a gift\. That's why it's called the present\./
913
+ $stdout.string.should == <<-eos
914
+ \e[1m\e[33m @ryanbigg\e[0m
915
+ Things that have made my life better, in order of greatness: GitHub, Travis
916
+ CI, the element Oxygen.
917
+
918
+ \e[1m\e[33m @sfbike\e[0m
919
+ Bike to Work Counts in: 73% of morning Market traffic was bikes! 1,031 bikers
920
+ counted in 1 hour--that's 17 per minute. Way to roll, SF!
921
+
922
+ \e[1m\e[33m @levie\e[0m
923
+ I know you're as rare as leprechauns, but if you're an amazing designer then
924
+ Box wants to hire you. Email recruiting@box.com
925
+
926
+ \e[1m\e[33m @natevillegas\e[0m
927
+ RT @gelobautista #riordan RT @WilI_Smith: Yesterday is history. Tomorrow is a
928
+ mystery. Today is a gift. That's why it's called the present.
929
+
930
+ \e[1m\e[33m @TD\e[0m
931
+ @kelseysilver how long will you be in town?
932
+
933
+ \e[1m\e[33m @rusashka\e[0m
934
+ @maciej hahaha :) @gpena together we're going to cover all core 28 languages!
935
+
936
+ \e[1m\e[33m @fat\e[0m
937
+ @stevej @xc i'm going to picket when i get back.
938
+
939
+ \e[1m\e[33m @wil\e[0m
940
+ @0x9900 @paulnivin http://t.co/bwVdtAPe
941
+
942
+ \e[1m\e[33m @wangtian\e[0m
943
+ @tianhonghe @xiangxin72 oh, you can even order specific items?
944
+
945
+ \e[1m\e[33m @shinypb\e[0m
946
+ @kpk Pfft, I think you're forgetting mechanical television, which depended on
947
+ a clever German. http://t.co/JvLNQCDm @skilldrick @hoverbird
948
+
949
+ \e[1m\e[33m @0x9900\e[0m
950
+ @wil @paulnivin if you want to take you seriously don't say daemontools!
951
+
952
+ \e[1m\e[33m @kpk\e[0m
953
+ @shinypb @skilldrick @hoverbird invented it
954
+
955
+ \e[1m\e[33m @skilldrick\e[0m
956
+ @shinypb Well played :) @hoverbird
957
+
958
+ \e[1m\e[33m @sam\e[0m
959
+ Can someone project the date that I'll get a 27\" retina display?
960
+
961
+ \e[1m\e[33m @shinypb\e[0m
962
+ @skilldrick @hoverbird Wow, I didn't even know they *had* TV in Britain.
963
+
964
+ \e[1m\e[33m @bartt\e[0m
965
+ @noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of
966
+ fun. Expect improvements in the weeks to come.
967
+
968
+ \e[1m\e[33m @skilldrick\e[0m
969
+ @hoverbird @shinypb You guys must be soooo old, I don't remember the words to
970
+ the duck tales intro at all.
971
+
972
+ \e[1m\e[33m @sean\e[0m
973
+ @mep Thanks for coming by. Was great to have you.
974
+
975
+ \e[1m\e[33m @hoverbird\e[0m
976
+ @shinypb @trammell it's all suck a \"duck blur\" sometimes.
977
+
978
+ \e[1m\e[33m @kelseysilver\e[0m
979
+ San Francisco here I come! (@ Newark Liberty International Airport (EWR) w/
980
+ 92 others) http://t.co/eoLANJZw
981
+
982
+ eos
791
983
  end
792
984
  context "--csv" do
793
985
  before do
@@ -956,46 +1148,81 @@ ID Posted at Screen name Text
956
1148
  @cli.options = @cli.options.merge("profile" => fixture_path + "/.trc")
957
1149
  end
958
1150
  context "one user" do
959
- it "should request the correct resource" do
1151
+ before do
1152
+ stub_get("/1/friends/ids.json").
1153
+ with(:query => {:cursor => "-1"}).
1154
+ to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1155
+ stub_get("/1/users/lookup.json").
1156
+ with(:query => {:screen_name => "sferik,pengwynn"}).
1157
+ to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
960
1158
  stub_post("/1/friendships/create.json").
961
- with(:body => {:screen_name => "sferik"}).
1159
+ with(:body => {:user_id => "14100886"}).
962
1160
  to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
963
- @cli.follow("sferik")
1161
+ end
1162
+ it "should request the correct resource" do
1163
+ @cli.follow("sferik", "pengwynn")
1164
+ a_get("/1/friends/ids.json").
1165
+ with(:query => {:cursor => "-1"}).
1166
+ should have_been_made
1167
+ a_get("/1/users/lookup.json").
1168
+ with(:query => {:screen_name => "sferik,pengwynn"}).
1169
+ should have_been_made
964
1170
  a_post("/1/friendships/create.json").
965
- with(:body => {:screen_name => "sferik"}).
1171
+ with(:body => {:user_id => "14100886"}).
966
1172
  should have_been_made
967
1173
  end
968
1174
  it "should have the correct output" do
969
- stub_post("/1/friendships/create.json").
970
- with(:body => {:screen_name => "sferik"}).
971
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
972
- @cli.follow("sferik")
1175
+ @cli.follow("sferik", "pengwynn")
973
1176
  $stdout.string.should =~ /^@testcli is now following 1 more user\.$/
974
1177
  end
975
1178
  context "--id" do
976
1179
  before do
977
1180
  @cli.options = @cli.options.merge("id" => true)
1181
+ stub_get("/1/friends/ids.json").
1182
+ with(:query => {:cursor => "-1"}).
1183
+ to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1184
+ stub_get("/1/users/lookup.json").
1185
+ with(:query => {:user_id => "7505382,14100886"}).
1186
+ to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
978
1187
  stub_post("/1/friendships/create.json").
979
- with(:body => {:user_id => "7505382"}).
1188
+ with(:body => {:user_id => "14100886"}).
980
1189
  to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
981
1190
  end
982
1191
  it "should request the correct resource" do
983
- @cli.follow("7505382")
1192
+ @cli.follow("7505382", "14100886")
1193
+ a_get("/1/friends/ids.json").
1194
+ with(:query => {:cursor => "-1"}).
1195
+ should have_been_made
1196
+ a_get("/1/users/lookup.json").
1197
+ with(:query => {:user_id => "7505382,14100886"}).
1198
+ should have_been_made
984
1199
  a_post("/1/friendships/create.json").
985
- with(:body => {:user_id => "7505382"}).
1200
+ with(:body => {:user_id => "14100886"}).
986
1201
  should have_been_made
987
1202
  end
988
1203
  end
989
1204
  context "Twitter is down" do
990
1205
  it "should retry 3 times and then raise an error" do
1206
+ stub_get("/1/friends/ids.json").
1207
+ with(:query => {:cursor => "-1"}).
1208
+ to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1209
+ stub_get("/1/users/lookup.json").
1210
+ with(:query => {:screen_name => "sferik,pengwynn"}).
1211
+ to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
991
1212
  stub_post("/1/friendships/create.json").
992
- with(:body => {:screen_name => "sferik"}).
1213
+ with(:body => {:user_id => "14100886"}).
993
1214
  to_return(:status => 502)
994
1215
  lambda do
995
- @cli.follow("sferik")
1216
+ @cli.follow("sferik", "pengwynn")
996
1217
  end.should raise_error("Twitter is down or being upgraded.")
1218
+ a_get("/1/friends/ids.json").
1219
+ with(:query => {:cursor => "-1"}).
1220
+ should have_been_made.times(3)
1221
+ a_get("/1/users/lookup.json").
1222
+ with(:query => {:screen_name => "sferik,pengwynn"}).
1223
+ should have_been_made.times(3)
997
1224
  a_post("/1/friendships/create.json").
998
- with(:body => {:screen_name => "sferik"}).
1225
+ with(:body => {:user_id => "14100886"}).
999
1226
  should have_been_made.times(3)
1000
1227
  end
1001
1228
  end
@@ -1022,7 +1249,7 @@ ID Posted at Screen name Text
1022
1249
  end
1023
1250
  it "should have the correct output" do
1024
1251
  @cli.followings
1025
- $stdout.string.rstrip.should == "pengwynn sferik"
1252
+ $stdout.string.chomp.should == "pengwynn sferik"
1026
1253
  end
1027
1254
  context "--csv" do
1028
1255
  before do
@@ -1031,86 +1258,95 @@ ID Posted at Screen name Text
1031
1258
  it "should output in CSV format" do
1032
1259
  @cli.followings
1033
1260
  $stdout.string.should == <<-eos
1034
- ID,Since,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
1035
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
1036
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
1261
+ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
1262
+ 14100886,2008-03-08 16:34:22 +0000,2012-07-07 20:33:19 +0000,6940,192,358,3427,5457,pengwynn,Wynn Netherland
1263
+ 7505382,2007-07-16 12:59:01 +0000,2012-07-08 18:29:20 +0000,7890,3755,118,212,2262,sferik,Erik Michaels-Ober
1037
1264
  eos
1038
1265
  end
1039
1266
  end
1040
- context "--favorites" do
1267
+ context "--long" do
1041
1268
  before do
1042
- @cli.options = @cli.options.merge("favorites" => true)
1269
+ @cli.options = @cli.options.merge("long" => true)
1043
1270
  end
1044
- it "should sort by number of favorites" do
1271
+ it "should output in long format" do
1045
1272
  @cli.followings
1046
- $stdout.string.rstrip.should == "pengwynn sferik"
1273
+ $stdout.string.should == <<-eos
1274
+ ID Since Last tweeted at Tweets Favorites Listed Following...
1275
+ 14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
1276
+ 7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
1277
+ eos
1047
1278
  end
1048
1279
  end
1049
- context "--followers" do
1280
+ context "--reverse" do
1050
1281
  before do
1051
- @cli.options = @cli.options.merge("followers" => true)
1282
+ @cli.options = @cli.options.merge("reverse" => true)
1052
1283
  end
1053
- it "should sort by number of followers" do
1284
+ it "should reverse the order of the sort" do
1054
1285
  @cli.followings
1055
- $stdout.string.rstrip.should == "sferik pengwynn"
1286
+ $stdout.string.chomp.should == "sferik pengwynn"
1056
1287
  end
1057
1288
  end
1058
- context "--friends" do
1289
+ context "--sort=favorites" do
1059
1290
  before do
1060
- @cli.options = @cli.options.merge("friends" => true)
1291
+ @cli.options = @cli.options.merge("sort" => "favorites")
1061
1292
  end
1062
- it "should sort by number of friends" do
1293
+ it "should sort by number of favorites" do
1063
1294
  @cli.followings
1064
- $stdout.string.rstrip.should == "sferik pengwynn"
1295
+ $stdout.string.chomp.should == "pengwynn sferik"
1065
1296
  end
1066
1297
  end
1067
- context "--listed" do
1298
+ context "--sort=followers" do
1068
1299
  before do
1069
- @cli.options = @cli.options.merge("listed" => true)
1300
+ @cli.options = @cli.options.merge("sort" => "followers")
1070
1301
  end
1071
- it "should sort by number of list memberships" do
1302
+ it "should sort by number of followers" do
1072
1303
  @cli.followings
1073
- $stdout.string.rstrip.should == "sferik pengwynn"
1304
+ $stdout.string.chomp.should == "sferik pengwynn"
1074
1305
  end
1075
1306
  end
1076
- context "--long" do
1307
+ context "--sort=friends" do
1077
1308
  before do
1078
- @cli.options = @cli.options.merge("long" => true)
1309
+ @cli.options = @cli.options.merge("sort" => "friends")
1079
1310
  end
1080
- it "should output in long format" do
1311
+ it "should sort by number of friends" do
1081
1312
  @cli.followings
1082
- $stdout.string.should == <<-eos
1083
- ID Since Tweets Favorites Listed Following Followers Scre...
1084
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
1085
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
1086
- eos
1313
+ $stdout.string.chomp.should == "sferik pengwynn"
1087
1314
  end
1088
1315
  end
1089
- context "--posted" do
1316
+ context "--sort=listed" do
1090
1317
  before do
1091
- @cli.options = @cli.options.merge("posted" => true)
1318
+ @cli.options = @cli.options.merge("sort" => "listed")
1092
1319
  end
1093
- it "should sort by the time when Twitter acount was created" do
1320
+ it "should sort by number of list memberships" do
1094
1321
  @cli.followings
1095
- $stdout.string.rstrip.should == "sferik pengwynn"
1322
+ $stdout.string.chomp.should == "sferik pengwynn"
1096
1323
  end
1097
1324
  end
1098
- context "--reverse" do
1325
+ context "--sort=since" do
1099
1326
  before do
1100
- @cli.options = @cli.options.merge("reverse" => true)
1327
+ @cli.options = @cli.options.merge("sort" => "since")
1101
1328
  end
1102
- it "should reverse the order of the sort" do
1329
+ it "should sort by the time when Twitter acount was created" do
1103
1330
  @cli.followings
1104
- $stdout.string.rstrip.should == "sferik pengwynn"
1331
+ $stdout.string.chomp.should == "sferik pengwynn"
1105
1332
  end
1106
1333
  end
1107
- context "--tweets" do
1334
+ context "--sort=tweets" do
1108
1335
  before do
1109
- @cli.options = @cli.options.merge("tweets" => true)
1336
+ @cli.options = @cli.options.merge("sort" => "tweets")
1110
1337
  end
1111
1338
  it "should sort by number of Tweets" do
1112
1339
  @cli.followings
1113
- $stdout.string.rstrip.should == "sferik pengwynn"
1340
+ $stdout.string.chomp.should == "pengwynn sferik"
1341
+ end
1342
+ end
1343
+ context "--sort=tweeted" do
1344
+ before do
1345
+ @cli.options = @cli.options.merge("sort" => "tweeted")
1346
+ end
1347
+ it "should sort by the time of the last Tweet" do
1348
+ @cli.followings
1349
+ $stdout.string.chomp.should == "pengwynn sferik"
1114
1350
  end
1115
1351
  end
1116
1352
  context "--unsorted" do
@@ -1119,7 +1355,7 @@ ID Since Tweets Favorites Listed Following Followers Scre...
1119
1355
  end
1120
1356
  it "should not be sorted" do
1121
1357
  @cli.followings
1122
- $stdout.string.rstrip.should == "sferik pengwynn"
1358
+ $stdout.string.chomp.should == "pengwynn sferik"
1123
1359
  end
1124
1360
  end
1125
1361
  context "with a user passed" do
@@ -1177,7 +1413,7 @@ ID Since Tweets Favorites Listed Following Followers Scre...
1177
1413
  end
1178
1414
  it "should have the correct output" do
1179
1415
  @cli.followers
1180
- $stdout.string.rstrip.should == "pengwynn sferik"
1416
+ $stdout.string.chomp.should == "pengwynn sferik"
1181
1417
  end
1182
1418
  context "--csv" do
1183
1419
  before do
@@ -1186,86 +1422,95 @@ ID Since Tweets Favorites Listed Following Followers Scre...
1186
1422
  it "should output in CSV format" do
1187
1423
  @cli.followers
1188
1424
  $stdout.string.should == <<-eos
1189
- ID,Since,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
1190
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
1191
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
1425
+ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
1426
+ 14100886,2008-03-08 16:34:22 +0000,2012-07-07 20:33:19 +0000,6940,192,358,3427,5457,pengwynn,Wynn Netherland
1427
+ 7505382,2007-07-16 12:59:01 +0000,2012-07-08 18:29:20 +0000,7890,3755,118,212,2262,sferik,Erik Michaels-Ober
1192
1428
  eos
1193
1429
  end
1194
1430
  end
1195
- context "--favorites" do
1431
+ context "--long" do
1196
1432
  before do
1197
- @cli.options = @cli.options.merge("favorites" => true)
1433
+ @cli.options = @cli.options.merge("long" => true)
1198
1434
  end
1199
- it "should sort by number of favorites" do
1435
+ it "should output in long format" do
1200
1436
  @cli.followers
1201
- $stdout.string.rstrip.should == "pengwynn sferik"
1437
+ $stdout.string.should == <<-eos
1438
+ ID Since Last tweeted at Tweets Favorites Listed Following...
1439
+ 14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
1440
+ 7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
1441
+ eos
1202
1442
  end
1203
1443
  end
1204
- context "--followers" do
1444
+ context "--reverse" do
1205
1445
  before do
1206
- @cli.options = @cli.options.merge("followers" => true)
1446
+ @cli.options = @cli.options.merge("reverse" => true)
1207
1447
  end
1208
- it "should sort by number of followers" do
1448
+ it "should reverse the order of the sort" do
1209
1449
  @cli.followers
1210
- $stdout.string.rstrip.should == "sferik pengwynn"
1450
+ $stdout.string.chomp.should == "sferik pengwynn"
1211
1451
  end
1212
1452
  end
1213
- context "--friends" do
1453
+ context "--sort=favorites" do
1214
1454
  before do
1215
- @cli.options = @cli.options.merge("friends" => true)
1455
+ @cli.options = @cli.options.merge("sort" => "favorites")
1216
1456
  end
1217
- it "should sort by number of friends" do
1457
+ it "should sort by number of favorites" do
1218
1458
  @cli.followers
1219
- $stdout.string.rstrip.should == "sferik pengwynn"
1459
+ $stdout.string.chomp.should == "pengwynn sferik"
1220
1460
  end
1221
1461
  end
1222
- context "--listed" do
1462
+ context "--sort=followers" do
1223
1463
  before do
1224
- @cli.options = @cli.options.merge("listed" => true)
1464
+ @cli.options = @cli.options.merge("sort" => "followers")
1225
1465
  end
1226
- it "should sort by number of list memberships" do
1466
+ it "should sort by number of followers" do
1227
1467
  @cli.followers
1228
- $stdout.string.rstrip.should == "sferik pengwynn"
1468
+ $stdout.string.chomp.should == "sferik pengwynn"
1229
1469
  end
1230
1470
  end
1231
- context "--long" do
1471
+ context "--sort=friends" do
1232
1472
  before do
1233
- @cli.options = @cli.options.merge("long" => true)
1473
+ @cli.options = @cli.options.merge("sort" => "friends")
1234
1474
  end
1235
- it "should output in long format" do
1475
+ it "should sort by number of friends" do
1236
1476
  @cli.followers
1237
- $stdout.string.should == <<-eos
1238
- ID Since Tweets Favorites Listed Following Followers Scre...
1239
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
1240
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
1241
- eos
1477
+ $stdout.string.chomp.should == "sferik pengwynn"
1242
1478
  end
1243
1479
  end
1244
- context "--posted" do
1480
+ context "--sort=listed" do
1245
1481
  before do
1246
- @cli.options = @cli.options.merge("posted" => true)
1482
+ @cli.options = @cli.options.merge("sort" => "listed")
1247
1483
  end
1248
- it "should sort by the time when Twitter acount was created" do
1484
+ it "should sort by number of list memberships" do
1249
1485
  @cli.followers
1250
- $stdout.string.rstrip.should == "sferik pengwynn"
1486
+ $stdout.string.chomp.should == "sferik pengwynn"
1251
1487
  end
1252
1488
  end
1253
- context "--reverse" do
1489
+ context "--sort=since" do
1254
1490
  before do
1255
- @cli.options = @cli.options.merge("reverse" => true)
1491
+ @cli.options = @cli.options.merge("sort" => "since")
1256
1492
  end
1257
- it "should reverse the order of the sort" do
1493
+ it "should sort by the time when Twitter acount was created" do
1258
1494
  @cli.followers
1259
- $stdout.string.rstrip.should == "sferik pengwynn"
1495
+ $stdout.string.chomp.should == "sferik pengwynn"
1260
1496
  end
1261
1497
  end
1262
- context "--tweets" do
1498
+ context "--sort=tweets" do
1263
1499
  before do
1264
- @cli.options = @cli.options.merge("tweets" => true)
1500
+ @cli.options = @cli.options.merge("sort" => "tweets")
1265
1501
  end
1266
1502
  it "should sort by number of Tweets" do
1267
1503
  @cli.followers
1268
- $stdout.string.rstrip.should == "sferik pengwynn"
1504
+ $stdout.string.chomp.should == "pengwynn sferik"
1505
+ end
1506
+ end
1507
+ context "--sort=tweeted" do
1508
+ before do
1509
+ @cli.options = @cli.options.merge("sort" => "tweeted")
1510
+ end
1511
+ it "should sort by the time of the last Tweet" do
1512
+ @cli.followers
1513
+ $stdout.string.chomp.should == "pengwynn sferik"
1269
1514
  end
1270
1515
  end
1271
1516
  context "--unsorted" do
@@ -1274,7 +1519,7 @@ ID Since Tweets Favorites Listed Following Followers Scre...
1274
1519
  end
1275
1520
  it "should not be sorted" do
1276
1521
  @cli.followers
1277
- $stdout.string.rstrip.should == "sferik pengwynn"
1522
+ $stdout.string.chomp.should == "pengwynn sferik"
1278
1523
  end
1279
1524
  end
1280
1525
  context "with a user passed" do
@@ -1341,7 +1586,7 @@ ID Since Tweets Favorites Listed Following Followers Scre...
1341
1586
  end
1342
1587
  it "should have the correct output" do
1343
1588
  @cli.friends
1344
- $stdout.string.rstrip.should == "pengwynn sferik"
1589
+ $stdout.string.chomp.should == "pengwynn sferik"
1345
1590
  end
1346
1591
  context "--csv" do
1347
1592
  before do
@@ -1350,86 +1595,95 @@ ID Since Tweets Favorites Listed Following Followers Scre...
1350
1595
  it "should output in CSV format" do
1351
1596
  @cli.friends
1352
1597
  $stdout.string.should == <<-eos
1353
- ID,Since,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
1354
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
1355
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
1598
+ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
1599
+ 14100886,2008-03-08 16:34:22 +0000,2012-07-07 20:33:19 +0000,6940,192,358,3427,5457,pengwynn,Wynn Netherland
1600
+ 7505382,2007-07-16 12:59:01 +0000,2012-07-08 18:29:20 +0000,7890,3755,118,212,2262,sferik,Erik Michaels-Ober
1356
1601
  eos
1357
1602
  end
1358
1603
  end
1359
- context "--favorites" do
1604
+ context "--long" do
1360
1605
  before do
1361
- @cli.options = @cli.options.merge("favorites" => true)
1606
+ @cli.options = @cli.options.merge("long" => true)
1362
1607
  end
1363
- it "should sort by number of favorites" do
1608
+ it "should output in long format" do
1364
1609
  @cli.friends
1365
- $stdout.string.rstrip.should == "pengwynn sferik"
1610
+ $stdout.string.should == <<-eos
1611
+ ID Since Last tweeted at Tweets Favorites Listed Following...
1612
+ 14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
1613
+ 7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
1614
+ eos
1366
1615
  end
1367
1616
  end
1368
- context "--followers" do
1617
+ context "--reverse" do
1369
1618
  before do
1370
- @cli.options = @cli.options.merge("followers" => true)
1619
+ @cli.options = @cli.options.merge("reverse" => true)
1371
1620
  end
1372
- it "should sort by number of followers" do
1621
+ it "should reverse the order of the sort" do
1373
1622
  @cli.friends
1374
- $stdout.string.rstrip.should == "sferik pengwynn"
1623
+ $stdout.string.chomp.should == "sferik pengwynn"
1375
1624
  end
1376
1625
  end
1377
- context "--friends" do
1626
+ context "--sort=favorites" do
1378
1627
  before do
1379
- @cli.options = @cli.options.merge("friends" => true)
1628
+ @cli.options = @cli.options.merge("sort" => "favorites")
1380
1629
  end
1381
- it "should sort by number of friends" do
1630
+ it "should sort by number of favorites" do
1382
1631
  @cli.friends
1383
- $stdout.string.rstrip.should == "sferik pengwynn"
1632
+ $stdout.string.chomp.should == "pengwynn sferik"
1384
1633
  end
1385
1634
  end
1386
- context "--listed" do
1635
+ context "--sort=followers" do
1387
1636
  before do
1388
- @cli.options = @cli.options.merge("listed" => true)
1637
+ @cli.options = @cli.options.merge("sort" => "followers")
1389
1638
  end
1390
- it "should sort by number of list memberships" do
1639
+ it "should sort by number of followers" do
1391
1640
  @cli.friends
1392
- $stdout.string.rstrip.should == "sferik pengwynn"
1641
+ $stdout.string.chomp.should == "sferik pengwynn"
1393
1642
  end
1394
1643
  end
1395
- context "--long" do
1644
+ context "--sort=friends" do
1396
1645
  before do
1397
- @cli.options = @cli.options.merge("long" => true)
1646
+ @cli.options = @cli.options.merge("sort" => "friends")
1398
1647
  end
1399
- it "should output in long format" do
1648
+ it "should sort by number of friends" do
1400
1649
  @cli.friends
1401
- $stdout.string.should == <<-eos
1402
- ID Since Tweets Favorites Listed Following Followers Scre...
1403
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
1404
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
1405
- eos
1650
+ $stdout.string.chomp.should == "sferik pengwynn"
1406
1651
  end
1407
1652
  end
1408
- context "--posted" do
1653
+ context "--sort=listed" do
1409
1654
  before do
1410
- @cli.options = @cli.options.merge("posted" => true)
1655
+ @cli.options = @cli.options.merge("sort" => "listed")
1411
1656
  end
1412
- it "should sort by the time when Twitter acount was created" do
1657
+ it "should sort by number of list memberships" do
1413
1658
  @cli.friends
1414
- $stdout.string.rstrip.should == "sferik pengwynn"
1659
+ $stdout.string.chomp.should == "sferik pengwynn"
1415
1660
  end
1416
1661
  end
1417
- context "--reverse" do
1662
+ context "--sort=since" do
1418
1663
  before do
1419
- @cli.options = @cli.options.merge("reverse" => true)
1664
+ @cli.options = @cli.options.merge("sort" => "since")
1420
1665
  end
1421
- it "should reverse the order of the sort" do
1666
+ it "should sort by the time when Twitter acount was created" do
1422
1667
  @cli.friends
1423
- $stdout.string.rstrip.should == "sferik pengwynn"
1668
+ $stdout.string.chomp.should == "sferik pengwynn"
1424
1669
  end
1425
1670
  end
1426
- context "--tweets" do
1671
+ context "--sort=tweets" do
1427
1672
  before do
1428
- @cli.options = @cli.options.merge("tweets" => true)
1673
+ @cli.options = @cli.options.merge("sort" => "tweets")
1429
1674
  end
1430
1675
  it "should sort by number of Tweets" do
1431
1676
  @cli.friends
1432
- $stdout.string.rstrip.should == "sferik pengwynn"
1677
+ $stdout.string.chomp.should == "pengwynn sferik"
1678
+ end
1679
+ end
1680
+ context "--sort=tweeted" do
1681
+ before do
1682
+ @cli.options = @cli.options.merge("sort" => "tweeted")
1683
+ end
1684
+ it "should sort by the time of the last Tweet" do
1685
+ @cli.friends
1686
+ $stdout.string.chomp.should == "pengwynn sferik"
1433
1687
  end
1434
1688
  end
1435
1689
  context "--unsorted" do
@@ -1438,7 +1692,7 @@ ID Since Tweets Favorites Listed Following Followers Scre...
1438
1692
  end
1439
1693
  it "should not be sorted" do
1440
1694
  @cli.friends
1441
- $stdout.string.rstrip.should == "sferik pengwynn"
1695
+ $stdout.string.chomp.should == "pengwynn sferik"
1442
1696
  end
1443
1697
  end
1444
1698
  context "with a user passed" do
@@ -1514,7 +1768,7 @@ ID Since Tweets Favorites Listed Following Followers Scre...
1514
1768
  end
1515
1769
  it "should have the correct output" do
1516
1770
  @cli.leaders
1517
- $stdout.string.rstrip.should == "pengwynn sferik"
1771
+ $stdout.string.chomp.should == "pengwynn sferik"
1518
1772
  end
1519
1773
  context "--csv" do
1520
1774
  before do
@@ -1523,86 +1777,95 @@ ID Since Tweets Favorites Listed Following Followers Scre...
1523
1777
  it "should output in CSV format" do
1524
1778
  @cli.leaders
1525
1779
  $stdout.string.should == <<-eos
1526
- ID,Since,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
1527
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
1528
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
1780
+ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
1781
+ 14100886,2008-03-08 16:34:22 +0000,2012-07-07 20:33:19 +0000,6940,192,358,3427,5457,pengwynn,Wynn Netherland
1782
+ 7505382,2007-07-16 12:59:01 +0000,2012-07-08 18:29:20 +0000,7890,3755,118,212,2262,sferik,Erik Michaels-Ober
1529
1783
  eos
1530
1784
  end
1531
1785
  end
1532
- context "--favorites" do
1786
+ context "--long" do
1533
1787
  before do
1534
- @cli.options = @cli.options.merge("favorites" => true)
1788
+ @cli.options = @cli.options.merge("long" => true)
1535
1789
  end
1536
- it "should sort by number of favorites" do
1790
+ it "should output in long format" do
1537
1791
  @cli.leaders
1538
- $stdout.string.rstrip.should == "pengwynn sferik"
1792
+ $stdout.string.should == <<-eos
1793
+ ID Since Last tweeted at Tweets Favorites Listed Following...
1794
+ 14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
1795
+ 7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
1796
+ eos
1539
1797
  end
1540
1798
  end
1541
- context "--followers" do
1799
+ context "--reverse" do
1542
1800
  before do
1543
- @cli.options = @cli.options.merge("followers" => true)
1801
+ @cli.options = @cli.options.merge("reverse" => true)
1544
1802
  end
1545
- it "should sort by number of followers" do
1803
+ it "should reverse the order of the sort" do
1546
1804
  @cli.leaders
1547
- $stdout.string.rstrip.should == "sferik pengwynn"
1805
+ $stdout.string.chomp.should == "sferik pengwynn"
1548
1806
  end
1549
1807
  end
1550
- context "--friends" do
1808
+ context "--sort=favorites" do
1551
1809
  before do
1552
- @cli.options = @cli.options.merge("friends" => true)
1810
+ @cli.options = @cli.options.merge("sort" => "favorites")
1553
1811
  end
1554
- it "should sort by number of friends" do
1812
+ it "should sort by number of favorites" do
1555
1813
  @cli.leaders
1556
- $stdout.string.rstrip.should == "sferik pengwynn"
1814
+ $stdout.string.chomp.should == "pengwynn sferik"
1557
1815
  end
1558
1816
  end
1559
- context "--listed" do
1817
+ context "--sort=followers" do
1560
1818
  before do
1561
- @cli.options = @cli.options.merge("listed" => true)
1819
+ @cli.options = @cli.options.merge("sort" => "followers")
1562
1820
  end
1563
- it "should sort by number of list memberships" do
1821
+ it "should sort by number of followers" do
1564
1822
  @cli.leaders
1565
- $stdout.string.rstrip.should == "sferik pengwynn"
1823
+ $stdout.string.chomp.should == "sferik pengwynn"
1566
1824
  end
1567
1825
  end
1568
- context "--long" do
1826
+ context "--sort=friends" do
1569
1827
  before do
1570
- @cli.options = @cli.options.merge("long" => true)
1828
+ @cli.options = @cli.options.merge("sort" => "friends")
1571
1829
  end
1572
- it "should output in long format" do
1830
+ it "should sort by number of friends" do
1573
1831
  @cli.leaders
1574
- $stdout.string.should == <<-eos
1575
- ID Since Tweets Favorites Listed Following Followers Scre...
1576
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
1577
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
1578
- eos
1832
+ $stdout.string.chomp.should == "sferik pengwynn"
1579
1833
  end
1580
1834
  end
1581
- context "--posted" do
1835
+ context "--sort=listed" do
1582
1836
  before do
1583
- @cli.options = @cli.options.merge("posted" => true)
1837
+ @cli.options = @cli.options.merge("sort" => "listed")
1584
1838
  end
1585
- it "should sort by the time when Twitter acount was created" do
1839
+ it "should sort by number of list memberships" do
1586
1840
  @cli.leaders
1587
- $stdout.string.rstrip.should == "sferik pengwynn"
1841
+ $stdout.string.chomp.should == "sferik pengwynn"
1588
1842
  end
1589
1843
  end
1590
- context "--reverse" do
1844
+ context "--sort=since" do
1591
1845
  before do
1592
- @cli.options = @cli.options.merge("reverse" => true)
1846
+ @cli.options = @cli.options.merge("sort" => "since")
1593
1847
  end
1594
- it "should reverse the order of the sort" do
1848
+ it "should sort by the time when Twitter acount was created" do
1595
1849
  @cli.leaders
1596
- $stdout.string.rstrip.should == "sferik pengwynn"
1850
+ $stdout.string.chomp.should == "sferik pengwynn"
1597
1851
  end
1598
1852
  end
1599
- context "--tweets" do
1853
+ context "--sort=tweets" do
1600
1854
  before do
1601
- @cli.options = @cli.options.merge("tweets" => true)
1855
+ @cli.options = @cli.options.merge("sort" => "tweets")
1602
1856
  end
1603
1857
  it "should sort by number of Tweets" do
1604
1858
  @cli.leaders
1605
- $stdout.string.rstrip.should == "sferik pengwynn"
1859
+ $stdout.string.chomp.should == "pengwynn sferik"
1860
+ end
1861
+ end
1862
+ context "--sort=tweeted" do
1863
+ before do
1864
+ @cli.options = @cli.options.merge("sort" => "tweeted")
1865
+ end
1866
+ it "should sort by the time of the last Tweet" do
1867
+ @cli.leaders
1868
+ $stdout.string.chomp.should == "pengwynn sferik"
1606
1869
  end
1607
1870
  end
1608
1871
  context "--unsorted" do
@@ -1611,7 +1874,7 @@ ID Since Tweets Favorites Listed Following Followers Scre...
1611
1874
  end
1612
1875
  it "should not be sorted" do
1613
1876
  @cli.leaders
1614
- $stdout.string.rstrip.should == "sferik pengwynn"
1877
+ $stdout.string.chomp.should == "pengwynn sferik"
1615
1878
  end
1616
1879
  end
1617
1880
  context "with a user passed" do
@@ -1675,7 +1938,7 @@ ID Since Tweets Favorites Listed Following Followers Scre...
1675
1938
  end
1676
1939
  it "should have the correct output" do
1677
1940
  @cli.lists
1678
- $stdout.string.rstrip.should == "@sferik/code-for-america @sferik/presidents"
1941
+ $stdout.string.chomp.should == "@sferik/code-for-america @sferik/presidents"
1679
1942
  end
1680
1943
  context "--csv" do
1681
1944
  before do
@@ -1703,49 +1966,49 @@ ID Created at Screen name Slug Members Subscribers ...
1703
1966
  eos
1704
1967
  end
1705
1968
  end
1706
- context "--members" do
1969
+ context "--reverse" do
1707
1970
  before do
1708
- @cli.options = @cli.options.merge("members" => true)
1971
+ @cli.options = @cli.options.merge("reverse" => true)
1709
1972
  end
1710
- it "should sort by the time when Twitter acount was created" do
1973
+ it "should reverse the order of the sort" do
1711
1974
  @cli.lists
1712
- $stdout.string.rstrip.should == "@sferik/presidents @sferik/code-for-america"
1975
+ $stdout.string.chomp.should == "@sferik/presidents @sferik/code-for-america"
1713
1976
  end
1714
1977
  end
1715
- context "--mode" do
1978
+ context "--sort=members" do
1716
1979
  before do
1717
- @cli.options = @cli.options.merge("mode" => true)
1980
+ @cli.options = @cli.options.merge("sort" => "members")
1718
1981
  end
1719
1982
  it "should sort by the time when Twitter acount was created" do
1720
1983
  @cli.lists
1721
- $stdout.string.rstrip.should == "@sferik/code-for-america @sferik/presidents"
1984
+ $stdout.string.chomp.should == "@sferik/presidents @sferik/code-for-america"
1722
1985
  end
1723
1986
  end
1724
- context "--posted" do
1987
+ context "--sort=mode" do
1725
1988
  before do
1726
- @cli.options = @cli.options.merge("posted" => true)
1989
+ @cli.options = @cli.options.merge("sort" => "mode")
1727
1990
  end
1728
1991
  it "should sort by the time when Twitter acount was created" do
1729
1992
  @cli.lists
1730
- $stdout.string.rstrip.should == "@sferik/presidents @sferik/code-for-america"
1993
+ $stdout.string.chomp.should == "@sferik/code-for-america @sferik/presidents"
1731
1994
  end
1732
1995
  end
1733
- context "--reverse" do
1996
+ context "--sort=posted" do
1734
1997
  before do
1735
- @cli.options = @cli.options.merge("reverse" => true)
1998
+ @cli.options = @cli.options.merge("sort" => "posted")
1736
1999
  end
1737
- it "should reverse the order of the sort" do
2000
+ it "should sort by the time when Twitter acount was created" do
1738
2001
  @cli.lists
1739
- $stdout.string.rstrip.should == "@sferik/presidents @sferik/code-for-america"
2002
+ $stdout.string.chomp.should == "@sferik/presidents @sferik/code-for-america"
1740
2003
  end
1741
2004
  end
1742
- context "--subscribers" do
2005
+ context "--sort=subscribers" do
1743
2006
  before do
1744
- @cli.options = @cli.options.merge("subscribers" => true)
2007
+ @cli.options = @cli.options.merge("sort" => "subscribers")
1745
2008
  end
1746
2009
  it "should sort by the time when Twitter acount was created" do
1747
2010
  @cli.lists
1748
- $stdout.string.rstrip.should == "@sferik/presidents @sferik/code-for-america"
2011
+ $stdout.string.chomp.should == "@sferik/presidents @sferik/code-for-america"
1749
2012
  end
1750
2013
  end
1751
2014
  context "--unsorted" do
@@ -1754,7 +2017,7 @@ ID Created at Screen name Slug Members Subscribers ...
1754
2017
  end
1755
2018
  it "should not be sorted" do
1756
2019
  @cli.lists
1757
- $stdout.string.rstrip.should == "@sferik/code-for-america @sferik/presidents"
2020
+ $stdout.string.chomp.should == "@sferik/code-for-america @sferik/presidents"
1758
2021
  end
1759
2022
  end
1760
2023
  context "with a user passed" do
@@ -1800,9 +2063,76 @@ ID Created at Screen name Slug Members Subscribers ...
1800
2063
  end
1801
2064
  it "should have the correct output" do
1802
2065
  @cli.mentions
1803
- $stdout.string.should =~ /@natevillegas/
1804
- $stdout.string.should =~ /RT @gelobautista #riordan RT @WilI_Smith: Yesterday is history\. Tomorrow is a /
1805
- $stdout.string.should =~ /mystery\. Today is a gift\. That's why it's called the present\./
2066
+ $stdout.string.should == <<-eos
2067
+ \e[1m\e[33m @ryanbigg\e[0m
2068
+ Things that have made my life better, in order of greatness: GitHub, Travis
2069
+ CI, the element Oxygen.
2070
+
2071
+ \e[1m\e[33m @sfbike\e[0m
2072
+ Bike to Work Counts in: 73% of morning Market traffic was bikes! 1,031 bikers
2073
+ counted in 1 hour--that's 17 per minute. Way to roll, SF!
2074
+
2075
+ \e[1m\e[33m @levie\e[0m
2076
+ I know you're as rare as leprechauns, but if you're an amazing designer then
2077
+ Box wants to hire you. Email recruiting@box.com
2078
+
2079
+ \e[1m\e[33m @natevillegas\e[0m
2080
+ RT @gelobautista #riordan RT @WilI_Smith: Yesterday is history. Tomorrow is a
2081
+ mystery. Today is a gift. That's why it's called the present.
2082
+
2083
+ \e[1m\e[33m @TD\e[0m
2084
+ @kelseysilver how long will you be in town?
2085
+
2086
+ \e[1m\e[33m @rusashka\e[0m
2087
+ @maciej hahaha :) @gpena together we're going to cover all core 28 languages!
2088
+
2089
+ \e[1m\e[33m @fat\e[0m
2090
+ @stevej @xc i'm going to picket when i get back.
2091
+
2092
+ \e[1m\e[33m @wil\e[0m
2093
+ @0x9900 @paulnivin http://t.co/bwVdtAPe
2094
+
2095
+ \e[1m\e[33m @wangtian\e[0m
2096
+ @tianhonghe @xiangxin72 oh, you can even order specific items?
2097
+
2098
+ \e[1m\e[33m @shinypb\e[0m
2099
+ @kpk Pfft, I think you're forgetting mechanical television, which depended on
2100
+ a clever German. http://t.co/JvLNQCDm @skilldrick @hoverbird
2101
+
2102
+ \e[1m\e[33m @0x9900\e[0m
2103
+ @wil @paulnivin if you want to take you seriously don't say daemontools!
2104
+
2105
+ \e[1m\e[33m @kpk\e[0m
2106
+ @shinypb @skilldrick @hoverbird invented it
2107
+
2108
+ \e[1m\e[33m @skilldrick\e[0m
2109
+ @shinypb Well played :) @hoverbird
2110
+
2111
+ \e[1m\e[33m @sam\e[0m
2112
+ Can someone project the date that I'll get a 27\" retina display?
2113
+
2114
+ \e[1m\e[33m @shinypb\e[0m
2115
+ @skilldrick @hoverbird Wow, I didn't even know they *had* TV in Britain.
2116
+
2117
+ \e[1m\e[33m @bartt\e[0m
2118
+ @noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of
2119
+ fun. Expect improvements in the weeks to come.
2120
+
2121
+ \e[1m\e[33m @skilldrick\e[0m
2122
+ @hoverbird @shinypb You guys must be soooo old, I don't remember the words to
2123
+ the duck tales intro at all.
2124
+
2125
+ \e[1m\e[33m @sean\e[0m
2126
+ @mep Thanks for coming by. Was great to have you.
2127
+
2128
+ \e[1m\e[33m @hoverbird\e[0m
2129
+ @shinypb @trammell it's all suck a \"duck blur\" sometimes.
2130
+
2131
+ \e[1m\e[33m @kelseysilver\e[0m
2132
+ San Francisco here I come! (@ Newark Liberty International Airport (EWR) w/
2133
+ 92 others) http://t.co/eoLANJZw
2134
+
2135
+ eos
1806
2136
  end
1807
2137
  context "--csv" do
1808
2138
  before do
@@ -2044,7 +2374,7 @@ Hourly limit,Remaining hits,Reset time
2044
2374
  end
2045
2375
  it "should have the correct output" do
2046
2376
  @cli.reply("55709764298092545", "Testing")
2047
- $stdout.string.should =~ /^Reply created by @testcli to @sferik \(8 months ago\)\.$/
2377
+ $stdout.string.split("\n").first.should == "Reply posted by @testcli to @sferik."
2048
2378
  end
2049
2379
  context "--all" do
2050
2380
  before do
@@ -2065,7 +2395,7 @@ Hourly limit,Remaining hits,Reset time
2065
2395
  end
2066
2396
  it "should have the correct output" do
2067
2397
  @cli.reply("55709764298092545", "Testing")
2068
- $stdout.string.should =~ /^Reply created by @testcli to @sferik \(8 months ago\)\.$/
2398
+ $stdout.string.split("\n").first.should == "Reply posted by @testcli to @sferik."
2069
2399
  end
2070
2400
  end
2071
2401
  end
@@ -2135,9 +2465,76 @@ Hourly limit,Remaining hits,Reset time
2135
2465
  end
2136
2466
  it "should have the correct output" do
2137
2467
  @cli.retweets
2138
- $stdout.string.should =~ /@natevillegas/
2139
- $stdout.string.should =~ /RT @gelobautista #riordan RT @WilI_Smith: Yesterday is history\. Tomorrow is a /
2140
- $stdout.string.should =~ /mystery\. Today is a gift\. That's why it's called the present\./
2468
+ $stdout.string.should == <<-eos
2469
+ \e[1m\e[33m @ryanbigg\e[0m
2470
+ Things that have made my life better, in order of greatness: GitHub, Travis
2471
+ CI, the element Oxygen.
2472
+
2473
+ \e[1m\e[33m @sfbike\e[0m
2474
+ Bike to Work Counts in: 73% of morning Market traffic was bikes! 1,031 bikers
2475
+ counted in 1 hour--that's 17 per minute. Way to roll, SF!
2476
+
2477
+ \e[1m\e[33m @levie\e[0m
2478
+ I know you're as rare as leprechauns, but if you're an amazing designer then
2479
+ Box wants to hire you. Email recruiting@box.com
2480
+
2481
+ \e[1m\e[33m @natevillegas\e[0m
2482
+ RT @gelobautista #riordan RT @WilI_Smith: Yesterday is history. Tomorrow is a
2483
+ mystery. Today is a gift. That's why it's called the present.
2484
+
2485
+ \e[1m\e[33m @TD\e[0m
2486
+ @kelseysilver how long will you be in town?
2487
+
2488
+ \e[1m\e[33m @rusashka\e[0m
2489
+ @maciej hahaha :) @gpena together we're going to cover all core 28 languages!
2490
+
2491
+ \e[1m\e[33m @fat\e[0m
2492
+ @stevej @xc i'm going to picket when i get back.
2493
+
2494
+ \e[1m\e[33m @wil\e[0m
2495
+ @0x9900 @paulnivin http://t.co/bwVdtAPe
2496
+
2497
+ \e[1m\e[33m @wangtian\e[0m
2498
+ @tianhonghe @xiangxin72 oh, you can even order specific items?
2499
+
2500
+ \e[1m\e[33m @shinypb\e[0m
2501
+ @kpk Pfft, I think you're forgetting mechanical television, which depended on
2502
+ a clever German. http://t.co/JvLNQCDm @skilldrick @hoverbird
2503
+
2504
+ \e[1m\e[33m @0x9900\e[0m
2505
+ @wil @paulnivin if you want to take you seriously don't say daemontools!
2506
+
2507
+ \e[1m\e[33m @kpk\e[0m
2508
+ @shinypb @skilldrick @hoverbird invented it
2509
+
2510
+ \e[1m\e[33m @skilldrick\e[0m
2511
+ @shinypb Well played :) @hoverbird
2512
+
2513
+ \e[1m\e[33m @sam\e[0m
2514
+ Can someone project the date that I'll get a 27\" retina display?
2515
+
2516
+ \e[1m\e[33m @shinypb\e[0m
2517
+ @skilldrick @hoverbird Wow, I didn't even know they *had* TV in Britain.
2518
+
2519
+ \e[1m\e[33m @bartt\e[0m
2520
+ @noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of
2521
+ fun. Expect improvements in the weeks to come.
2522
+
2523
+ \e[1m\e[33m @skilldrick\e[0m
2524
+ @hoverbird @shinypb You guys must be soooo old, I don't remember the words to
2525
+ the duck tales intro at all.
2526
+
2527
+ \e[1m\e[33m @sean\e[0m
2528
+ @mep Thanks for coming by. Was great to have you.
2529
+
2530
+ \e[1m\e[33m @hoverbird\e[0m
2531
+ @shinypb @trammell it's all suck a \"duck blur\" sometimes.
2532
+
2533
+ \e[1m\e[33m @kelseysilver\e[0m
2534
+ San Francisco here I come! (@ Newark Liberty International Airport (EWR) w/
2535
+ 92 others) http://t.co/eoLANJZw
2536
+
2537
+ eos
2141
2538
  end
2142
2539
  end
2143
2540
  context "--csv" do
@@ -2349,101 +2746,101 @@ ID,Text,Screen name,Posted at,Location,Retweets,Source,URL
2349
2746
  end
2350
2747
  context "with no street address" do
2351
2748
  before do
2352
- stub_get("/1/statuses/show/55709764298092545.json").
2749
+ stub_get("/1/statuses/show/55709764298092550.json").
2353
2750
  with(:query => {:include_my_retweet => "false"}).
2354
2751
  to_return(:body => fixture("status_no_street_address.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2355
2752
  end
2356
2753
  it "should have the correct output" do
2357
- @cli.status("55709764298092545")
2754
+ @cli.status("55709764298092550")
2358
2755
  $stdout.string.should == <<-eos
2359
- ID 55709764298092545
2756
+ ID 55709764298092550
2360
2757
  Text The problem with your code is that it's doing exactly what you told it to do.
2361
2758
  Screen name @sferik
2362
2759
  Posted at Apr 6 2011 (8 months ago)
2363
2760
  Location Blowfish Sushi To Die For, San Francisco, California, United States
2364
2761
  Retweets 320
2365
2762
  Source Twitter for iPhone
2366
- URL https://twitter.com/sferik/status/55709764298092545
2763
+ URL https://twitter.com/sferik/status/55709764298092550
2367
2764
  eos
2368
2765
  end
2369
2766
  end
2370
2767
  context "with no locality" do
2371
2768
  before do
2372
- stub_get("/1/statuses/show/55709764298092545.json").
2769
+ stub_get("/1/statuses/show/55709764298092549.json").
2373
2770
  with(:query => {:include_my_retweet => "false"}).
2374
2771
  to_return(:body => fixture("status_no_locality.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2375
2772
  end
2376
2773
  it "should have the correct output" do
2377
- @cli.status("55709764298092545")
2774
+ @cli.status("55709764298092549")
2378
2775
  $stdout.string.should == <<-eos
2379
- ID 55709764298092545
2776
+ ID 55709764298092549
2380
2777
  Text The problem with your code is that it's doing exactly what you told it to do.
2381
2778
  Screen name @sferik
2382
2779
  Posted at Apr 6 2011 (8 months ago)
2383
2780
  Location Blowfish Sushi To Die For, San Francisco, California, United States
2384
2781
  Retweets 320
2385
2782
  Source Twitter for iPhone
2386
- URL https://twitter.com/sferik/status/55709764298092545
2783
+ URL https://twitter.com/sferik/status/55709764298092549
2387
2784
  eos
2388
2785
  end
2389
2786
  end
2390
2787
  context "with no attributes" do
2391
2788
  before do
2392
- stub_get("/1/statuses/show/55709764298092545.json").
2789
+ stub_get("/1/statuses/show/55709764298092546.json").
2393
2790
  with(:query => {:include_my_retweet => "false"}).
2394
2791
  to_return(:body => fixture("status_no_attributes.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2395
2792
  end
2396
2793
  it "should have the correct output" do
2397
- @cli.status("55709764298092545")
2794
+ @cli.status("55709764298092546")
2398
2795
  $stdout.string.should == <<-eos
2399
- ID 55709764298092545
2796
+ ID 55709764298092546
2400
2797
  Text The problem with your code is that it's doing exactly what you told it to do.
2401
2798
  Screen name @sferik
2402
2799
  Posted at Apr 6 2011 (8 months ago)
2403
2800
  Location Blowfish Sushi To Die For, San Francisco, United States
2404
2801
  Retweets 320
2405
2802
  Source Twitter for iPhone
2406
- URL https://twitter.com/sferik/status/55709764298092545
2803
+ URL https://twitter.com/sferik/status/55709764298092546
2407
2804
  eos
2408
2805
  end
2409
2806
  end
2410
2807
  context "with no country" do
2411
2808
  before do
2412
- stub_get("/1/statuses/show/55709764298092545.json").
2809
+ stub_get("/1/statuses/show/55709764298092547.json").
2413
2810
  with(:query => {:include_my_retweet => "false"}).
2414
2811
  to_return(:body => fixture("status_no_country.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2415
2812
  end
2416
2813
  it "should have the correct output" do
2417
- @cli.status("55709764298092545")
2814
+ @cli.status("55709764298092547")
2418
2815
  $stdout.string.should == <<-eos
2419
- ID 55709764298092545
2816
+ ID 55709764298092547
2420
2817
  Text The problem with your code is that it's doing exactly what you told it to do.
2421
2818
  Screen name @sferik
2422
2819
  Posted at Apr 6 2011 (8 months ago)
2423
2820
  Location Blowfish Sushi To Die For, San Francisco
2424
2821
  Retweets 320
2425
2822
  Source Twitter for iPhone
2426
- URL https://twitter.com/sferik/status/55709764298092545
2823
+ URL https://twitter.com/sferik/status/55709764298092547
2427
2824
  eos
2428
2825
  end
2429
2826
  end
2430
2827
  context "with no full name" do
2431
2828
  before do
2432
- stub_get("/1/statuses/show/55709764298092545.json").
2829
+ stub_get("/1/statuses/show/55709764298092548.json").
2433
2830
  with(:query => {:include_my_retweet => "false"}).
2434
2831
  to_return(:body => fixture("status_no_full_name.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2435
2832
  end
2436
2833
  it "should have the correct output" do
2437
- @cli.status("55709764298092545")
2834
+ @cli.status("55709764298092548")
2438
2835
  $stdout.string.should == <<-eos
2439
- ID 55709764298092545
2836
+ ID 55709764298092548
2440
2837
  Text The problem with your code is that it's doing exactly what you told it to do.
2441
2838
  Screen name @sferik
2442
2839
  Posted at Apr 6 2011 (8 months ago)
2443
2840
  Location Blowfish Sushi To Die For
2444
2841
  Retweets 320
2445
2842
  Source Twitter for iPhone
2446
- URL https://twitter.com/sferik/status/55709764298092545
2843
+ URL https://twitter.com/sferik/status/55709764298092548
2447
2844
  eos
2448
2845
  end
2449
2846
  end
@@ -2467,7 +2864,7 @@ URL https://twitter.com/sferik/status/55709764298092545
2467
2864
  end
2468
2865
  it "should have the correct output" do
2469
2866
  @cli.suggest
2470
- $stdout.string.rstrip.should == "antpires jtrupiano maccman mlroach stuntmann82"
2867
+ $stdout.string.chomp.should == "antpires jtrupiano maccman mlroach stuntmann82"
2471
2868
  end
2472
2869
  context "--csv" do
2473
2870
  before do
@@ -2476,106 +2873,115 @@ URL https://twitter.com/sferik/status/55709764298092545
2476
2873
  it "should output in CSV format" do
2477
2874
  @cli.suggest
2478
2875
  $stdout.string.should == <<-eos
2479
- ID,Since,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
2480
- 40514587,2009-05-16 18:24:33 +0000,183,2,2,198,158,antpires,AntonioPires
2481
- 14736332,2008-05-11 19:46:06 +0000,3850,117,99,545,802,jtrupiano,John Trupiano
2482
- 2006261,2007-03-23 12:36:14 +0000,4497,9,171,967,2028,maccman,Alex MacCaw
2483
- 14451152,2008-04-20 12:05:38 +0000,6251,10,20,403,299,mlroach,Matt Laroche
2484
- 16052754,2008-08-30 08:22:57 +0000,24,0,1,5,42,stuntmann82,stuntmann82
2876
+ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
2877
+ 40514587,2009-05-16 18:24:33 +0000,2011-06-13 16:27:31 +0000,183,2,2,198,158,antpires,AntonioPires
2878
+ 14736332,2008-05-11 19:46:06 +0000,2011-08-20 03:27:22 +0000,3850,117,99,545,802,jtrupiano,John Trupiano
2879
+ 2006261,2007-03-23 12:36:14 +0000,2011-08-21 23:54:01 +0000,4497,9,171,967,2028,maccman,Alex MacCaw
2880
+ 14451152,2008-04-20 12:05:38 +0000,2011-08-21 20:59:41 +0000,6251,10,20,403,299,mlroach,Matt Laroche
2881
+ 16052754,2008-08-30 08:22:57 +0000,2009-11-25 06:20:05 +0000,24,0,1,5,42,stuntmann82,stuntmann82
2485
2882
  eos
2486
2883
  end
2487
2884
  end
2488
- context "--favorites" do
2885
+ context "--long" do
2489
2886
  before do
2490
- @cli.options = @cli.options.merge("favorites" => true)
2887
+ @cli.options = @cli.options.merge("long" => true)
2491
2888
  end
2492
- it "should sort by number of favorites" do
2889
+ it "should output in long format" do
2493
2890
  @cli.suggest
2494
- $stdout.string.rstrip.should == "stuntmann82 antpires maccman mlroach jtrupiano"
2891
+ $stdout.string.should == <<-eos
2892
+ ID Since Last tweeted at Tweets Favorites Listed Following...
2893
+ 40514587 May 16 2009 Jun 13 08:27 183 2 2 198...
2894
+ 14736332 May 11 2008 Aug 19 19:27 3850 117 99 545...
2895
+ 2006261 Mar 23 2007 Aug 21 15:54 4497 9 171 967...
2896
+ 14451152 Apr 20 2008 Aug 21 12:59 6251 10 20 403...
2897
+ 16052754 Aug 30 2008 Nov 24 2009 24 0 1 5...
2898
+ eos
2495
2899
  end
2496
2900
  end
2497
- context "--followers" do
2901
+ context "--number" do
2498
2902
  before do
2499
- @cli.options = @cli.options.merge("followers" => true)
2903
+ @cli.options = @cli.options.merge("number" => 1)
2904
+ stub_get("/1/users/recommendations.json").
2905
+ with(:query => {:limit => "1", :screen_name => "sferik"}).
2906
+ to_return(:body => fixture("recommendations.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2500
2907
  end
2501
- it "should sort by number of followers" do
2908
+ it "should limit the number of results" do
2502
2909
  @cli.suggest
2503
- $stdout.string.rstrip.should == "stuntmann82 antpires mlroach jtrupiano maccman"
2910
+ a_get("/1/users/recommendations.json").
2911
+ with(:query => {:limit => "1", :screen_name => "sferik"}).
2912
+ should have_been_made
2504
2913
  end
2505
2914
  end
2506
- context "--friends" do
2915
+ context "--reverse" do
2507
2916
  before do
2508
- @cli.options = @cli.options.merge("friends" => true)
2917
+ @cli.options = @cli.options.merge("reverse" => true)
2509
2918
  end
2510
- it "should sort by number of friends" do
2919
+ it "should reverse the order of the sort" do
2511
2920
  @cli.suggest
2512
- $stdout.string.rstrip.should == "stuntmann82 antpires mlroach jtrupiano maccman"
2921
+ $stdout.string.chomp.should == "stuntmann82 mlroach maccman jtrupiano antpires"
2513
2922
  end
2514
2923
  end
2515
- context "--listed" do
2924
+ context "--sort=favorites" do
2516
2925
  before do
2517
- @cli.options = @cli.options.merge("listed" => true)
2926
+ @cli.options = @cli.options.merge("sort" => "favorites")
2518
2927
  end
2519
- it "should sort by number of list memberships" do
2928
+ it "should sort by number of favorites" do
2520
2929
  @cli.suggest
2521
- $stdout.string.rstrip.should == "stuntmann82 antpires mlroach jtrupiano maccman"
2930
+ $stdout.string.chomp.should == "stuntmann82 antpires maccman mlroach jtrupiano"
2522
2931
  end
2523
2932
  end
2524
- context "--long" do
2933
+ context "--sort=followers" do
2525
2934
  before do
2526
- @cli.options = @cli.options.merge("long" => true)
2935
+ @cli.options = @cli.options.merge("sort" => "followers")
2527
2936
  end
2528
- it "should output in long format" do
2937
+ it "should sort by number of followers" do
2529
2938
  @cli.suggest
2530
- $stdout.string.should == <<-eos
2531
- ID Since Tweets Favorites Listed Following Followers Scre...
2532
- 40514587 May 16 2009 183 2 2 198 158 @ant...
2533
- 14736332 May 11 2008 3850 117 99 545 802 @jtr...
2534
- 2006261 Mar 23 2007 4497 9 171 967 2028 @mac...
2535
- 14451152 Apr 20 2008 6251 10 20 403 299 @mlr...
2536
- 16052754 Aug 30 2008 24 0 1 5 42 @stu...
2537
- eos
2939
+ $stdout.string.chomp.should == "stuntmann82 antpires mlroach jtrupiano maccman"
2538
2940
  end
2539
2941
  end
2540
- context "--number" do
2942
+ context "--sort=friends" do
2541
2943
  before do
2542
- @cli.options = @cli.options.merge("number" => 1)
2543
- stub_get("/1/users/recommendations.json").
2544
- with(:query => {:limit => "1", :screen_name => "sferik"}).
2545
- to_return(:body => fixture("recommendations.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2944
+ @cli.options = @cli.options.merge("sort" => "friends")
2546
2945
  end
2547
- it "should limit the number of results" do
2946
+ it "should sort by number of friends" do
2548
2947
  @cli.suggest
2549
- a_get("/1/users/recommendations.json").
2550
- with(:query => {:limit => "1", :screen_name => "sferik"}).
2551
- should have_been_made
2948
+ $stdout.string.chomp.should == "stuntmann82 antpires mlroach jtrupiano maccman"
2552
2949
  end
2553
2950
  end
2554
- context "--posted" do
2951
+ context "--sort=listed" do
2555
2952
  before do
2556
- @cli.options = @cli.options.merge("posted" => true)
2953
+ @cli.options = @cli.options.merge("sort" => "listed")
2557
2954
  end
2558
- it "should sort by the time when Twitter acount was created" do
2955
+ it "should sort by number of list memberships" do
2559
2956
  @cli.suggest
2560
- $stdout.string.rstrip.should == "maccman mlroach jtrupiano stuntmann82 antpires"
2957
+ $stdout.string.chomp.should == "stuntmann82 antpires mlroach jtrupiano maccman"
2561
2958
  end
2562
2959
  end
2563
- context "--reverse" do
2960
+ context "--sort=since" do
2564
2961
  before do
2565
- @cli.options = @cli.options.merge("reverse" => true)
2962
+ @cli.options = @cli.options.merge("sort" => "since")
2566
2963
  end
2567
- it "should reverse the order of the sort" do
2964
+ it "should sort by the time when Twitter acount was created" do
2568
2965
  @cli.suggest
2569
- $stdout.string.rstrip.should == "stuntmann82 mlroach maccman jtrupiano antpires"
2966
+ $stdout.string.chomp.should == "maccman mlroach jtrupiano stuntmann82 antpires"
2570
2967
  end
2571
2968
  end
2572
- context "--tweets" do
2969
+ context "--sort=tweets" do
2573
2970
  before do
2574
- @cli.options = @cli.options.merge("tweets" => true)
2971
+ @cli.options = @cli.options.merge("sort" => "tweets")
2575
2972
  end
2576
2973
  it "should sort by number of Tweets" do
2577
2974
  @cli.suggest
2578
- $stdout.string.rstrip.should == "stuntmann82 antpires jtrupiano maccman mlroach"
2975
+ $stdout.string.chomp.should == "stuntmann82 antpires jtrupiano maccman mlroach"
2976
+ end
2977
+ end
2978
+ context "--sort=tweeted" do
2979
+ before do
2980
+ @cli.options = @cli.options.merge("sort" => "tweeted")
2981
+ end
2982
+ it "should sort by the time of the last Tweet" do
2983
+ @cli.suggest
2984
+ $stdout.string.chomp.should == "stuntmann82 antpires jtrupiano mlroach maccman"
2579
2985
  end
2580
2986
  end
2581
2987
  context "--unsorted" do
@@ -2584,7 +2990,7 @@ ID Since Tweets Favorites Listed Following Followers Scre...
2584
2990
  end
2585
2991
  it "should not be sorted" do
2586
2992
  @cli.suggest
2587
- $stdout.string.rstrip.should == "jtrupiano mlroach antpires maccman stuntmann82"
2993
+ $stdout.string.chomp.should == "jtrupiano mlroach antpires maccman stuntmann82"
2588
2994
  end
2589
2995
  end
2590
2996
  context "with a user passed" do
@@ -2596,7 +3002,7 @@ ID Since Tweets Favorites Listed Following Followers Scre...
2596
3002
  end
2597
3003
  it "should have the correct output" do
2598
3004
  @cli.suggest("sferik")
2599
- $stdout.string.rstrip.should == "antpires jtrupiano maccman mlroach stuntmann82"
3005
+ $stdout.string.chomp.should == "antpires jtrupiano maccman mlroach stuntmann82"
2600
3006
  end
2601
3007
  context "--id" do
2602
3008
  before do
@@ -2630,9 +3036,76 @@ ID Since Tweets Favorites Listed Following Followers Scre...
2630
3036
  end
2631
3037
  it "should have the correct output" do
2632
3038
  @cli.timeline
2633
- $stdout.string.should =~ /@natevillegas/
2634
- $stdout.string.should =~ /RT @gelobautista #riordan RT @WilI_Smith: Yesterday is history\. Tomorrow is a /
2635
- $stdout.string.should =~ /mystery\. Today is a gift\. That's why it's called the present\./
3039
+ $stdout.string.should == <<-eos
3040
+ \e[1m\e[33m @ryanbigg\e[0m
3041
+ Things that have made my life better, in order of greatness: GitHub, Travis
3042
+ CI, the element Oxygen.
3043
+
3044
+ \e[1m\e[33m @sfbike\e[0m
3045
+ Bike to Work Counts in: 73% of morning Market traffic was bikes! 1,031 bikers
3046
+ counted in 1 hour--that's 17 per minute. Way to roll, SF!
3047
+
3048
+ \e[1m\e[33m @levie\e[0m
3049
+ I know you're as rare as leprechauns, but if you're an amazing designer then
3050
+ Box wants to hire you. Email recruiting@box.com
3051
+
3052
+ \e[1m\e[33m @natevillegas\e[0m
3053
+ RT @gelobautista #riordan RT @WilI_Smith: Yesterday is history. Tomorrow is a
3054
+ mystery. Today is a gift. That's why it's called the present.
3055
+
3056
+ \e[1m\e[33m @TD\e[0m
3057
+ @kelseysilver how long will you be in town?
3058
+
3059
+ \e[1m\e[33m @rusashka\e[0m
3060
+ @maciej hahaha :) @gpena together we're going to cover all core 28 languages!
3061
+
3062
+ \e[1m\e[33m @fat\e[0m
3063
+ @stevej @xc i'm going to picket when i get back.
3064
+
3065
+ \e[1m\e[33m @wil\e[0m
3066
+ @0x9900 @paulnivin http://t.co/bwVdtAPe
3067
+
3068
+ \e[1m\e[33m @wangtian\e[0m
3069
+ @tianhonghe @xiangxin72 oh, you can even order specific items?
3070
+
3071
+ \e[1m\e[33m @shinypb\e[0m
3072
+ @kpk Pfft, I think you're forgetting mechanical television, which depended on
3073
+ a clever German. http://t.co/JvLNQCDm @skilldrick @hoverbird
3074
+
3075
+ \e[1m\e[33m @0x9900\e[0m
3076
+ @wil @paulnivin if you want to take you seriously don't say daemontools!
3077
+
3078
+ \e[1m\e[33m @kpk\e[0m
3079
+ @shinypb @skilldrick @hoverbird invented it
3080
+
3081
+ \e[1m\e[33m @skilldrick\e[0m
3082
+ @shinypb Well played :) @hoverbird
3083
+
3084
+ \e[1m\e[33m @sam\e[0m
3085
+ Can someone project the date that I'll get a 27\" retina display?
3086
+
3087
+ \e[1m\e[33m @shinypb\e[0m
3088
+ @skilldrick @hoverbird Wow, I didn't even know they *had* TV in Britain.
3089
+
3090
+ \e[1m\e[33m @bartt\e[0m
3091
+ @noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of
3092
+ fun. Expect improvements in the weeks to come.
3093
+
3094
+ \e[1m\e[33m @skilldrick\e[0m
3095
+ @hoverbird @shinypb You guys must be soooo old, I don't remember the words to
3096
+ the duck tales intro at all.
3097
+
3098
+ \e[1m\e[33m @sean\e[0m
3099
+ @mep Thanks for coming by. Was great to have you.
3100
+
3101
+ \e[1m\e[33m @hoverbird\e[0m
3102
+ @shinypb @trammell it's all suck a \"duck blur\" sometimes.
3103
+
3104
+ \e[1m\e[33m @kelseysilver\e[0m
3105
+ San Francisco here I come! (@ Newark Liberty International Airport (EWR) w/
3106
+ 92 others) http://t.co/eoLANJZw
3107
+
3108
+ eos
2636
3109
  end
2637
3110
  end
2638
3111
  context "--csv" do
@@ -2849,7 +3322,7 @@ ID Posted at Screen name Text
2849
3322
  end
2850
3323
  it "should have the correct output" do
2851
3324
  @cli.trends
2852
- $stdout.string.rstrip.should == "#sevenwordsaftersex Walkman Allen Iverson"
3325
+ $stdout.string.chomp.should == "#sevenwordsaftersex Walkman Allen Iverson"
2853
3326
  end
2854
3327
  context "--exclude-hashtags" do
2855
3328
  before do
@@ -2866,7 +3339,7 @@ ID Posted at Screen name Text
2866
3339
  end
2867
3340
  it "should have the correct output" do
2868
3341
  @cli.trends
2869
- $stdout.string.rstrip.should == "#sevenwordsaftersex Walkman Allen Iverson"
3342
+ $stdout.string.chomp.should == "#sevenwordsaftersex Walkman Allen Iverson"
2870
3343
  end
2871
3344
  end
2872
3345
  context "with a WOEID passed" do
@@ -2881,7 +3354,7 @@ ID Posted at Screen name Text
2881
3354
  end
2882
3355
  it "should have the correct output" do
2883
3356
  @cli.trends("2487956")
2884
- $stdout.string.rstrip.should == "#sevenwordsaftersex Walkman Allen Iverson"
3357
+ $stdout.string.chomp.should == "#sevenwordsaftersex Walkman Allen Iverson"
2885
3358
  end
2886
3359
  end
2887
3360
  end
@@ -2898,7 +3371,7 @@ ID Posted at Screen name Text
2898
3371
  end
2899
3372
  it "should have the correct output" do
2900
3373
  @cli.trend_locations
2901
- $stdout.string.rstrip.should == "Boston New York San Francisco United States Worldwide"
3374
+ $stdout.string.chomp.should == "Boston New York San Francisco United States Worldwide"
2902
3375
  end
2903
3376
  context "--csv" do
2904
3377
  before do
@@ -2906,7 +3379,7 @@ ID Posted at Screen name Text
2906
3379
  end
2907
3380
  it "should output in CSV format" do
2908
3381
  @cli.trend_locations
2909
- $stdout.string.rstrip.should == <<-eos.rstrip
3382
+ $stdout.string.chomp.should == <<-eos.chomp
2910
3383
  WOEID,Parent ID,Type,Name,Country
2911
3384
  2367105,,Town,Boston,United States
2912
3385
  2459115,,Town,New York,United States
@@ -2922,13 +3395,13 @@ WOEID,Parent ID,Type,Name,Country
2922
3395
  end
2923
3396
  it "should output in long format" do
2924
3397
  @cli.trend_locations
2925
- $stdout.string.rstrip.should == <<-eos.rstrip
3398
+ $stdout.string.chomp.should == <<-eos.chomp
2926
3399
  WOEID Parent ID Type Name Country
2927
3400
  2367105 Town Boston United States
2928
3401
  2459115 Town New York United States
2929
3402
  2487956 Town San Francisco United States
2930
3403
  23424977 Country United States United States
2931
- 1 Supername Worldwide
3404
+ 1 Supername Worldwide
2932
3405
  eos
2933
3406
  end
2934
3407
  end
@@ -2938,7 +3411,7 @@ WOEID Parent ID Type Name Country
2938
3411
  end
2939
3412
  it "should reverse the order of the sort" do
2940
3413
  @cli.trend_locations
2941
- $stdout.string.rstrip.should == "Worldwide United States San Francisco New York Boston"
3414
+ $stdout.string.chomp.should == "Worldwide United States San Francisco New York Boston"
2942
3415
  end
2943
3416
  end
2944
3417
  context "--unsorted" do
@@ -2947,7 +3420,7 @@ WOEID Parent ID Type Name Country
2947
3420
  end
2948
3421
  it "should not be sorted" do
2949
3422
  @cli.trend_locations
2950
- $stdout.string.rstrip.should == "Boston Worldwide New York United States San Francisco"
3423
+ $stdout.string.chomp.should == "Boston Worldwide New York United States San Francisco"
2951
3424
  end
2952
3425
  end
2953
3426
  end
@@ -3026,7 +3499,7 @@ WOEID Parent ID Type Name Country
3026
3499
  end
3027
3500
  it "should have the correct output" do
3028
3501
  @cli.update("Testing")
3029
- $stdout.string.should =~ /^Tweet created by @testcli \(8 months ago\)\.$/
3502
+ $stdout.string.split("\n").first.should == "Tweet posted by @testcli."
3030
3503
  end
3031
3504
  end
3032
3505
 
@@ -3044,7 +3517,7 @@ WOEID Parent ID Type Name Country
3044
3517
  end
3045
3518
  it "should have the correct output" do
3046
3519
  @cli.users("sferik", "pengwynn")
3047
- $stdout.string.rstrip.should == "pengwynn sferik"
3520
+ $stdout.string.chomp.should == "pengwynn sferik"
3048
3521
  end
3049
3522
  context "--csv" do
3050
3523
  before do
@@ -3053,37 +3526,59 @@ WOEID Parent ID Type Name Country
3053
3526
  it "should output in CSV format" do
3054
3527
  @cli.users("sferik", "pengwynn")
3055
3528
  $stdout.string.should == <<-eos
3056
- ID,Since,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
3057
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
3058
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
3529
+ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
3530
+ 14100886,2008-03-08 16:34:22 +0000,2012-07-07 20:33:19 +0000,6940,192,358,3427,5457,pengwynn,Wynn Netherland
3531
+ 7505382,2007-07-16 12:59:01 +0000,2012-07-08 18:29:20 +0000,7890,3755,118,212,2262,sferik,Erik Michaels-Ober
3532
+ eos
3533
+ end
3534
+ end
3535
+ context "--long" do
3536
+ before do
3537
+ @cli.options = @cli.options.merge("long" => true)
3538
+ end
3539
+ it "should output in long format" do
3540
+ @cli.users("sferik", "pengwynn")
3541
+ $stdout.string.should == <<-eos
3542
+ ID Since Last tweeted at Tweets Favorites Listed Following...
3543
+ 14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
3544
+ 7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
3059
3545
  eos
3060
3546
  end
3061
3547
  end
3062
- context "--favorites" do
3548
+ context "--reverse" do
3063
3549
  before do
3064
- @cli.options = @cli.options.merge("favorites" => true)
3550
+ @cli.options = @cli.options.merge("reverse" => true)
3551
+ end
3552
+ it "should reverse the order of the sort" do
3553
+ @cli.users("sferik", "pengwynn")
3554
+ $stdout.string.chomp.should == "sferik pengwynn"
3555
+ end
3556
+ end
3557
+ context "--sort=favorites" do
3558
+ before do
3559
+ @cli.options = @cli.options.merge("sort" => "favorites")
3065
3560
  end
3066
3561
  it "should sort by number of favorites" do
3067
3562
  @cli.users("sferik", "pengwynn")
3068
- $stdout.string.rstrip.should == "pengwynn sferik"
3563
+ $stdout.string.chomp.should == "pengwynn sferik"
3069
3564
  end
3070
3565
  end
3071
- context "--followers" do
3566
+ context "--sort=followers" do
3072
3567
  before do
3073
- @cli.options = @cli.options.merge("followers" => true)
3568
+ @cli.options = @cli.options.merge("sort" => "followers")
3074
3569
  end
3075
3570
  it "should sort by number of followers" do
3076
3571
  @cli.users("sferik", "pengwynn")
3077
- $stdout.string.rstrip.should == "sferik pengwynn"
3572
+ $stdout.string.chomp.should == "sferik pengwynn"
3078
3573
  end
3079
3574
  end
3080
- context "--friends" do
3575
+ context "--sort=friends" do
3081
3576
  before do
3082
- @cli.options = @cli.options.merge("friends" => true)
3577
+ @cli.options = @cli.options.merge("sort" => "friends")
3083
3578
  end
3084
3579
  it "should sort by number of friends" do
3085
3580
  @cli.users("sferik", "pengwynn")
3086
- $stdout.string.rstrip.should == "sferik pengwynn"
3581
+ $stdout.string.chomp.should == "sferik pengwynn"
3087
3582
  end
3088
3583
  end
3089
3584
  context "--id" do
@@ -3100,53 +3595,40 @@ ID,Since,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
3100
3595
  should have_been_made
3101
3596
  end
3102
3597
  end
3103
- context "--listed" do
3598
+ context "--sort=listed" do
3104
3599
  before do
3105
- @cli.options = @cli.options.merge("listed" => true)
3600
+ @cli.options = @cli.options.merge("sort" => "listed")
3106
3601
  end
3107
3602
  it "should sort by number of list memberships" do
3108
3603
  @cli.users("sferik", "pengwynn")
3109
- $stdout.string.rstrip.should == "sferik pengwynn"
3110
- end
3111
- end
3112
- context "--long" do
3113
- before do
3114
- @cli.options = @cli.options.merge("long" => true)
3115
- end
3116
- it "should output in long format" do
3117
- @cli.users("sferik", "pengwynn")
3118
- $stdout.string.should == <<-eos
3119
- ID Since Tweets Favorites Listed Following Followers Scre...
3120
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
3121
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
3122
- eos
3604
+ $stdout.string.chomp.should == "sferik pengwynn"
3123
3605
  end
3124
3606
  end
3125
- context "--posted" do
3607
+ context "--sort=since" do
3126
3608
  before do
3127
- @cli.options = @cli.options.merge("posted" => true)
3609
+ @cli.options = @cli.options.merge("sort" => "since")
3128
3610
  end
3129
3611
  it "should sort by the time when Twitter acount was created" do
3130
3612
  @cli.users("sferik", "pengwynn")
3131
- $stdout.string.rstrip.should == "sferik pengwynn"
3613
+ $stdout.string.chomp.should == "sferik pengwynn"
3132
3614
  end
3133
3615
  end
3134
- context "--reverse" do
3616
+ context "--sort=tweets" do
3135
3617
  before do
3136
- @cli.options = @cli.options.merge("reverse" => true)
3618
+ @cli.options = @cli.options.merge("sort" => "tweets")
3137
3619
  end
3138
- it "should reverse the order of the sort" do
3620
+ it "should sort by number of Tweets" do
3139
3621
  @cli.users("sferik", "pengwynn")
3140
- $stdout.string.rstrip.should == "sferik pengwynn"
3622
+ $stdout.string.chomp.should == "pengwynn sferik"
3141
3623
  end
3142
3624
  end
3143
- context "--tweets" do
3625
+ context "--sort=tweeted" do
3144
3626
  before do
3145
- @cli.options = @cli.options.merge("tweets" => true)
3627
+ @cli.options = @cli.options.merge("sort" => "tweeted")
3146
3628
  end
3147
- it "should sort by number of Tweets" do
3629
+ it "should sort by the time of the last Tweet" do
3148
3630
  @cli.users("sferik", "pengwynn")
3149
- $stdout.string.rstrip.should == "sferik pengwynn"
3631
+ $stdout.string.chomp.should == "pengwynn sferik"
3150
3632
  end
3151
3633
  end
3152
3634
  context "--unsorted" do
@@ -3155,7 +3637,7 @@ ID Since Tweets Favorites Listed Following Followers Scre...
3155
3637
  end
3156
3638
  it "should not be sorted" do
3157
3639
  @cli.users("sferik", "pengwynn")
3158
- $stdout.string.rstrip.should == "sferik pengwynn"
3640
+ $stdout.string.chomp.should == "pengwynn sferik"
3159
3641
  end
3160
3642
  end
3161
3643
  end
@@ -3184,16 +3666,16 @@ ID Since Tweets Favorites Listed Following Followers Scre...
3184
3666
  $stdout.string.should == <<-eos
3185
3667
  ID 7505382
3186
3668
  Name Erik Michaels-Ober
3187
- Bio A mind forever voyaging through strange seas of thought, alone.
3669
+ Bio Vagabond.
3188
3670
  Location San Francisco
3189
3671
  Status Not following
3190
- Last update RT @tenderlove: [ANN] sqlite3-ruby => sqlite3 (10 months ago)
3672
+ Last update @goldman You're near my home town! Say hi to Woodstock for me. (7 months ago)
3191
3673
  Since Jul 16 2007 (4 years ago)
3192
- Tweets 3,479
3193
- Favorites 1,040
3194
- Listed 41
3195
- Following 197
3196
- Followers 1,048
3674
+ Tweets 7,890
3675
+ Favorites 3,755
3676
+ Listed 118
3677
+ Following 212
3678
+ Followers 2,262
3197
3679
  URL https://github.com/sferik
3198
3680
  eos
3199
3681
  end
@@ -3205,7 +3687,7 @@ URL https://github.com/sferik
3205
3687
  @cli.whois("sferik")
3206
3688
  $stdout.string.should == <<-eos
3207
3689
  ID,Verified,Name,Screen name,Bio,Location,Following,Last update,Lasted updated at,Since,Tweets,Favorites,Listed,Following,Followers,URL
3208
- 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
3690
+ 7505382,false,Erik Michaels-Ober,sferik,Vagabond.,San Francisco,false,@goldman You're near my home town! Say hi to Woodstock for me.,2012-07-08 18:29:20 +0000,2007-07-16 12:59:01 +0000,7890,3755,118,212,2262,https://github.com/sferik
3209
3691
  eos
3210
3692
  end
3211
3693
  end