t 0.9.9 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/spec/rcfile_spec.rb CHANGED
@@ -1,22 +1,23 @@
1
1
  # encoding: utf-8
2
2
  require 'helper'
3
3
 
4
- describe RCFile do
4
+ describe T::RCFile do
5
5
 
6
- after do
7
- RCFile.instance.reset
6
+ after :each do
7
+ T::RCFile.instance.reset
8
+ File.delete(project_path + "/tmp/trc") if File.exist?(project_path + "/tmp/trc")
8
9
  end
9
10
 
10
11
  it 'is a singleton' do
11
- RCFile.should be_a Class
12
+ T::RCFile.should be_a Class
12
13
  lambda do
13
- RCFile.new
14
+ T::RCFile.new
14
15
  end.should raise_error(NoMethodError, /private method `new' called/)
15
16
  end
16
17
 
17
18
  describe '#[]' do
18
19
  it 'should return the profiles for a user' do
19
- rcfile = RCFile.instance
20
+ rcfile = T::RCFile.instance
20
21
  rcfile.path = fixture_path + "/.trc"
21
22
  rcfile['testcli'].keys.should == ['abc123']
22
23
  end
@@ -24,7 +25,7 @@ describe RCFile do
24
25
 
25
26
  describe '#[]=' do
26
27
  it 'should add a profile for a user' do
27
- rcfile = RCFile.instance
28
+ rcfile = T::RCFile.instance
28
29
  rcfile.path = project_path + "/tmp/trc"
29
30
  rcfile['testcli'] = {
30
31
  'abc123' => {
@@ -38,7 +39,7 @@ describe RCFile do
38
39
  rcfile['testcli'].keys.should == ['abc123']
39
40
  end
40
41
  it 'should write the data to disk' do
41
- rcfile = RCFile.instance
42
+ rcfile = T::RCFile.instance
42
43
  rcfile.path = project_path + "/tmp/trc"
43
44
  rcfile['testcli'] = {
44
45
  'abc123' => {
@@ -52,7 +53,7 @@ describe RCFile do
52
53
  rcfile['testcli'].keys.should == ['abc123']
53
54
  end
54
55
  it 'should not be world readable or writable' do
55
- rcfile = RCFile.instance
56
+ rcfile = T::RCFile.instance
56
57
  rcfile.path = project_path + "/tmp/trc"
57
58
  rcfile['testcli'] = {
58
59
  'abc123' => {
@@ -69,7 +70,7 @@ describe RCFile do
69
70
 
70
71
  describe '#configuration' do
71
72
  it 'should return configuration' do
72
- rcfile = RCFile.instance
73
+ rcfile = T::RCFile.instance
73
74
  rcfile.path = fixture_path + "/.trc"
74
75
  rcfile.configuration.keys.should == ['default_profile']
75
76
  end
@@ -77,7 +78,7 @@ describe RCFile do
77
78
 
78
79
  describe '#active_consumer_key' do
79
80
  it 'should return default consumer key' do
80
- rcfile = RCFile.instance
81
+ rcfile = T::RCFile.instance
81
82
  rcfile.path = fixture_path + "/.trc"
82
83
  rcfile.active_consumer_key.should == 'abc123'
83
84
  end
@@ -85,7 +86,7 @@ describe RCFile do
85
86
 
86
87
  describe '#active_consumer_secret' do
87
88
  it 'should return default consumer secret' do
88
- rcfile = RCFile.instance
89
+ rcfile = T::RCFile.instance
89
90
  rcfile.path = fixture_path + "/.trc"
90
91
  rcfile.active_consumer_secret.should == 'asdfasd223sd2'
91
92
  end
@@ -93,7 +94,7 @@ describe RCFile do
93
94
 
94
95
  describe '#active_profile' do
95
96
  it 'should return default profile' do
96
- rcfile = RCFile.instance
97
+ rcfile = T::RCFile.instance
97
98
  rcfile.path = fixture_path + "/.trc"
98
99
  rcfile.active_profile.should == ['testcli', 'abc123']
99
100
  end
@@ -101,13 +102,13 @@ describe RCFile do
101
102
 
102
103
  describe '#active_profile=' do
103
104
  it 'should set default profile' do
104
- rcfile = RCFile.instance
105
+ rcfile = T::RCFile.instance
105
106
  rcfile.path = project_path + "/tmp/trc"
106
107
  rcfile.active_profile = {'username' => 'testcli', 'consumer_key' => 'abc123'}
107
108
  rcfile.active_profile.should == ['testcli', 'abc123']
108
109
  end
109
110
  it 'should write the data to disk' do
110
- rcfile = RCFile.instance
111
+ rcfile = T::RCFile.instance
111
112
  rcfile.path = project_path + "/tmp/trc"
112
113
  rcfile.active_profile = {'username' => 'testcli', 'consumer_key' => 'abc123'}
113
114
  rcfile.active_profile.should == ['testcli', 'abc123']
@@ -116,7 +117,7 @@ describe RCFile do
116
117
 
117
118
  describe '#active_token' do
118
119
  it 'should return default token' do
119
- rcfile = RCFile.instance
120
+ rcfile = T::RCFile.instance
120
121
  rcfile.path = fixture_path + "/.trc"
121
122
  rcfile.active_token.should == '428004849-cebdct6bwobn'
122
123
  end
@@ -124,7 +125,7 @@ describe RCFile do
124
125
 
125
126
  describe '#active_secret' do
126
127
  it 'should return default secret' do
127
- rcfile = RCFile.instance
128
+ rcfile = T::RCFile.instance
128
129
  rcfile.path = fixture_path + "/.trc"
129
130
  rcfile.active_secret.should == 'epzrjvxtumoc'
130
131
  end
@@ -133,9 +134,9 @@ describe RCFile do
133
134
  describe '#delete' do
134
135
  it 'should delete the rcfile' do
135
136
  path = project_path + "/tmp/trc"
136
- FileUtils.touch(path)
137
+ File.open(path, 'w'){|file| file.write(YAML.dump({}))}
137
138
  File.exist?(path).should be_true
138
- rcfile = RCFile.instance
139
+ rcfile = T::RCFile.instance
139
140
  rcfile.path = path
140
141
  rcfile.delete
141
142
  File.exist?(path).should be_false
@@ -145,14 +146,14 @@ describe RCFile do
145
146
  describe '#empty?' do
146
147
  context 'when a non-empty file exists' do
147
148
  it 'should return false' do
148
- rcfile = RCFile.instance
149
+ rcfile = T::RCFile.instance
149
150
  rcfile.path = fixture_path + "/.trc"
150
151
  rcfile.empty?.should be_false
151
152
  end
152
153
  end
153
154
  context 'when file does not exist at path' do
154
155
  it 'should return true' do
155
- rcfile = RCFile.instance
156
+ rcfile = T::RCFile.instance
156
157
  rcfile.path = File.expand_path('../fixtures/foo', __FILE__)
157
158
  rcfile.empty?.should be_true
158
159
  end
@@ -162,14 +163,14 @@ describe RCFile do
162
163
  describe '#load' do
163
164
  context 'when file exists at path' do
164
165
  it 'should load data from file' do
165
- rcfile = RCFile.instance
166
+ rcfile = T::RCFile.instance
166
167
  rcfile.path = fixture_path + "/.trc"
167
168
  rcfile.load['profiles']['testcli']['abc123']['username'].should == 'testcli'
168
169
  end
169
170
  end
170
171
  context 'when file does not exist at path' do
171
172
  it 'should load default structure' do
172
- rcfile = RCFile.instance
173
+ rcfile = T::RCFile.instance
173
174
  rcfile.path = File.expand_path('../fixtures/foo', __FILE__)
174
175
  rcfile.load.keys.sort.should == ['configuration', 'profiles']
175
176
  end
@@ -178,18 +179,18 @@ describe RCFile do
178
179
 
179
180
  describe '#path' do
180
181
  it 'should default to ~/.trc' do
181
- RCFile.instance.path.should == File.join(File.expand_path('~'), '.trc')
182
+ T::RCFile.instance.path.should == File.join(File.expand_path('~'), '.trc')
182
183
  end
183
184
  end
184
185
 
185
186
  describe '#path=' do
186
187
  it 'should override path' do
187
- rcfile = RCFile.instance
188
+ rcfile = T::RCFile.instance
188
189
  rcfile.path = project_path + "/tmp/trc"
189
190
  rcfile.path.should == project_path + "/tmp/trc"
190
191
  end
191
192
  it 'should reload data' do
192
- rcfile = RCFile.instance
193
+ rcfile = T::RCFile.instance
193
194
  rcfile.path = fixture_path + "/.trc"
194
195
  rcfile['testcli']['abc123']['username'].should == 'testcli'
195
196
  end
@@ -197,7 +198,7 @@ describe RCFile do
197
198
 
198
199
  describe '#profiles' do
199
200
  it 'should return profiles' do
200
- rcfile = RCFile.instance
201
+ rcfile = T::RCFile.instance
201
202
  rcfile.path = fixture_path + "/.trc"
202
203
  rcfile.profiles.keys.should == ['testcli']
203
204
  end
data/spec/search_spec.rb CHANGED
@@ -13,9 +13,8 @@ describe T::Search 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
  @search = T::Search.new
20
19
  @old_stderr = $stderr
21
20
  $stderr = StringIO.new
@@ -23,7 +22,8 @@ describe T::Search 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
@@ -42,8 +42,82 @@ describe T::Search do
42
42
  end
43
43
  it "should have the correct output" do
44
44
  @search.all("twitter")
45
- $stdout.string.should =~ /@JessRoveel/
46
- $stdout.string.should =~ /Pondre lo mas importante de Hamlet en Twitter para recordarlo mejor :D/
45
+ $stdout.string.should == <<-eos
46
+
47
+ \e[1m\e[33m @Somedude\e[0m
48
+ Gotta get right with twitter
49
+
50
+ \e[1m\e[33m @TestMan\e[0m
51
+ Twitter to Facebook test
52
+
53
+ \e[1m\e[33m @Jena_Jones\e[0m
54
+ test my new twitter..... :)
55
+
56
+ \e[1m\e[33m @misterpic\e[0m
57
+ Wallah there should be a test before you can get a twitter account some
58
+ people are so dumb... better
59
+
60
+ \e[1m\e[33m @RRabbit\e[0m
61
+ Twitter is kinda fun... Kinda!
62
+
63
+ \e[1m\e[33m @JessRoveel\e[0m
64
+ Pondre lo mas importante de Hamlet en Twitter para recordarlo mejor :D
65
+
66
+ \e[1m\e[33m @lauravgeest\e[0m
67
+ Twitter doet het al 7 uur niet meer
68
+
69
+ \e[1m\e[33m @Jenny_Bearx333\e[0m
70
+ I keep thinking that twitter is @instagram , and therefore double tap all the
71
+ pics I like... #NotWorking
72
+
73
+ \e[1m\e[33m @misspoxtonX\e[0m
74
+ RT @jordantaylorhi: twitter friends > twats at school
75
+
76
+ \e[1m\e[33m @PatrickBrickman\e[0m
77
+ RT @zeus30hightower: Too all Bama fans and followers my cousin mark Barron
78
+ doesn't have a twitter so please disregard any tweets from that user
79
+
80
+ \e[1m\e[33m @KolonelX\e[0m
81
+ Ik refresh twitter op me telefoon terwijl ik tweetdeck voor me open heb staan
82
+
83
+ \e[1m\e[33m @VLGPRLG5\e[0m
84
+ @mikeyway and you too RT @NimcyGD: @gerardway Get your ass back to twitter,
85
+ okay? :3
86
+
87
+ \e[1m\e[33m @xRhiBabyx\e[0m
88
+ Trying to persuade the boyf to get on twitter and failing. Help? @holly_haime
89
+ @Ckwarburton @samwarburton_ @chrishaime @rowloboy
90
+
91
+ \e[1m\e[33m @juliotrv\e[0m
92
+ RT @lookinglassbr: Lançamentos outono-inverno 2012...CONFIRA em
93
+ http://t.co/YAk8OXp7 http://t.co/fmmrVrbG
94
+
95
+ \e[1m\e[33m @shanleyaustin27\e[0m
96
+ RT @caaammmmi: @shanleyaustin27 .....and this hahahahaa http://t.co/wzCMx6ZU
97
+
98
+ \e[1m\e[33m @Dame_Valuta\e[0m
99
+ RT @Paiser10: Great @chelseafc training at Nou Camp! #cfc
100
+ http://t.co/k00TnRyR
101
+
102
+ \e[1m\e[33m @miss_indyiah\e[0m
103
+ smh, @IndianaHustle done turned into a twitter addict..fuck goin on lol ?
104
+
105
+ \e[1m\e[33m @CAROLINEWOLLER\e[0m
106
+ RT @Mark_Ingram28: To all Bama fans and followers, please unfollow and pay no
107
+ attention to any user posing to be Mark Barron. My bro doesn't have a
108
+ twitter!
109
+
110
+ \e[1m\e[33m @shelbytrenchdww\e[0m
111
+ RT @The90sLife: Admit it, we all have a cabinet that looks like this.
112
+ http://t.co/gQEkQw5G
113
+
114
+ \e[1m\e[33m @kabos84\e[0m
115
+ RT @JF_q8: بالله عليكم ،، مو عيب !!!
116
+
117
+
118
+ .. http://t.co/e29GV7Ow
119
+
120
+ eos
47
121
  end
48
122
  context "--csv" do
49
123
  before do
@@ -173,9 +247,12 @@ ID Posted at Screen name Text
173
247
  end
174
248
  it "should have the correct output" do
175
249
  @search.favorites("twitter")
176
- $stdout.string.should =~ /@bartt/
177
- $stdout.string.should =~ /@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons\. Lot’s/
178
- $stdout.string.should =~ /fun\. Expect improvements in the weeks to come\./
250
+ $stdout.string.should == <<-eos
251
+ \e[1m\e[33m @bartt\e[0m
252
+ @noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of
253
+ fun. Expect improvements in the weeks to come.
254
+
255
+ eos
179
256
  end
180
257
  context "--csv" do
181
258
  before do
@@ -214,6 +291,34 @@ ID Posted at Screen name Text
214
291
  should have_been_made.times(3)
215
292
  end
216
293
  end
294
+ context "with a user passed" do
295
+ before do
296
+ stub_get("/1/favorites/sferik.json").
297
+ with(:query => {:count => "200"}).
298
+ to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
299
+ stub_get("/1/favorites/sferik.json").
300
+ with(:query => {:count => "200", :max_id => "194546264212385792"}).
301
+ to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
302
+ end
303
+ it "should request the correct resource" do
304
+ @search.favorites("sferik", "twitter")
305
+ a_get("/1/favorites/sferik.json").
306
+ with(:query => {:count => "200"}).
307
+ should have_been_made
308
+ a_get("/1/favorites/sferik.json").
309
+ with(:query => {:count => "200", :max_id => "194546264212385792"}).
310
+ should have_been_made
311
+ end
312
+ it "should have the correct output" do
313
+ @search.favorites("sferik", "twitter")
314
+ $stdout.string.should == <<-eos
315
+ \e[1m\e[33m @bartt\e[0m
316
+ @noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of
317
+ fun. Expect improvements in the weeks to come.
318
+
319
+ eos
320
+ end
321
+ end
217
322
  end
218
323
 
219
324
  describe "#mentions" do
@@ -236,9 +341,12 @@ ID Posted at Screen name Text
236
341
  end
237
342
  it "should have the correct output" do
238
343
  @search.mentions("twitter")
239
- $stdout.string.should =~ /@bartt/
240
- $stdout.string.should =~ /@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons\. Lot’s/
241
- $stdout.string.should =~ /fun\. Expect improvements in the weeks to come\./
344
+ $stdout.string.should == <<-eos
345
+ \e[1m\e[33m @bartt\e[0m
346
+ @noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of
347
+ fun. Expect improvements in the weeks to come.
348
+
349
+ eos
242
350
  end
243
351
  context "--csv" do
244
352
  before do
@@ -299,9 +407,12 @@ ID Posted at Screen name Text
299
407
  end
300
408
  it "should have the correct output" do
301
409
  @search.list("presidents", "twitter")
302
- $stdout.string.should =~ /@bartt/
303
- $stdout.string.should =~ /@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons\. Lot’s/
304
- $stdout.string.should =~ /fun\. Expect improvements in the weeks to come\./
410
+ $stdout.string.should == <<-eos
411
+ \e[1m\e[33m @bartt\e[0m
412
+ @noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of
413
+ fun. Expect improvements in the weeks to come.
414
+
415
+ eos
305
416
  end
306
417
  context "--csv" do
307
418
  before do
@@ -390,9 +501,12 @@ ID Posted at Screen name Text
390
501
  end
391
502
  it "should have the correct output" do
392
503
  @search.retweets("twitter")
393
- $stdout.string.should =~ /@bartt/
394
- $stdout.string.should =~ /@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons\. Lot’s/
395
- $stdout.string.should =~ /fun\. Expect improvements in the weeks to come\./
504
+ $stdout.string.should == <<-eos
505
+ \e[1m\e[33m @bartt\e[0m
506
+ @noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of
507
+ fun. Expect improvements in the weeks to come.
508
+
509
+ eos
396
510
  end
397
511
  context "--csv" do
398
512
  before do
@@ -431,6 +545,34 @@ ID Posted at Screen name Text
431
545
  should have_been_made.times(3)
432
546
  end
433
547
  end
548
+ context "with a user passed" do
549
+ before do
550
+ stub_get("/1/statuses/retweeted_by_user.json").
551
+ with(:query => {:count => "200", :screen_name => "sferik"}).
552
+ to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
553
+ stub_get("/1/statuses/retweeted_by_user.json").
554
+ with(:query => {:count => "200", :max_id => "194546264212385792", :screen_name => "sferik"}).
555
+ to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
556
+ end
557
+ it "should request the correct resource" do
558
+ @search.retweets("sferik", "twitter")
559
+ a_get("/1/statuses/retweeted_by_user.json").
560
+ with(:query => {:count => "200", :screen_name => "sferik"}).
561
+ should have_been_made
562
+ a_get("/1/statuses/retweeted_by_user.json").
563
+ with(:query => {:count => "200", :max_id => "194546264212385792", :screen_name => "sferik"}).
564
+ should have_been_made
565
+ end
566
+ it "should have the correct output" do
567
+ @search.retweets("sferik", "twitter")
568
+ $stdout.string.should == <<-eos
569
+ \e[1m\e[33m @bartt\e[0m
570
+ @noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of
571
+ fun. Expect improvements in the weeks to come.
572
+
573
+ eos
574
+ end
575
+ end
434
576
  end
435
577
 
436
578
  describe "#timeline" do
@@ -453,9 +595,12 @@ ID Posted at Screen name Text
453
595
  end
454
596
  it "should have the correct output" do
455
597
  @search.timeline("twitter")
456
- $stdout.string.should =~ /@bartt/
457
- $stdout.string.should =~ /@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons\. Lot’s/
458
- $stdout.string.should =~ /fun\. Expect improvements in the weeks to come\./
598
+ $stdout.string.should == <<-eos
599
+ \e[1m\e[33m @bartt\e[0m
600
+ @noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of
601
+ fun. Expect improvements in the weeks to come.
602
+
603
+ eos
459
604
  end
460
605
  context "--csv" do
461
606
  before do
@@ -514,9 +659,12 @@ ID Posted at Screen name Text
514
659
  end
515
660
  it "should have the correct output" do
516
661
  @search.timeline("sferik", "twitter")
517
- $stdout.string.should =~ /@bartt/
518
- $stdout.string.should =~ /@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons\. Lot’s/
519
- $stdout.string.should =~ /fun\. Expect improvements in the weeks to come\./
662
+ $stdout.string.should == <<-eos
663
+ \e[1m\e[33m @bartt\e[0m
664
+ @noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of
665
+ fun. Expect improvements in the weeks to come.
666
+
667
+ eos
520
668
  end
521
669
  context "--csv" do
522
670
  before do
@@ -580,37 +728,27 @@ ID Posted at Screen name Text
580
728
 
581
729
  describe "#users" do
582
730
  before do
583
- 1.upto(50).each do |page|
584
- stub_get("/1/users/search.json").
585
- with(:query => {:page => page.to_s, :per_page => "20", :q => "Erik", }).
586
- to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
587
- end
731
+ stub_get("/1/users/search.json").
732
+ with(:query => {:page => "1", :q => "Erik"}).
733
+ to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
734
+ stub_get("/1/users/search.json").
735
+ with(:query => {:page => "2", :q => "Erik"}).
736
+ to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
588
737
  end
589
738
  it "should request the correct resource" do
590
739
  @search.users("Erik")
591
740
  1.upto(50).each do |page|
592
741
  a_get("/1/users/search.json").
593
- with(:query => {:page => page.to_s, :per_page => "20", :q => "Erik", }).
742
+ with(:query => {:page => "1", :q => "Erik"}).
743
+ should have_been_made
744
+ a_get("/1/users/search.json").
745
+ with(:query => {:page => "2", :q => "Erik"}).
594
746
  should have_been_made
595
747
  end
596
748
  end
597
749
  it "should have the correct output" do
598
750
  @search.users("Erik")
599
- $stdout.string.should == <<-eos
600
- pengwynn pengwynn pengwynn pengwynn pengwynn pengwynn pengwynn pengwynn
601
- pengwynn pengwynn pengwynn pengwynn pengwynn pengwynn pengwynn pengwynn
602
- pengwynn pengwynn pengwynn pengwynn pengwynn pengwynn pengwynn pengwynn
603
- pengwynn pengwynn pengwynn pengwynn pengwynn pengwynn pengwynn pengwynn
604
- pengwynn pengwynn pengwynn pengwynn pengwynn pengwynn pengwynn pengwynn
605
- pengwynn pengwynn pengwynn pengwynn pengwynn pengwynn pengwynn pengwynn
606
- pengwynn pengwynn sferik sferik sferik sferik sferik sferik
607
- sferik sferik sferik sferik sferik sferik sferik sferik
608
- sferik sferik sferik sferik sferik sferik sferik sferik
609
- sferik sferik sferik sferik sferik sferik sferik sferik
610
- sferik sferik sferik sferik sferik sferik sferik sferik
611
- sferik sferik sferik sferik sferik sferik sferik sferik
612
- sferik sferik sferik sferik
613
- eos
751
+ $stdout.string.chomp.should == "pengwynn sferik"
614
752
  end
615
753
  context "--csv" do
616
754
  before do
@@ -619,107 +757,9 @@ sferik sferik sferik sferik
619
757
  it "should output in CSV format" do
620
758
  @search.users("Erik")
621
759
  $stdout.string.should == <<-eos
622
- ID,Since,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
623
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
624
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
625
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
626
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
627
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
628
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
629
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
630
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
631
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
632
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
633
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
634
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
635
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
636
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
637
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
638
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
639
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
640
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
641
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
642
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
643
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
644
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
645
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
646
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
647
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
648
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
649
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
650
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
651
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
652
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
653
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
654
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
655
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
656
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
657
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
658
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
659
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
660
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
661
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
662
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
663
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
664
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
665
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
666
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
667
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
668
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
669
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
670
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
671
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
672
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
673
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
674
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
675
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
676
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
677
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
678
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
679
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
680
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
681
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
682
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
683
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
684
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
685
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
686
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
687
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
688
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
689
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
690
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
691
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
692
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
693
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
694
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
695
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
696
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
697
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
698
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
699
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
700
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
701
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
702
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
703
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
704
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
705
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
706
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
707
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
708
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
709
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
710
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
711
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
712
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
713
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
714
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
715
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
716
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
717
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
718
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
719
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
720
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
721
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
722
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
760
+ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
761
+ 14100886,2008-03-08 16:34:22 +0000,2012-07-07 20:33:19 +0000,6940,192,358,3427,5457,pengwynn,Wynn Netherland
762
+ 7505382,2007-07-16 12:59:01 +0000,2012-07-08 18:29:20 +0000,7890,3755,118,212,2262,sferik,Erik Michaels-Ober
723
763
  eos
724
764
  end
725
765
  end
@@ -730,120 +770,103 @@ ID,Since,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
730
770
  it "should output in long format" do
731
771
  @search.users("Erik")
732
772
  $stdout.string.should == <<-eos
733
- ID Since Tweets Favorites Listed Following Followers Scre...
734
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
735
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
736
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
737
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
738
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
739
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
740
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
741
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
742
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
743
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
744
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
745
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
746
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
747
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
748
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
749
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
750
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
751
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
752
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
753
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
754
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
755
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
756
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
757
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
758
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
759
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
760
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
761
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
762
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
763
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
764
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
765
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
766
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
767
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
768
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
769
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
770
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
771
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
772
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
773
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
774
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
775
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
776
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
777
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
778
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
779
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
780
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
781
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
782
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
783
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
784
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
785
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
786
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
787
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
788
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
789
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
790
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
791
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
792
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
793
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
794
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
795
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
796
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
797
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
798
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
799
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
800
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
801
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
802
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
803
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
804
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
805
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
806
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
807
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
808
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
809
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
810
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
811
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
812
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
813
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
814
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
815
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
816
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
817
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
818
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
819
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
820
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
821
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
822
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
823
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
824
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
825
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
826
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
827
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
828
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
829
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
830
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
831
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
832
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
833
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
773
+ ID Since Last tweeted at Tweets Favorites Listed Following...
774
+ 14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
775
+ 7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
834
776
  eos
835
777
  end
836
778
  end
779
+ context "--reverse" do
780
+ before do
781
+ @search.options = @search.options.merge("reverse" => true)
782
+ end
783
+ it "should reverse the order of the sort" do
784
+ @search.users("Erik")
785
+ $stdout.string.chomp.should == "sferik pengwynn"
786
+ end
787
+ end
788
+ context "--sort=favorites" do
789
+ before do
790
+ @search.options = @search.options.merge("sort" => "favorites")
791
+ end
792
+ it "should sort by number of favorites" do
793
+ @search.users("Erik")
794
+ $stdout.string.chomp.should == "pengwynn sferik"
795
+ end
796
+ end
797
+ context "--sort=followers" do
798
+ before do
799
+ @search.options = @search.options.merge("sort" => "followers")
800
+ end
801
+ it "should sort by number of followers" do
802
+ @search.users("Erik")
803
+ $stdout.string.chomp.should == "sferik pengwynn"
804
+ end
805
+ end
806
+ context "--sort=friends" do
807
+ before do
808
+ @search.options = @search.options.merge("sort" => "friends")
809
+ end
810
+ it "should sort by number of friends" do
811
+ @search.users("Erik")
812
+ $stdout.string.chomp.should == "sferik pengwynn"
813
+ end
814
+ end
815
+ context "--sort=listed" do
816
+ before do
817
+ @search.options = @search.options.merge("sort" => "listed")
818
+ end
819
+ it "should sort by number of list memberships" do
820
+ @search.users("Erik")
821
+ $stdout.string.chomp.should == "sferik pengwynn"
822
+ end
823
+ end
824
+ context "--sort=since" do
825
+ before do
826
+ @search.options = @search.options.merge("sort" => "since")
827
+ end
828
+ it "should sort by the time wshen Twitter account was created" do
829
+ @search.users("Erik")
830
+ $stdout.string.chomp.should == "sferik pengwynn"
831
+ end
832
+ end
833
+ context "--sort=tweets" do
834
+ before do
835
+ @search.options = @search.options.merge("sort" => "tweets")
836
+ end
837
+ it "should sort by number of Tweets" do
838
+ @search.users("Erik")
839
+ $stdout.string.chomp.should == "pengwynn sferik"
840
+ end
841
+ end
842
+ context "--sort=tweeted" do
843
+ before do
844
+ @search.options = @search.options.merge("sort" => "tweeted")
845
+ end
846
+ it "should sort by the time of the last Tweet" do
847
+ @search.users("Erik")
848
+ $stdout.string.chomp.should == "pengwynn sferik"
849
+ end
850
+ end
851
+ context "--unsorted" do
852
+ before do
853
+ @search.options = @search.options.merge("unsorted" => true)
854
+ end
855
+ it "should not be sorted" do
856
+ @search.users("Erik")
857
+ $stdout.string.chomp.should == "pengwynn sferik"
858
+ end
859
+ end
837
860
  context "Twitter is down" do
838
861
  it "should retry 3 times and then raise an error" do
839
862
  stub_get("/1/users/search.json").
840
- with(:query => {:page => "50", :per_page => "20", :q => "Erik", }).
863
+ with(:query => {:page => "2", :q => "Erik", }).
841
864
  to_return(:status => 502)
842
865
  lambda do
843
866
  @search.users("Erik")
844
867
  end.should raise_error("Twitter is down or being upgraded.")
845
868
  a_get("/1/users/search.json").
846
- with(:query => {:page => "50", :per_page => "20", :q => "Erik", }).
869
+ with(:query => {:page => "2", :q => "Erik", }).
847
870
  should have_been_made.times(3)
848
871
  end
849
872
  end