t 0.6.4 → 0.7.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
@@ -25,7 +25,7 @@ describe RCFile do
25
25
  describe '#[]=' do
26
26
  it 'should add a profile for a user' do
27
27
  rcfile = RCFile.instance
28
- rcfile.path = '/tmp/trc'
28
+ rcfile.path = project_path + "/tmp/trc"
29
29
  rcfile['testcli'] = {
30
30
  'abc123' => {
31
31
  :username => 'testcli',
@@ -39,7 +39,7 @@ describe RCFile do
39
39
  end
40
40
  it 'should write the data to disk' do
41
41
  rcfile = RCFile.instance
42
- rcfile.path = '/tmp/trc'
42
+ rcfile.path = project_path + "/tmp/trc"
43
43
  rcfile['testcli'] = {
44
44
  'abc123' => {
45
45
  :username => 'testcli',
@@ -88,13 +88,13 @@ describe RCFile do
88
88
  describe '#default_profile=' do
89
89
  it 'should set default profile' do
90
90
  rcfile = RCFile.instance
91
- rcfile.path = File.expand_path('/tmp/trc', __FILE__)
91
+ rcfile.path = project_path + "/tmp/trc"
92
92
  rcfile.default_profile = {'username' => 'testcli', 'consumer_key' => 'abc123'}
93
93
  rcfile.default_profile.should == ['testcli', 'abc123']
94
94
  end
95
95
  it 'should write the data to disk' do
96
96
  rcfile = RCFile.instance
97
- rcfile.path = '/tmp/trc'
97
+ rcfile.path = project_path + "/tmp/trc"
98
98
  rcfile.default_profile = {'username' => 'testcli', 'consumer_key' => 'abc123'}
99
99
  rcfile.default_profile.should == ['testcli', 'abc123']
100
100
  end
@@ -118,7 +118,7 @@ describe RCFile do
118
118
 
119
119
  describe '#delete' do
120
120
  it 'should delete the rcfile' do
121
- path = '/tmp/trc'
121
+ path = project_path + "/tmp/trc"
122
122
  FileUtils.touch(path)
123
123
  File.exist?(path).should be_true
124
124
  rcfile = RCFile.instance
@@ -171,8 +171,8 @@ describe RCFile do
171
171
  describe '#path=' do
172
172
  it 'should override path' do
173
173
  rcfile = RCFile.instance
174
- rcfile.path = '/tmp/trc'
175
- rcfile.path.should == '/tmp/trc'
174
+ rcfile.path = project_path + "/tmp/trc"
175
+ rcfile.path.should == project_path + "/tmp/trc"
176
176
  end
177
177
  it 'should reload data' do
178
178
  rcfile = RCFile.instance
data/spec/search_spec.rb CHANGED
@@ -52,11 +52,41 @@ describe T::Search do
52
52
  kabos84: RT @JF_q8: بالله عليكم ،، مو عيب !!! .. http://t.co/e29GV7Ow (7 months ago)
53
53
  eos
54
54
  end
55
+ context "--csv" do
56
+ before do
57
+ @search.options = @search.options.merge(:csv => true)
58
+ end
59
+ it "should output in CSV format" do
60
+ @search.all("twitter")
61
+ $stdout.string.should == <<-eos
62
+ ID,Posted at,Screen name,Text
63
+ 194521262415032320,2011-04-23 20:20:57 +0000,JessRoveel,Pondre lo mas importante de Hamlet en Twitter para recordarlo mejor :D
64
+ 194521262326951936,2011-04-23 20:20:57 +0000,lauravgeest,Twitter doet het al 7 uur niet meer
65
+ 194521262234669056,2011-04-23 20:20:57 +0000,Jenny_Bearx333,"I keep thinking that twitter is @instagram , and therefore double tap all the pics I like... #NotWorking"
66
+ 194521262138204160,2011-04-23 20:20:57 +0000,misspoxtonX,RT @jordantaylorhi: twitter friends &gt; twats at school
67
+ 194521262134001665,2011-04-23 20:20:57 +0000,PatrickBrickman,RT @zeus30hightower: Too all Bama fans and followers my cousin mark Barron doesn't have a twitter so please disregard any tweets from that user
68
+ 194521262129811456,2011-04-23 20:20:57 +0000,KolonelX,Ik refresh twitter op me telefoon terwijl ik tweetdeck voor me open heb staan
69
+ 194521261852995586,2011-04-23 20:20:57 +0000,VLGPRLG5,"@mikeyway and you too RT @NimcyGD: @gerardway Get your ass back to twitter, okay? :3"
70
+ 194521261756530689,2011-04-23 20:20:57 +0000,xRhiBabyx,Trying to persuade the boyf to get on twitter and failing. Help? @holly_haime @Ckwarburton @samwarburton_ @chrishaime @rowloboy
71
+ 194521261630697473,2011-04-23 20:20:57 +0000,juliotrv,RT @lookinglassbr: Lançamentos outono-inverno 2012...CONFIRA em http://t.co/YAk8OXp7 http://t.co/fmmrVrbG
72
+ 194521261571964928,2011-04-23 20:20:57 +0000,shanleyaustin27,RT @caaammmmi: @shanleyaustin27 .....and this hahahahaa http://t.co/wzCMx6ZU
73
+ 194521261563580416,2011-04-23 20:20:57 +0000,Dame_Valuta,RT @Paiser10: Great @chelseafc training at Nou Camp! #cfc http://t.co/k00TnRyR
74
+ 194521261488095232,2011-04-23 20:20:57 +0000,miss_indyiah,"smh, @IndianaHustle done turned into a twitter addict..fuck goin on lol ?"
75
+ 194521261370650625,2011-04-23 20:20:57 +0000,CAROLINEWOLLER,"RT @Mark_Ingram28: To all Bama fans and followers, please unfollow and pay no attention to any user posing to be Mark Barron. My bro doesn't have a twitter!"
76
+ 194521261370642432,2011-04-23 20:20:57 +0000,shelbytrenchdww,"RT @The90sLife: Admit it, we all have a cabinet that looks like this. http://t.co/gQEkQw5G"
77
+ 194521261307727872,2011-04-23 20:20:57 +0000,kabos84,"RT @JF_q8: بالله عليكم ،، مو عيب !!!
78
+
79
+
80
+
81
+ .. http://t.co/e29GV7Ow"
82
+ eos
83
+ end
84
+ end
55
85
  context "--long" do
56
86
  before do
57
87
  @search.options = @search.options.merge(:long => true)
58
88
  end
59
- it "should list in long format" do
89
+ it "should output in long format" do
60
90
  @search.all("twitter")
61
91
  $stdout.string.should == <<-eos
62
92
  ID Posted at Screen name Text
@@ -131,11 +161,38 @@ ID Posted at Screen name Text
131
161
  bartt: @noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come. (7 months ago)
132
162
  eos
133
163
  end
164
+ context "--csv" do
165
+ before do
166
+ @search.options = @search.options.merge(:csv => true)
167
+ end
168
+ it "should output in CSV format" do
169
+ @search.favorites("twitter")
170
+ $stdout.string.should == <<-eos
171
+ ID,Posted at,Screen name,Text
172
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
173
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
174
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
175
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
176
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
177
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
178
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
179
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
180
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
181
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
182
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
183
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
184
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
185
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
186
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
187
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
188
+ eos
189
+ end
190
+ end
134
191
  context "--long" do
135
192
  before do
136
193
  @search.options = @search.options.merge(:long => true)
137
194
  end
138
- it "should list in long format" do
195
+ it "should output in long format" do
139
196
  @search.favorites("twitter")
140
197
  $stdout.string.should == <<-eos
141
198
  ID Posted at Screen name Text
@@ -210,11 +267,38 @@ ID Posted at Screen name Text
210
267
  bartt: @noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come. (7 months ago)
211
268
  eos
212
269
  end
270
+ context "--csv" do
271
+ before do
272
+ @search.options = @search.options.merge(:csv => true)
273
+ end
274
+ it "should output in CSV format" do
275
+ @search.mentions("twitter")
276
+ $stdout.string.should == <<-eos
277
+ ID,Posted at,Screen name,Text
278
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
279
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
280
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
281
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
282
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
283
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
284
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
285
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
286
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
287
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
288
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
289
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
290
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
291
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
292
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
293
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
294
+ eos
295
+ end
296
+ end
213
297
  context "--long" do
214
298
  before do
215
299
  @search.options = @search.options.merge(:long => true)
216
300
  end
217
- it "should list in long format" do
301
+ it "should output in long format" do
218
302
  @search.mentions("twitter")
219
303
  $stdout.string.should == <<-eos
220
304
  ID Posted at Screen name Text
@@ -289,11 +373,38 @@ ID Posted at Screen name Text
289
373
  bartt: @noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come. (7 months ago)
290
374
  eos
291
375
  end
376
+ context "--csv" do
377
+ before do
378
+ @search.options = @search.options.merge(:csv => true)
379
+ end
380
+ it "should output in CSV format" do
381
+ @search.retweets("twitter")
382
+ $stdout.string.should == <<-eos
383
+ ID,Posted at,Screen name,Text
384
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
385
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
386
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
387
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
388
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
389
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
390
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
391
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
392
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
393
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
394
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
395
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
396
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
397
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
398
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
399
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
400
+ eos
401
+ end
402
+ end
292
403
  context "--long" do
293
404
  before do
294
405
  @search.options = @search.options.merge(:long => true)
295
406
  end
296
- it "should list in long format" do
407
+ it "should output in long format" do
297
408
  @search.retweets("twitter")
298
409
  $stdout.string.should == <<-eos
299
410
  ID Posted at Screen name Text
@@ -368,11 +479,38 @@ ID Posted at Screen name Text
368
479
  bartt: @noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come. (7 months ago)
369
480
  eos
370
481
  end
482
+ context "--csv" do
483
+ before do
484
+ @search.options = @search.options.merge(:csv => true)
485
+ end
486
+ it "should output in CSV format" do
487
+ @search.timeline("twitter")
488
+ $stdout.string.should == <<-eos
489
+ ID,Posted at,Screen name,Text
490
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
491
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
492
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
493
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
494
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
495
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
496
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
497
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
498
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
499
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
500
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
501
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
502
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
503
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
504
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
505
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
506
+ eos
507
+ end
508
+ end
371
509
  context "--long" do
372
510
  before do
373
511
  @search.options = @search.options.merge(:long => true)
374
512
  end
375
- it "should list in long format" do
513
+ it "should output in long format" do
376
514
  @search.timeline("twitter")
377
515
  $stdout.string.should == <<-eos
378
516
  ID Posted at Screen name Text
@@ -447,11 +585,56 @@ ID Posted at Screen name Text
447
585
  bartt: @noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come. (7 months ago)
448
586
  eos
449
587
  end
588
+ context "--csv" do
589
+ before do
590
+ @search.options = @search.options.merge(:csv => true)
591
+ end
592
+ it "should output in CSV format" do
593
+ @search.user("sferik", "twitter")
594
+ $stdout.string.should == <<-eos
595
+ ID,Posted at,Screen name,Text
596
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
597
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
598
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
599
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
600
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
601
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
602
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
603
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
604
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
605
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
606
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
607
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
608
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
609
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
610
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
611
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
612
+ eos
613
+ end
614
+ end
615
+ context "--id" do
616
+ before do
617
+ @search.options = @search.options.merge(:id => true)
618
+ 1.upto(16).each do |page|
619
+ stub_get("/1/statuses/user_timeline.json").
620
+ with(:query => {:user_id => "7505382", :count => "200", :page => "#{page}"}).
621
+ to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
622
+ end
623
+ end
624
+ it "should request the correct resource" do
625
+ @search.user("7505382", "twitter")
626
+ 1.upto(16).each do |page|
627
+ a_get("/1/statuses/user_timeline.json").
628
+ with(:query => {:user_id => "7505382", :count => "200", :page => "#{page}"}).
629
+ should have_been_made
630
+ end
631
+ end
632
+ end
450
633
  context "--long" do
451
634
  before do
452
635
  @search.options = @search.options.merge(:long => true)
453
636
  end
454
- it "should list in long format" do
637
+ it "should output in long format" do
455
638
  @search.user("sferik", "twitter")
456
639
  $stdout.string.should == <<-eos
457
640
  ID Posted at Screen name Text
data/t.gemspec CHANGED
@@ -5,13 +5,15 @@ Gem::Specification.new do |gem|
5
5
  gem.add_dependency 'actionpack', ['>= 2.3.11', '< 4']
6
6
  gem.add_dependency 'activesupport', ['>= 2.3.11', '< 4']
7
7
  gem.add_dependency 'launchy', '~> 2.0'
8
+ gem.add_dependency 'fastercsv', '~> 1.5'
8
9
  gem.add_dependency 'geokit', '~> 1.6'
9
10
  gem.add_dependency 'highline', '~> 1.6'
10
11
  gem.add_dependency 'json', '~> 1.6'
11
12
  gem.add_dependency 'oauth', '~> 0.4'
12
13
  gem.add_dependency 'retryable', '~> 1.2'
13
14
  gem.add_dependency 'thor', '~> 0.15.0.rc2'
14
- gem.add_dependency 'twitter', ['~> 2.2', '>= 2.2.3']
15
+ gem.add_dependency 'twitter', ['~> 2.2', '>= 2.2.5']
16
+ gem.add_dependency 'twitter-text', '~> 1.4'
15
17
  gem.add_development_dependency 'pry'
16
18
  gem.add_development_dependency 'rake'
17
19
  gem.add_development_dependency 'rspec'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: t
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.7.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-25 00:00:00.000000000 Z
12
+ date: 2012-04-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -71,6 +71,22 @@ dependencies:
71
71
  - - ~>
72
72
  - !ruby/object:Gem::Version
73
73
  version: '2.0'
74
+ - !ruby/object:Gem::Dependency
75
+ name: fastercsv
76
+ requirement: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ~>
80
+ - !ruby/object:Gem::Version
81
+ version: '1.5'
82
+ type: :runtime
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: '1.5'
74
90
  - !ruby/object:Gem::Dependency
75
91
  name: geokit
76
92
  requirement: !ruby/object:Gem::Requirement
@@ -177,7 +193,7 @@ dependencies:
177
193
  version: '2.2'
178
194
  - - ! '>='
179
195
  - !ruby/object:Gem::Version
180
- version: 2.2.3
196
+ version: 2.2.5
181
197
  type: :runtime
182
198
  prerelease: false
183
199
  version_requirements: !ruby/object:Gem::Requirement
@@ -188,7 +204,23 @@ dependencies:
188
204
  version: '2.2'
189
205
  - - ! '>='
190
206
  - !ruby/object:Gem::Version
191
- version: 2.2.3
207
+ version: 2.2.5
208
+ - !ruby/object:Gem::Dependency
209
+ name: twitter-text
210
+ requirement: !ruby/object:Gem::Requirement
211
+ none: false
212
+ requirements:
213
+ - - ~>
214
+ - !ruby/object:Gem::Version
215
+ version: '1.4'
216
+ type: :runtime
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ none: false
220
+ requirements:
221
+ - - ~>
222
+ - !ruby/object:Gem::Version
223
+ version: '1.4'
192
224
  - !ruby/object:Gem::Dependency
193
225
  name: pry
194
226
  requirement: !ruby/object:Gem::Requirement
@@ -319,11 +351,15 @@ files:
319
351
  - spec/fixtures/direct_message.json
320
352
  - spec/fixtures/direct_messages.json
321
353
  - spec/fixtures/empty_cursor.json
354
+ - spec/fixtures/false.json
322
355
  - spec/fixtures/favorites.json
323
356
  - spec/fixtures/followers_ids.json
324
357
  - spec/fixtures/friends_ids.json
325
358
  - spec/fixtures/gem.json
326
359
  - spec/fixtures/list.json
360
+ - spec/fixtures/lists.json
361
+ - spec/fixtures/locations.json
362
+ - spec/fixtures/not_found.json
327
363
  - spec/fixtures/recommendations.json
328
364
  - spec/fixtures/request_token
329
365
  - spec/fixtures/retweet.json
@@ -332,6 +368,8 @@ files:
332
368
  - spec/fixtures/sferik.json
333
369
  - spec/fixtures/status.json
334
370
  - spec/fixtures/statuses.json
371
+ - spec/fixtures/trends.json
372
+ - spec/fixtures/true.json
335
373
  - spec/fixtures/users.json
336
374
  - spec/fixtures/users_list.json
337
375
  - spec/fixtures/xml.gp
@@ -374,11 +412,15 @@ test_files:
374
412
  - spec/fixtures/direct_message.json
375
413
  - spec/fixtures/direct_messages.json
376
414
  - spec/fixtures/empty_cursor.json
415
+ - spec/fixtures/false.json
377
416
  - spec/fixtures/favorites.json
378
417
  - spec/fixtures/followers_ids.json
379
418
  - spec/fixtures/friends_ids.json
380
419
  - spec/fixtures/gem.json
381
420
  - spec/fixtures/list.json
421
+ - spec/fixtures/lists.json
422
+ - spec/fixtures/locations.json
423
+ - spec/fixtures/not_found.json
382
424
  - spec/fixtures/recommendations.json
383
425
  - spec/fixtures/request_token
384
426
  - spec/fixtures/retweet.json
@@ -387,6 +429,8 @@ test_files:
387
429
  - spec/fixtures/sferik.json
388
430
  - spec/fixtures/status.json
389
431
  - spec/fixtures/statuses.json
432
+ - spec/fixtures/trends.json
433
+ - spec/fixtures/true.json
390
434
  - spec/fixtures/users.json
391
435
  - spec/fixtures/users_list.json
392
436
  - spec/fixtures/xml.gp