t 1.3.0 → 1.3.1

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/search_spec.rb CHANGED
@@ -30,43 +30,23 @@ describe T::Search do
30
30
 
31
31
  describe "#all" do
32
32
  before do
33
- stub_get("/1.1/search/tweets.json").
34
- with(:query => {:q => "twitter", :rpp => "20"}).
35
- to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
36
- stub_get("/1.1/search/tweets.json").
37
- with(:query => {:q => "twitter", :max_id => "246666260270702591", :rpp => "16"}).
38
- to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
39
- stub_get("/1.1/search/tweets.json").
40
- with(:query => {:q => "twitter", :max_id => "246666260270702591", :rpp => "12"}).
41
- to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
42
- stub_get("/1.1/search/tweets.json").
43
- with(:query => {:q => "twitter", :max_id => "246666260270702591", :rpp => "8"}).
44
- to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
45
- stub_get("/1.1/search/tweets.json").
46
- with(:query => {:q => "twitter", :max_id => "246666260270702591", :rpp => "4"}).
47
- to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
33
+ stub_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :rpp => "20"}).to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
34
+ stub_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :max_id => "246666260270702591", :rpp => "16"}).to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
35
+ stub_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :max_id => "246666260270702591", :rpp => "12"}).to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
36
+ stub_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :max_id => "246666260270702591", :rpp => "8"}).to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
37
+ stub_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :max_id => "246666260270702591", :rpp => "4"}).to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
48
38
  end
49
39
  it "should request the correct resource" do
50
40
  @search.all("twitter")
51
- a_get("/1.1/search/tweets.json").
52
- with(:query => {:q => "twitter", :rpp => "20"}).
53
- should have_been_made
54
- a_get("/1.1/search/tweets.json").
55
- with(:query => {:q => "twitter", :max_id => "246666260270702591", :rpp => "16"}).
56
- should have_been_made
57
- a_get("/1.1/search/tweets.json").
58
- with(:query => {:q => "twitter", :max_id => "246666260270702591", :rpp => "12"}).
59
- should have_been_made
60
- a_get("/1.1/search/tweets.json").
61
- with(:query => {:q => "twitter", :max_id => "246666260270702591", :rpp => "8"}).
62
- should have_been_made
63
- a_get("/1.1/search/tweets.json").
64
- with(:query => {:q => "twitter", :max_id => "246666260270702591", :rpp => "4"}).
65
- should have_been_made
41
+ expect(a_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :rpp => "20"})).to have_been_made
42
+ expect(a_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :max_id => "246666260270702591", :rpp => "16"})).to have_been_made
43
+ expect(a_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :max_id => "246666260270702591", :rpp => "12"})).to have_been_made
44
+ expect(a_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :max_id => "246666260270702591", :rpp => "8"})).to have_been_made
45
+ expect(a_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :max_id => "246666260270702591", :rpp => "4"})).to have_been_made
66
46
  end
67
47
  it "should have the correct output" do
68
48
  @search.all("twitter")
69
- $stdout.string.should == <<-eos
49
+ expect($stdout.string).to eq <<-eos
70
50
 
71
51
  \e[1m\e[33m @richrad\e[0m
72
52
  Bubble Mailer #freebandnames
@@ -156,7 +136,7 @@ describe T::Search do
156
136
  end
157
137
  it "should output in CSV format" do
158
138
  @search.all("twitter")
159
- $stdout.string.should == <<-eos
139
+ expect($stdout.string).to eq <<-eos
160
140
  ID,Posted at,Screen name,Text
161
141
  247827742178021376,2012-09-17 22:41:52 +0000,richrad,Bubble Mailer #freebandnames
162
142
  247811706061979648,2012-09-17 21:38:09 +0000,dswordsNshields,"Hair of the Frog
@@ -207,7 +187,7 @@ ID,Posted at,Screen name,Text
207
187
  end
208
188
  it "should output in long format" do
209
189
  @search.all("twitter")
210
- $stdout.string.should == <<-eos
190
+ expect($stdout.string).to eq <<-eos
211
191
  ID Posted at Screen name Text
212
192
  247827742178021376 Sep 17 14:41 @richrad Bubble Mailer #freebandnames
213
193
  247811706061979648 Sep 17 13:38 @dswordsNshields Hair of the Frog (seriou...
@@ -234,41 +214,25 @@ ID Posted at Screen name Text
234
214
  end
235
215
  context "--number" do
236
216
  before do
237
- stub_get("/1.1/search/tweets.json").
238
- with(:query => {:q => "twitter", :rpp => "1"}).
239
- to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
240
- stub_get("/1.1/search/tweets.json").
241
- with(:query => {:q => "twitter", :rpp => "200"}).
242
- to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
243
- stub_get("/1.1/search/tweets.json").
244
- with(:query => {:q => "twitter", :rpp => "200", :max_id => "246666260270702591"}).
245
- to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
217
+ stub_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :rpp => "1"}).to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
218
+ stub_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :rpp => "200"}).to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
219
+ stub_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :rpp => "200", :max_id => "246666260270702591"}).to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
246
220
  (1..197).step(4).to_a.each do |count|
247
- stub_get("/1.1/search/tweets.json").
248
- with(:query => {:q => "twitter", :rpp => count, :max_id => "246666260270702591"}).
249
- to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
221
+ stub_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :rpp => count, :max_id => "246666260270702591"}).to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
250
222
  end
251
223
  end
252
224
  it "should limit the number of results to 1" do
253
225
  @search.options = @search.options.merge("number" => 1)
254
226
  @search.all("twitter")
255
- a_get("/1.1/search/tweets.json").
256
- with(:query => {:q => "twitter", :rpp => "1"}).
257
- should have_been_made
227
+ expect(a_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :rpp => "1"})).to have_been_made
258
228
  end
259
229
  it "should limit the number of results to 345" do
260
230
  @search.options = @search.options.merge("number" => 345)
261
231
  @search.all("twitter")
262
- a_get("/1.1/search/tweets.json").
263
- with(:query => {:q => "twitter", :rpp => "200"}).
264
- should have_been_made
265
- a_get("/1.1/search/tweets.json").
266
- with(:query => {:q => "twitter", :rpp => "200", :max_id => "246666260270702591"}).
267
- should have_been_made.times(36)
232
+ expect(a_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :rpp => "200"})).to have_been_made
233
+ expect(a_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :rpp => "200", :max_id => "246666260270702591"})).to have_been_made.times(36)
268
234
  (1..197).step(4).to_a.each do |count|
269
- a_get("/1.1/search/tweets.json").
270
- with(:query => {:q => "twitter", :rpp => count, :max_id => "246666260270702591"}).
271
- should have_been_made
235
+ expect(a_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :rpp => count, :max_id => "246666260270702591"})).to have_been_made
272
236
  end
273
237
  end
274
238
  end
@@ -276,25 +240,17 @@ ID Posted at Screen name Text
276
240
 
277
241
  describe "#favorites" do
278
242
  before do
279
- stub_get("/1.1/favorites/list.json").
280
- with(:query => {:count => "200"}).
281
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
282
- stub_get("/1.1/favorites/list.json").
283
- with(:query => {:count => "200", :max_id => "244099460672679937"}).
284
- to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
243
+ stub_get("/1.1/favorites/list.json").with(:query => {:count => "200"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
244
+ stub_get("/1.1/favorites/list.json").with(:query => {:count => "200", :max_id => "244099460672679937"}).to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
285
245
  end
286
246
  it "should request the correct resource" do
287
247
  @search.favorites("twitter")
288
- a_get("/1.1/favorites/list.json").
289
- with(:query => {:count => "200"}).
290
- should have_been_made
291
- a_get("/1.1/favorites/list.json").
292
- with(:query => {:count => "200", :max_id => "244099460672679937"}).
293
- should have_been_made
248
+ expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "200"})).to have_been_made
249
+ expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "200", :max_id => "244099460672679937"})).to have_been_made
294
250
  end
295
251
  it "should have the correct output" do
296
252
  @search.favorites("twitter")
297
- $stdout.string.should == <<-eos
253
+ expect($stdout.string).to eq <<-eos
298
254
  \e[1m\e[33m @sferik\e[0m
299
255
  @episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem
300
256
  to be missing "1.1" from the URL.
@@ -310,7 +266,7 @@ ID Posted at Screen name Text
310
266
  end
311
267
  it "should output in CSV format" do
312
268
  @search.favorites("twitter")
313
- $stdout.string.should == <<-eos
269
+ expect($stdout.string).to eq <<-eos
314
270
  ID,Posted at,Screen name,Text
315
271
  244102209942458368,2012-09-07 15:57:56 +0000,sferik,"@episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem to be missing ""1.1"" from the URL."
316
272
  244100411563339777,2012-09-07 15:50:47 +0000,sferik,@episod @twitterapi Did you catch https://t.co/VHsQvZT0 as well?
@@ -323,7 +279,7 @@ ID,Posted at,Screen name,Text
323
279
  end
324
280
  it "should output in long format" do
325
281
  @search.favorites("twitter")
326
- $stdout.string.should == <<-eos
282
+ expect($stdout.string).to eq <<-eos
327
283
  ID Posted at Screen name Text
328
284
  244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now https:...
329
285
  244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did you ca...
@@ -332,38 +288,26 @@ ID Posted at Screen name Text
332
288
  end
333
289
  context "Twitter is down" do
334
290
  it "should retry 3 times and then raise an error" do
335
- stub_get("/1.1/favorites/list.json").
336
- with(:query => {:count => "200"}).
337
- to_return(:status => 502)
338
- lambda do
291
+ stub_get("/1.1/favorites/list.json").with(:query => {:count => "200"}).to_return(:status => 502)
292
+ expect do
339
293
  @search.favorites("twitter")
340
- end.should raise_error("Twitter is down or being upgraded.")
341
- a_get("/1.1/favorites/list.json").
342
- with(:query => {:count => "200"}).
343
- should have_been_made.times(3)
294
+ end.to raise_error("Twitter is down or being upgraded.")
295
+ expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "200"})).to have_been_made.times(3)
344
296
  end
345
297
  end
346
298
  context "with a user passed" do
347
299
  before do
348
- stub_get("/1.1/favorites/list.json").
349
- with(:query => {:count => "200", :screen_name => "sferik"}).
350
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
351
- stub_get("/1.1/favorites/list.json").
352
- with(:query => {:count => "200", :max_id => "244099460672679937", :screen_name => "sferik"}).
353
- to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
300
+ stub_get("/1.1/favorites/list.json").with(:query => {:count => "200", :screen_name => "sferik"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
301
+ stub_get("/1.1/favorites/list.json").with(:query => {:count => "200", :max_id => "244099460672679937", :screen_name => "sferik"}).to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
354
302
  end
355
303
  it "should request the correct resource" do
356
304
  @search.favorites("sferik", "twitter")
357
- a_get("/1.1/favorites/list.json").
358
- with(:query => {:count => "200", :screen_name => "sferik"}).
359
- should have_been_made
360
- a_get("/1.1/favorites/list.json").
361
- with(:query => {:count => "200", :max_id => "244099460672679937", :screen_name => "sferik"}).
362
- should have_been_made
305
+ expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "200", :screen_name => "sferik"})).to have_been_made
306
+ expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "200", :max_id => "244099460672679937", :screen_name => "sferik"})).to have_been_made
363
307
  end
364
308
  it "should have the correct output" do
365
309
  @search.favorites("sferik", "twitter")
366
- $stdout.string.should == <<-eos
310
+ expect($stdout.string).to eq <<-eos
367
311
  \e[1m\e[33m @sferik\e[0m
368
312
  @episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem
369
313
  to be missing "1.1" from the URL.
@@ -378,25 +322,17 @@ ID Posted at Screen name Text
378
322
 
379
323
  describe "#mentions" do
380
324
  before do
381
- stub_get("/1.1/statuses/mentions_timeline.json").
382
- with(:query => {:count => "200"}).
383
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
384
- stub_get("/1.1/statuses/mentions_timeline.json").
385
- with(:query => {:count => "200", :max_id => "244099460672679937"}).
386
- to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
325
+ stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "200"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
326
+ stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "200", :max_id => "244099460672679937"}).to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
387
327
  end
388
328
  it "should request the correct resource" do
389
329
  @search.mentions("twitter")
390
- a_get("/1.1/statuses/mentions_timeline.json").
391
- with(:query => {:count => "200"}).
392
- should have_been_made
393
- a_get("/1.1/statuses/mentions_timeline.json").
394
- with(:query => {:count => "200", :max_id => "244099460672679937"}).
395
- should have_been_made
330
+ expect(a_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "200"})).to have_been_made
331
+ expect(a_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "200", :max_id => "244099460672679937"})).to have_been_made
396
332
  end
397
333
  it "should have the correct output" do
398
334
  @search.mentions("twitter")
399
- $stdout.string.should == <<-eos
335
+ expect($stdout.string).to eq <<-eos
400
336
  \e[1m\e[33m @sferik\e[0m
401
337
  @episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem
402
338
  to be missing "1.1" from the URL.
@@ -412,7 +348,7 @@ ID Posted at Screen name Text
412
348
  end
413
349
  it "should output in CSV format" do
414
350
  @search.mentions("twitter")
415
- $stdout.string.should == <<-eos
351
+ expect($stdout.string).to eq <<-eos
416
352
  ID,Posted at,Screen name,Text
417
353
  244102209942458368,2012-09-07 15:57:56 +0000,sferik,"@episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem to be missing ""1.1"" from the URL."
418
354
  244100411563339777,2012-09-07 15:50:47 +0000,sferik,@episod @twitterapi Did you catch https://t.co/VHsQvZT0 as well?
@@ -425,7 +361,7 @@ ID,Posted at,Screen name,Text
425
361
  end
426
362
  it "should output in long format" do
427
363
  @search.mentions("twitter")
428
- $stdout.string.should == <<-eos
364
+ expect($stdout.string).to eq <<-eos
429
365
  ID Posted at Screen name Text
430
366
  244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now https:...
431
367
  244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did you ca...
@@ -434,40 +370,28 @@ ID Posted at Screen name Text
434
370
  end
435
371
  context "Twitter is down" do
436
372
  it "should retry 3 times and then raise an error" do
437
- stub_get("/1.1/statuses/mentions_timeline.json").
438
- with(:query => {:count => "200"}).
439
- to_return(:status => 502)
440
- lambda do
373
+ stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "200"}).to_return(:status => 502)
374
+ expect do
441
375
  @search.mentions("twitter")
442
- end.should raise_error("Twitter is down or being upgraded.")
443
- a_get("/1.1/statuses/mentions_timeline.json").
444
- with(:query => {:count => "200"}).
445
- should have_been_made.times(3)
376
+ end.to raise_error("Twitter is down or being upgraded.")
377
+ expect(a_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "200"})).to have_been_made.times(3)
446
378
  end
447
379
  end
448
380
  end
449
381
 
450
382
  describe "#list" do
451
383
  before do
452
- stub_get("/1.1/lists/statuses.json").
453
- with(:query => {:count => "200", :owner_screen_name => "testcli", :slug => "presidents"}).
454
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
455
- stub_get("/1.1/lists/statuses.json").
456
- with(:query => {:count => "200", :max_id => "244099460672679937", :owner_screen_name => "testcli", :slug => "presidents"}).
457
- to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
384
+ stub_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :owner_screen_name => "testcli", :slug => "presidents"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
385
+ stub_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :max_id => "244099460672679937", :owner_screen_name => "testcli", :slug => "presidents"}).to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
458
386
  end
459
387
  it "should request the correct resource" do
460
388
  @search.list("presidents", "twitter")
461
- a_get("/1.1/lists/statuses.json").
462
- with(:query => {:count => "200", :owner_screen_name => "testcli", :slug => "presidents"}).
463
- should have_been_made
464
- a_get("/1.1/lists/statuses.json").
465
- with(:query => {:count => "200", :max_id => "244099460672679937", :owner_screen_name => "testcli", :slug => "presidents"}).
466
- should have_been_made
389
+ expect(a_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :owner_screen_name => "testcli", :slug => "presidents"})).to have_been_made
390
+ expect(a_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :max_id => "244099460672679937", :owner_screen_name => "testcli", :slug => "presidents"})).to have_been_made
467
391
  end
468
392
  it "should have the correct output" do
469
393
  @search.list("presidents", "twitter")
470
- $stdout.string.should == <<-eos
394
+ expect($stdout.string).to eq <<-eos
471
395
  \e[1m\e[33m @sferik\e[0m
472
396
  @episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem
473
397
  to be missing "1.1" from the URL.
@@ -483,7 +407,7 @@ ID Posted at Screen name Text
483
407
  end
484
408
  it "should output in CSV format" do
485
409
  @search.list("presidents", "twitter")
486
- $stdout.string.should == <<-eos
410
+ expect($stdout.string).to eq <<-eos
487
411
  ID,Posted at,Screen name,Text
488
412
  244102209942458368,2012-09-07 15:57:56 +0000,sferik,"@episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem to be missing ""1.1"" from the URL."
489
413
  244100411563339777,2012-09-07 15:50:47 +0000,sferik,@episod @twitterapi Did you catch https://t.co/VHsQvZT0 as well?
@@ -496,7 +420,7 @@ ID,Posted at,Screen name,Text
496
420
  end
497
421
  it "should output in long format" do
498
422
  @search.list("presidents", "twitter")
499
- $stdout.string.should == <<-eos
423
+ expect($stdout.string).to eq <<-eos
500
424
  ID Posted at Screen name Text
501
425
  244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now https:...
502
426
  244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did you ca...
@@ -506,67 +430,45 @@ ID Posted at Screen name Text
506
430
  context "with a user passed" do
507
431
  it "should request the correct resource" do
508
432
  @search.list("testcli/presidents", "twitter")
509
- a_get("/1.1/lists/statuses.json").
510
- with(:query => {:count => "200", :owner_screen_name => "testcli", :slug => "presidents"}).
511
- should have_been_made
433
+ expect(a_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :owner_screen_name => "testcli", :slug => "presidents"})).to have_been_made
512
434
  end
513
435
  context "--id" do
514
436
  before do
515
437
  @search.options = @search.options.merge("id" => true)
516
- stub_get("/1.1/lists/statuses.json").
517
- with(:query => {:count => "200", :owner_id => "7505382", :slug => "presidents"}).
518
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
519
- stub_get("/1.1/lists/statuses.json").
520
- with(:query => {:count => "200", :max_id => "244099460672679937", :owner_id => "7505382", :slug => "presidents"}).
521
- to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
438
+ stub_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :owner_id => "7505382", :slug => "presidents"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
439
+ stub_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :max_id => "244099460672679937", :owner_id => "7505382", :slug => "presidents"}).to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
522
440
  end
523
441
  it "should request the correct resource" do
524
442
  @search.list("7505382/presidents", "twitter")
525
- a_get("/1.1/lists/statuses.json").
526
- with(:query => {:count => "200", :owner_id => "7505382", :slug => "presidents"}).
527
- should have_been_made
528
- a_get("/1.1/lists/statuses.json").
529
- with(:query => {:count => "200", :max_id => "244099460672679937", :owner_id => "7505382", :slug => "presidents"}).
530
- should have_been_made
443
+ expect(a_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :owner_id => "7505382", :slug => "presidents"})).to have_been_made
444
+ expect(a_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :max_id => "244099460672679937", :owner_id => "7505382", :slug => "presidents"})).to have_been_made
531
445
  end
532
446
  end
533
447
  end
534
448
  context "Twitter is down" do
535
449
  it "should retry 3 times and then raise an error" do
536
- stub_get("/1.1/lists/statuses.json").
537
- with(:query => {:count => "200", :owner_screen_name => "testcli", :slug => "presidents"}).
538
- to_return(:status => 502)
539
- lambda do
450
+ stub_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :owner_screen_name => "testcli", :slug => "presidents"}).to_return(:status => 502)
451
+ expect do
540
452
  @search.list("presidents", "twitter")
541
- end.should raise_error("Twitter is down or being upgraded.")
542
- a_get("/1.1/lists/statuses.json").
543
- with(:query => {:count => "200", :owner_screen_name => "testcli", :slug => "presidents"}).
544
- should have_been_made.times(3)
453
+ end.to raise_error("Twitter is down or being upgraded.")
454
+ expect(a_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :owner_screen_name => "testcli", :slug => "presidents"})).to have_been_made.times(3)
545
455
  end
546
456
  end
547
457
  end
548
458
 
549
459
  describe "#retweets" do
550
460
  before do
551
- stub_get("/1.1/statuses/user_timeline.json").
552
- with(:query => {:count => "200", :include_rts => "true"}).
553
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
554
- stub_get("/1.1/statuses/user_timeline.json").
555
- with(:query => {:count => "200", :include_rts => "true", :max_id => "244102729860009983"}).
556
- to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
461
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
462
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :max_id => "244102729860009983"}).to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
557
463
  end
558
464
  it "should request the correct resource" do
559
465
  @search.retweets("mosaic")
560
- a_get("/1.1/statuses/user_timeline.json").
561
- with(:query => {:count => "200", :include_rts => "true"}).
562
- should have_been_made
563
- a_get("/1.1/statuses/user_timeline.json").
564
- with(:query => {:count => "200", :include_rts => "true", :max_id => "244102729860009983"}).
565
- should have_been_made.times(2)
466
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true"})).to have_been_made
467
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :max_id => "244102729860009983"})).to have_been_made.times(2)
566
468
  end
567
469
  it "should have the correct output" do
568
470
  @search.retweets("mosaic")
569
- $stdout.string.should == <<-eos
471
+ expect($stdout.string).to eq <<-eos
570
472
  \e[1m\e[33m @calebelston\e[0m
571
473
  RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k
572
474
 
@@ -578,7 +480,7 @@ ID Posted at Screen name Text
578
480
  end
579
481
  it "should output in CSV format" do
580
482
  @search.retweets("mosaic")
581
- $stdout.string.should == <<-eos
483
+ expect($stdout.string).to eq <<-eos
582
484
  ID,Posted at,Screen name,Text
583
485
  244108728834592770,2012-09-07 16:23:50 +0000,calebelston,RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k
584
486
  eos
@@ -590,7 +492,7 @@ ID,Posted at,Screen name,Text
590
492
  end
591
493
  it "should output in long format" do
592
494
  @search.retweets("mosaic")
593
- $stdout.string.should == <<-eos
495
+ expect($stdout.string).to eq <<-eos
594
496
  ID Posted at Screen name Text
595
497
  244108728834592770 Sep 7 08:23 @calebelston RT @olivercameron: Mosaic loo...
596
498
  eos
@@ -598,38 +500,26 @@ ID Posted at Screen name Text
598
500
  end
599
501
  context "Twitter is down" do
600
502
  it "should retry 3 times and then raise an error" do
601
- stub_get("/1.1/statuses/user_timeline.json").
602
- with(:query => {:count => "200", :include_rts => "true"}).
603
- to_return(:status => 502)
604
- lambda do
503
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true"}).to_return(:status => 502)
504
+ expect do
605
505
  @search.retweets("mosaic")
606
- end.should raise_error("Twitter is down or being upgraded.")
607
- a_get("/1.1/statuses/user_timeline.json").
608
- with(:query => {:count => "200", :include_rts => "true"}).
609
- should have_been_made.times(3)
506
+ end.to raise_error("Twitter is down or being upgraded.")
507
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true"})).to have_been_made.times(3)
610
508
  end
611
509
  end
612
510
  context "with a user passed" do
613
511
  before do
614
- stub_get("/1.1/statuses/user_timeline.json").
615
- with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik"}).
616
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
617
- stub_get("/1.1/statuses/user_timeline.json").
618
- with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik", :max_id => "244102729860009983"}).
619
- to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
512
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
513
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik", :max_id => "244102729860009983"}).to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
620
514
  end
621
515
  it "should request the correct resource" do
622
516
  @search.retweets("sferik", "mosaic")
623
- a_get("/1.1/statuses/user_timeline.json").
624
- with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik"}).
625
- should have_been_made
626
- a_get("/1.1/statuses/user_timeline.json").
627
- with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik", :max_id => "244102729860009983"}).
628
- should have_been_made.times(2)
517
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik"})).to have_been_made
518
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik", :max_id => "244102729860009983"})).to have_been_made.times(2)
629
519
  end
630
520
  it "should have the correct output" do
631
521
  @search.retweets("sferik", "mosaic")
632
- $stdout.string.should == <<-eos
522
+ expect($stdout.string).to eq <<-eos
633
523
  \e[1m\e[33m @calebelston\e[0m
634
524
  RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k
635
525
 
@@ -640,25 +530,17 @@ ID Posted at Screen name Text
640
530
 
641
531
  describe "#timeline" do
642
532
  before do
643
- stub_get("/1.1/statuses/home_timeline.json").
644
- with(:query => {:count => "200"}).
645
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
646
- stub_get("/1.1/statuses/home_timeline.json").
647
- with(:query => {:count => "200", :max_id => "244099460672679937"}).
648
- to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
533
+ stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
534
+ stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200", :max_id => "244099460672679937"}).to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
649
535
  end
650
536
  it "should request the correct resource" do
651
537
  @search.timeline("twitter")
652
- a_get("/1.1/statuses/home_timeline.json").
653
- with(:query => {:count => "200"}).
654
- should have_been_made
655
- a_get("/1.1/statuses/home_timeline.json").
656
- with(:query => {:count => "200", :max_id => "244099460672679937"}).
657
- should have_been_made
538
+ expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200"})).to have_been_made
539
+ expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200", :max_id => "244099460672679937"})).to have_been_made
658
540
  end
659
541
  it "should have the correct output" do
660
542
  @search.timeline("twitter")
661
- $stdout.string.should == <<-eos
543
+ expect($stdout.string).to eq <<-eos
662
544
  \e[1m\e[33m @sferik\e[0m
663
545
  @episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem
664
546
  to be missing "1.1" from the URL.
@@ -674,7 +556,7 @@ ID Posted at Screen name Text
674
556
  end
675
557
  it "should output in CSV format" do
676
558
  @search.timeline("twitter")
677
- $stdout.string.should == <<-eos
559
+ expect($stdout.string).to eq <<-eos
678
560
  ID,Posted at,Screen name,Text
679
561
  244102209942458368,2012-09-07 15:57:56 +0000,sferik,"@episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem to be missing ""1.1"" from the URL."
680
562
  244100411563339777,2012-09-07 15:50:47 +0000,sferik,@episod @twitterapi Did you catch https://t.co/VHsQvZT0 as well?
@@ -687,7 +569,7 @@ ID,Posted at,Screen name,Text
687
569
  end
688
570
  it "should output in long format" do
689
571
  @search.timeline("twitter")
690
- $stdout.string.should == <<-eos
572
+ expect($stdout.string).to eq <<-eos
691
573
  ID Posted at Screen name Text
692
574
  244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now https:...
693
575
  244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did you ca...
@@ -696,38 +578,26 @@ ID Posted at Screen name Text
696
578
  end
697
579
  context "Twitter is down" do
698
580
  it "should retry 3 times and then raise an error" do
699
- stub_get("/1.1/statuses/home_timeline.json").
700
- with(:query => {:count => "200"}).
701
- to_return(:status => 502)
702
- lambda do
581
+ stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200"}).to_return(:status => 502)
582
+ expect do
703
583
  @search.timeline("twitter")
704
- end.should raise_error("Twitter is down or being upgraded.")
705
- a_get("/1.1/statuses/home_timeline.json").
706
- with(:query => {:count => "200"}).
707
- should have_been_made.times(3)
584
+ end.to raise_error("Twitter is down or being upgraded.")
585
+ expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200"})).to have_been_made.times(3)
708
586
  end
709
587
  end
710
588
  context "with a user passed" do
711
589
  before do
712
- stub_get("/1.1/statuses/user_timeline.json").
713
- with(:query => {:count => "200", :screen_name => "sferik"}).
714
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
715
- stub_get("/1.1/statuses/user_timeline.json").
716
- with(:query => {:count => "200", :max_id => "244099460672679937", :screen_name => "sferik"}).
717
- to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
590
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :screen_name => "sferik"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
591
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :max_id => "244099460672679937", :screen_name => "sferik"}).to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
718
592
  end
719
593
  it "should request the correct resource" do
720
594
  @search.timeline("sferik", "twitter")
721
- a_get("/1.1/statuses/user_timeline.json").
722
- with(:query => {:count => "200", :screen_name => "sferik"}).
723
- should have_been_made
724
- a_get("/1.1/statuses/user_timeline.json").
725
- with(:query => {:count => "200", :max_id => "244099460672679937", :screen_name => "sferik"}).
726
- should have_been_made
595
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :screen_name => "sferik"})).to have_been_made
596
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :max_id => "244099460672679937", :screen_name => "sferik"})).to have_been_made
727
597
  end
728
598
  it "should have the correct output" do
729
599
  @search.timeline("sferik", "twitter")
730
- $stdout.string.should == <<-eos
600
+ expect($stdout.string).to eq <<-eos
731
601
  \e[1m\e[33m @sferik\e[0m
732
602
  @episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem
733
603
  to be missing "1.1" from the URL.
@@ -743,7 +613,7 @@ ID Posted at Screen name Text
743
613
  end
744
614
  it "should output in CSV format" do
745
615
  @search.timeline("sferik", "twitter")
746
- $stdout.string.should == <<-eos
616
+ expect($stdout.string).to eq <<-eos
747
617
  ID,Posted at,Screen name,Text
748
618
  244102209942458368,2012-09-07 15:57:56 +0000,sferik,"@episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem to be missing ""1.1"" from the URL."
749
619
  244100411563339777,2012-09-07 15:50:47 +0000,sferik,@episod @twitterapi Did you catch https://t.co/VHsQvZT0 as well?
@@ -753,21 +623,13 @@ ID,Posted at,Screen name,Text
753
623
  context "--id" do
754
624
  before do
755
625
  @search.options = @search.options.merge("id" => true)
756
- stub_get("/1.1/statuses/user_timeline.json").
757
- with(:query => {:count => "200", :user_id => "7505382"}).
758
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
759
- stub_get("/1.1/statuses/user_timeline.json").
760
- with(:query => {:count => "200", :max_id => "244099460672679937", :user_id => "7505382"}).
761
- to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
626
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :user_id => "7505382"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
627
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :max_id => "244099460672679937", :user_id => "7505382"}).to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
762
628
  end
763
629
  it "should request the correct resource" do
764
630
  @search.timeline("7505382", "twitter")
765
- a_get("/1.1/statuses/user_timeline.json").
766
- with(:query => {:count => "200", :user_id => "7505382"}).
767
- should have_been_made
768
- a_get("/1.1/statuses/user_timeline.json").
769
- with(:query => {:count => "200", :max_id => "244099460672679937", :user_id => "7505382"}).
770
- should have_been_made
631
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :user_id => "7505382"})).to have_been_made
632
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :max_id => "244099460672679937", :user_id => "7505382"})).to have_been_made
771
633
  end
772
634
  end
773
635
  context "--long" do
@@ -776,7 +638,7 @@ ID,Posted at,Screen name,Text
776
638
  end
777
639
  it "should output in long format" do
778
640
  @search.timeline("sferik", "twitter")
779
- $stdout.string.should == <<-eos
641
+ expect($stdout.string).to eq <<-eos
780
642
  ID Posted at Screen name Text
781
643
  244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now https:...
782
644
  244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did you ca...
@@ -785,15 +647,11 @@ ID Posted at Screen name Text
785
647
  end
786
648
  context "Twitter is down" do
787
649
  it "should retry 3 times and then raise an error" do
788
- stub_get("/1.1/statuses/user_timeline.json").
789
- with(:query => {:screen_name => "sferik", :count => "200"}).
790
- to_return(:status => 502)
791
- lambda do
650
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:screen_name => "sferik", :count => "200"}).to_return(:status => 502)
651
+ expect do
792
652
  @search.timeline("sferik", "twitter")
793
- end.should raise_error("Twitter is down or being upgraded.")
794
- a_get("/1.1/statuses/user_timeline.json").
795
- with(:query => {:screen_name => "sferik", :count => "200"}).
796
- should have_been_made.times(3)
653
+ end.to raise_error("Twitter is down or being upgraded.")
654
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:screen_name => "sferik", :count => "200"})).to have_been_made.times(3)
797
655
  end
798
656
  end
799
657
  end
@@ -801,27 +659,19 @@ ID Posted at Screen name Text
801
659
 
802
660
  describe "#users" do
803
661
  before do
804
- stub_get("/1.1/users/search.json").
805
- with(:query => {:page => "1", :q => "Erik"}).
806
- to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
807
- stub_get("/1.1/users/search.json").
808
- with(:query => {:page => "2", :q => "Erik"}).
809
- to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
662
+ stub_get("/1.1/users/search.json").with(:query => {:page => "1", :q => "Erik"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
663
+ stub_get("/1.1/users/search.json").with(:query => {:page => "2", :q => "Erik"}).to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
810
664
  end
811
665
  it "should request the correct resource" do
812
666
  @search.users("Erik")
813
667
  1.upto(50).each do |page|
814
- a_get("/1.1/users/search.json").
815
- with(:query => {:page => "1", :q => "Erik"}).
816
- should have_been_made
817
- a_get("/1.1/users/search.json").
818
- with(:query => {:page => "2", :q => "Erik"}).
819
- should have_been_made
668
+ expect(a_get("/1.1/users/search.json").with(:query => {:page => "1", :q => "Erik"})).to have_been_made
669
+ expect(a_get("/1.1/users/search.json").with(:query => {:page => "2", :q => "Erik"})).to have_been_made
820
670
  end
821
671
  end
822
672
  it "should have the correct output" do
823
673
  @search.users("Erik")
824
- $stdout.string.chomp.should == "pengwynn sferik"
674
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
825
675
  end
826
676
  context "--csv" do
827
677
  before do
@@ -829,7 +679,7 @@ ID Posted at Screen name Text
829
679
  end
830
680
  it "should output in CSV format" do
831
681
  @search.users("Erik")
832
- $stdout.string.should == <<-eos
682
+ expect($stdout.string).to eq <<-eos
833
683
  ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
834
684
  14100886,2008-03-08 16:34:22 +0000,2012-07-07 20:33:19 +0000,6940,192,358,3427,5457,pengwynn,Wynn Netherland ⚡
835
685
  7505382,2007-07-16 12:59:01 +0000,2012-07-08 18:29:20 +0000,7890,3755,118,212,2262,sferik,Erik Michaels-Ober
@@ -842,7 +692,7 @@ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name
842
692
  end
843
693
  it "should output in long format" do
844
694
  @search.users("Erik")
845
- $stdout.string.should == <<-eos
695
+ expect($stdout.string).to eq <<-eos
846
696
  ID Since Last tweeted at Tweets Favorites Listed Following...
847
697
  14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
848
698
  7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
@@ -855,7 +705,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
855
705
  end
856
706
  it "should reverse the order of the sort" do
857
707
  @search.users("Erik")
858
- $stdout.string.chomp.should == "sferik pengwynn"
708
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
859
709
  end
860
710
  end
861
711
  context "--sort=favorites" do
@@ -864,7 +714,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
864
714
  end
865
715
  it "should sort by number of favorites" do
866
716
  @search.users("Erik")
867
- $stdout.string.chomp.should == "pengwynn sferik"
717
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
868
718
  end
869
719
  end
870
720
  context "--sort=followers" do
@@ -873,7 +723,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
873
723
  end
874
724
  it "should sort by number of followers" do
875
725
  @search.users("Erik")
876
- $stdout.string.chomp.should == "sferik pengwynn"
726
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
877
727
  end
878
728
  end
879
729
  context "--sort=friends" do
@@ -882,7 +732,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
882
732
  end
883
733
  it "should sort by number of friends" do
884
734
  @search.users("Erik")
885
- $stdout.string.chomp.should == "sferik pengwynn"
735
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
886
736
  end
887
737
  end
888
738
  context "--sort=listed" do
@@ -891,7 +741,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
891
741
  end
892
742
  it "should sort by number of list memberships" do
893
743
  @search.users("Erik")
894
- $stdout.string.chomp.should == "sferik pengwynn"
744
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
895
745
  end
896
746
  end
897
747
  context "--sort=since" do
@@ -900,7 +750,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
900
750
  end
901
751
  it "should sort by the time wshen Twitter account was created" do
902
752
  @search.users("Erik")
903
- $stdout.string.chomp.should == "sferik pengwynn"
753
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
904
754
  end
905
755
  end
906
756
  context "--sort=tweets" do
@@ -909,7 +759,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
909
759
  end
910
760
  it "should sort by number of Tweets" do
911
761
  @search.users("Erik")
912
- $stdout.string.chomp.should == "pengwynn sferik"
762
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
913
763
  end
914
764
  end
915
765
  context "--sort=tweeted" do
@@ -918,7 +768,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
918
768
  end
919
769
  it "should sort by the time of the last Tweet" do
920
770
  @search.users("Erik")
921
- $stdout.string.chomp.should == "pengwynn sferik"
771
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
922
772
  end
923
773
  end
924
774
  context "--unsorted" do
@@ -927,20 +777,16 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
927
777
  end
928
778
  it "should not be sorted" do
929
779
  @search.users("Erik")
930
- $stdout.string.chomp.should == "pengwynn sferik"
780
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
931
781
  end
932
782
  end
933
783
  context "Twitter is down" do
934
784
  it "should retry 3 times and then raise an error" do
935
- stub_get("/1.1/users/search.json").
936
- with(:query => {:page => "2", :q => "Erik", }).
937
- to_return(:status => 502)
938
- lambda do
785
+ stub_get("/1.1/users/search.json").with(:query => {:page => "2", :q => "Erik", }).to_return(:status => 502)
786
+ expect do
939
787
  @search.users("Erik")
940
- end.should raise_error("Twitter is down or being upgraded.")
941
- a_get("/1.1/users/search.json").
942
- with(:query => {:page => "2", :q => "Erik", }).
943
- should have_been_made.times(3)
788
+ end.to raise_error("Twitter is down or being upgraded.")
789
+ expect(a_get("/1.1/users/search.json").with(:query => {:page => "2", :q => "Erik", })).to have_been_made.times(3)
944
790
  end
945
791
  end
946
792
  end