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/cli_spec.rb CHANGED
@@ -34,7 +34,7 @@ describe T::CLI do
34
34
  end
35
35
  it "should have the correct output" do
36
36
  @cli.accounts
37
- $stdout.string.should == <<-eos
37
+ expect($stdout.string).to eq <<-eos
38
38
  testcli
39
39
  abc123 (active)
40
40
  eos
@@ -44,12 +44,9 @@ testcli
44
44
  describe "#authorize" do
45
45
  before do
46
46
  @cli.options = @cli.options.merge("profile" => project_path + "/tmp/authorize", "display-url" => true)
47
- stub_post("/oauth/request_token").
48
- to_return(:body => fixture("request_token"))
49
- stub_post("/oauth/access_token").
50
- to_return(:body => fixture("access_token"))
51
- stub_get("/1/account/verify_credentials.json").
52
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
47
+ stub_post("/oauth/request_token").to_return(:body => fixture("request_token"))
48
+ stub_post("/oauth/access_token").to_return(:body => fixture("access_token"))
49
+ stub_get("/1.1/account/verify_credentials.json").with(:query => {:include_entities => "false", :skip_status => "true"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
53
50
  end
54
51
  it "should request the correct resource" do
55
52
  $stdout.should_receive(:print)
@@ -63,15 +60,12 @@ testcli
63
60
  $stdout.should_receive(:print).with("Enter the supplied PIN: ")
64
61
  $stdin.should_receive(:gets).and_return("1234567890")
65
62
  @cli.authorize
66
- a_post("/oauth/request_token").
67
- should have_been_made
68
- a_post("/oauth/access_token").
69
- should have_been_made
70
- a_get("/1/account/verify_credentials.json").
71
- should have_been_made
63
+ expect(a_post("/oauth/request_token")).to have_been_made
64
+ expect(a_post("/oauth/access_token")).to have_been_made
65
+ expect(a_get("/1.1/account/verify_credentials.json").with(:query => {:include_entities => "false", :skip_status => "true"})).to have_been_made
72
66
  end
73
67
  it "should not raise error" do
74
- lambda do
68
+ expect do
75
69
  $stdout.should_receive(:print)
76
70
  $stdin.should_receive(:gets).and_return("\n")
77
71
  $stdout.should_receive(:print).with("Enter your consumer key: ")
@@ -83,61 +77,47 @@ testcli
83
77
  $stdout.should_receive(:print).with("Enter the supplied PIN: ")
84
78
  $stdin.should_receive(:gets).and_return("1234567890")
85
79
  @cli.authorize
86
- end.should_not raise_error
80
+ end.not_to raise_error
87
81
  end
88
82
  end
89
83
 
90
84
  describe "#block" do
91
85
  before do
92
86
  @cli.options = @cli.options.merge("profile" => fixture_path + "/.trc")
93
- stub_post("/1.1/blocks/create.json").
94
- with(:body => {:screen_name => "sferik"}).
95
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
87
+ stub_post("/1.1/blocks/create.json").with(:body => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
96
88
  end
97
89
  it "should request the correct resource" do
98
90
  @cli.block("sferik")
99
- a_post("/1.1/blocks/create.json").
100
- with(:body => {:screen_name => "sferik"}).
101
- should have_been_made
91
+ expect(a_post("/1.1/blocks/create.json").with(:body => {:screen_name => "sferik"})).to have_been_made
102
92
  end
103
93
  it "should have the correct output" do
104
94
  @cli.block("sferik")
105
- $stdout.string.should =~ /^@testcli blocked 1 user/
95
+ expect($stdout.string).to match /^@testcli blocked 1 user/
106
96
  end
107
97
  context "--id" do
108
98
  before do
109
99
  @cli.options = @cli.options.merge("id" => true)
110
- stub_post("/1.1/blocks/create.json").
111
- with(:body => {:user_id => "7505382"}).
112
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
100
+ stub_post("/1.1/blocks/create.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
113
101
  end
114
102
  it "should request the correct resource" do
115
103
  @cli.block("7505382")
116
- a_post("/1.1/blocks/create.json").
117
- with(:body => {:user_id => "7505382"}).
118
- should have_been_made
104
+ expect(a_post("/1.1/blocks/create.json").with(:body => {:user_id => "7505382"})).to have_been_made
119
105
  end
120
106
  end
121
107
  end
122
108
 
123
109
  describe "#direct_messages" do
124
110
  before do
125
- stub_get("/1.1/direct_messages.json").
126
- with(:query => {:count => "20"}).
127
- to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
128
- stub_get("/1.1/direct_messages.json").
129
- with(:query => {:count => "10", "max_id"=>"1624782205"}).
130
- to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
111
+ stub_get("/1.1/direct_messages.json").with(:query => {:count => "20"}).to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
112
+ stub_get("/1.1/direct_messages.json").with(:query => {:count => "10", "max_id"=>"1624782205"}).to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
131
113
  end
132
114
  it "should request the correct resource" do
133
115
  @cli.direct_messages
134
- a_get("/1.1/direct_messages.json").
135
- with(:query => {:count => "20"}).
136
- should have_been_made
116
+ expect(a_get("/1.1/direct_messages.json").with(:query => {:count => "20"})).to have_been_made
137
117
  end
138
118
  it "should have the correct output" do
139
119
  @cli.direct_messages
140
- $stdout.string.should == <<-eos
120
+ expect($stdout.string).to eq <<-eos
141
121
  \e[1m\e[33m @sferik\e[0m
142
122
  Sounds good. Meeting Tuesday is fine.
143
123
 
@@ -182,7 +162,7 @@ testcli
182
162
  end
183
163
  it "should output in CSV format" do
184
164
  @cli.direct_messages
185
- $stdout.string.should == <<-eos
165
+ expect($stdout.string).to eq <<-eos
186
166
  ID,Posted at,Screen name,Text
187
167
  1773478249,2010-10-17 20:48:55 +0000,sferik,Sounds good. Meeting Tuesday is fine.
188
168
  1762960771,2010-10-14 21:43:30 +0000,sferik,That's great news! Let's plan to chat around 8 AM tomorrow Pacific time. Does that work for you?
@@ -203,7 +183,7 @@ ID,Posted at,Screen name,Text
203
183
  end
204
184
  it "should output in long format" do
205
185
  @cli.direct_messages
206
- $stdout.string.should == <<-eos
186
+ expect($stdout.string).to eq <<-eos
207
187
  ID Posted at Screen name Text
208
188
  1773478249 Oct 17 2010 @sferik Sounds good. Meeting Tuesday is fine.
209
189
  1762960771 Oct 14 2010 @sferik That's great news! Let's plan to chat ...
@@ -220,41 +200,25 @@ ID Posted at Screen name Text
220
200
  end
221
201
  context "--number" do
222
202
  before do
223
- stub_get("/1.1/direct_messages.json").
224
- with(:query => {:count => "1"}).
225
- to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
226
- stub_get("/1.1/direct_messages.json").
227
- with(:query => {:count => "200"}).
228
- to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
229
- stub_get("/1.1/direct_messages.json").
230
- with(:query => {:count => "200", :max_id => "1624782205"}).
231
- to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
203
+ stub_get("/1.1/direct_messages.json").with(:query => {:count => "1"}).to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
204
+ stub_get("/1.1/direct_messages.json").with(:query => {:count => "200"}).to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
205
+ stub_get("/1.1/direct_messages.json").with(:query => {:count => "200", :max_id => "1624782205"}).to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
232
206
  (5..195).step(10).to_a.reverse.each do |count|
233
- stub_get("/1.1/direct_messages.json").
234
- with(:query => {:count => count, :max_id => "1624782205"}).
235
- to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
207
+ stub_get("/1.1/direct_messages.json").with(:query => {:count => count, :max_id => "1624782205"}).to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
236
208
  end
237
209
  end
238
210
  it "should limit the number of results to 1" do
239
211
  @cli.options = @cli.options.merge("number" => 1)
240
212
  @cli.direct_messages
241
- a_get("/1.1/direct_messages.json").
242
- with(:query => {:count => "1"}).
243
- should have_been_made
213
+ expect(a_get("/1.1/direct_messages.json").with(:query => {:count => "1"})).to have_been_made
244
214
  end
245
215
  it "should limit the number of results to 345" do
246
216
  @cli.options = @cli.options.merge("number" => 345)
247
217
  @cli.direct_messages
248
- a_get("/1.1/direct_messages.json").
249
- with(:query => {:count => "200"}).
250
- should have_been_made
251
- a_get("/1.1/direct_messages.json").
252
- with(:query => {:count => "200", :max_id => "1624782205"}).
253
- should have_been_made.times(14)
218
+ expect(a_get("/1.1/direct_messages.json").with(:query => {:count => "200"})).to have_been_made
219
+ expect(a_get("/1.1/direct_messages.json").with(:query => {:count => "200", :max_id => "1624782205"})).to have_been_made.times(14)
254
220
  (5..195).step(10).to_a.reverse.each do |count|
255
- a_get("/1.1/direct_messages.json").
256
- with(:query => {:count => count, :max_id => "1624782205"}).
257
- should have_been_made
221
+ expect(a_get("/1.1/direct_messages.json").with(:query => {:count => count, :max_id => "1624782205"})).to have_been_made
258
222
  end
259
223
  end
260
224
  end
@@ -264,7 +228,7 @@ ID Posted at Screen name Text
264
228
  end
265
229
  it "should reverse the order of the sort" do
266
230
  @cli.direct_messages
267
- $stdout.string.should == <<-eos
231
+ expect($stdout.string).to eq <<-eos
268
232
  \e[1m\e[33m @sferik\e[0m
269
233
  I'm trying to debug the issue you were having with the Bundler Gemfile.lock
270
234
  shortref. What version of Ruby and RubyGems are you running?
@@ -308,22 +272,16 @@ ID Posted at Screen name Text
308
272
 
309
273
  describe "#direct_messages_sent" do
310
274
  before do
311
- stub_get("/1.1/direct_messages/sent.json").
312
- with(:query => {:count => "20"}).
313
- to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
314
- stub_get("/1.1/direct_messages/sent.json").
315
- with(:query => {:count => "10", "max_id"=>"1624782205"}).
316
- to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
275
+ stub_get("/1.1/direct_messages/sent.json").with(:query => {:count => "20"}).to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
276
+ stub_get("/1.1/direct_messages/sent.json").with(:query => {:count => "10", "max_id"=>"1624782205"}).to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
317
277
  end
318
278
  it "should request the correct resource" do
319
279
  @cli.direct_messages_sent
320
- a_get("/1.1/direct_messages/sent.json").
321
- with(:query => {:count => "20"}).
322
- should have_been_made
280
+ expect(a_get("/1.1/direct_messages/sent.json").with(:query => {:count => "20"})).to have_been_made
323
281
  end
324
282
  it "should have the correct output" do
325
283
  @cli.direct_messages_sent
326
- $stdout.string.should == <<-eos
284
+ expect($stdout.string).to eq <<-eos
327
285
  \e[1m\e[33m @hurrycane\e[0m
328
286
  Sounds good. Meeting Tuesday is fine.
329
287
 
@@ -368,7 +326,7 @@ ID Posted at Screen name Text
368
326
  end
369
327
  it "should output in CSV format" do
370
328
  @cli.direct_messages_sent
371
- $stdout.string.should == <<-eos
329
+ expect($stdout.string).to eq <<-eos
372
330
  ID,Posted at,Screen name,Text
373
331
  1773478249,2010-10-17 20:48:55 +0000,hurrycane,Sounds good. Meeting Tuesday is fine.
374
332
  1762960771,2010-10-14 21:43:30 +0000,hurrycane,That's great news! Let's plan to chat around 8 AM tomorrow Pacific time. Does that work for you?
@@ -389,7 +347,7 @@ ID,Posted at,Screen name,Text
389
347
  end
390
348
  it "should output in long format" do
391
349
  @cli.direct_messages_sent
392
- $stdout.string.should == <<-eos
350
+ expect($stdout.string).to eq <<-eos
393
351
  ID Posted at Screen name Text
394
352
  1773478249 Oct 17 2010 @hurrycane Sounds good. Meeting Tuesday is fine.
395
353
  1762960771 Oct 14 2010 @hurrycane That's great news! Let's plan to chat ...
@@ -406,41 +364,25 @@ ID Posted at Screen name Text
406
364
  end
407
365
  context "--number" do
408
366
  before do
409
- stub_get("/1.1/direct_messages/sent.json").
410
- with(:query => {:count => "1"}).
411
- to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
412
- stub_get("/1.1/direct_messages/sent.json").
413
- with(:query => {:count => "200"}).
414
- to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
415
- stub_get("/1.1/direct_messages/sent.json").
416
- with(:query => {:count => "200", :max_id => "1624782205"}).
417
- to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
367
+ stub_get("/1.1/direct_messages/sent.json").with(:query => {:count => "1"}).to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
368
+ stub_get("/1.1/direct_messages/sent.json").with(:query => {:count => "200"}).to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
369
+ stub_get("/1.1/direct_messages/sent.json").with(:query => {:count => "200", :max_id => "1624782205"}).to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
418
370
  (5..195).step(10).to_a.reverse.each do |count|
419
- stub_get("/1.1/direct_messages/sent.json").
420
- with(:query => {:count => count, :max_id => "1624782205"}).
421
- to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
371
+ stub_get("/1.1/direct_messages/sent.json").with(:query => {:count => count, :max_id => "1624782205"}).to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
422
372
  end
423
373
  end
424
374
  it "should limit the number of results 1" do
425
375
  @cli.options = @cli.options.merge("number" => 1)
426
376
  @cli.direct_messages_sent
427
- a_get("/1.1/direct_messages/sent.json").
428
- with(:query => {:count => "1"}).
429
- should have_been_made
377
+ expect(a_get("/1.1/direct_messages/sent.json").with(:query => {:count => "1"})).to have_been_made
430
378
  end
431
379
  it "should limit the number of results to 345" do
432
380
  @cli.options = @cli.options.merge("number" => 345)
433
381
  @cli.direct_messages_sent
434
- a_get("/1.1/direct_messages/sent.json").
435
- with(:query => {:count => "200"}).
436
- should have_been_made
437
- a_get("/1.1/direct_messages/sent.json").
438
- with(:query => {:count => "200", :max_id => "1624782205"}).
439
- should have_been_made.times(14)
382
+ expect(a_get("/1.1/direct_messages/sent.json").with(:query => {:count => "200"})).to have_been_made
383
+ expect(a_get("/1.1/direct_messages/sent.json").with(:query => {:count => "200", :max_id => "1624782205"})).to have_been_made.times(14)
440
384
  (5..195).step(10).to_a.reverse.each do |count|
441
- a_get("/1.1/direct_messages/sent.json").
442
- with(:query => {:count => count, :max_id => "1624782205"}).
443
- should have_been_made
385
+ expect(a_get("/1.1/direct_messages/sent.json").with(:query => {:count => count, :max_id => "1624782205"})).to have_been_made
444
386
  end
445
387
  end
446
388
  end
@@ -450,7 +392,7 @@ ID Posted at Screen name Text
450
392
  end
451
393
  it "should reverse the order of the sort" do
452
394
  @cli.direct_messages_sent
453
- $stdout.string.should == <<-eos
395
+ expect($stdout.string).to eq <<-eos
454
396
  \e[1m\e[33m @hurrycane\e[0m
455
397
  I'm trying to debug the issue you were having with the Bundler Gemfile.lock
456
398
  shortref. What version of Ruby and RubyGems are you running?
@@ -494,31 +436,19 @@ ID Posted at Screen name Text
494
436
 
495
437
  describe "#groupies" do
496
438
  before do
497
- stub_get("/1.1/followers/ids.json").
498
- with(:query => {:cursor => "-1"}).
499
- to_return(:body => fixture("followers_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
500
- stub_get("/1.1/friends/ids.json").
501
- with(:query => {:cursor => "-1"}).
502
- to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
503
- stub_post("/1.1/users/lookup.json").
504
- with(:body => {:user_id => "213747670,428004849"}).
505
- to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
439
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("followers_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
440
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
441
+ stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "213747670,428004849"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
506
442
  end
507
443
  it "should request the correct resource" do
508
444
  @cli.groupies
509
- a_get("/1.1/followers/ids.json").
510
- with(:query => {:cursor => "-1"}).
511
- should have_been_made
512
- a_get("/1.1/friends/ids.json").
513
- with(:query => {:cursor => "-1"}).
514
- should have_been_made
515
- a_post("/1.1/users/lookup.json").
516
- with(:body => {:user_id => "213747670,428004849"}).
517
- should have_been_made
445
+ expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
446
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
447
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "213747670,428004849"})).to have_been_made
518
448
  end
519
449
  it "should have the correct output" do
520
450
  @cli.groupies
521
- $stdout.string.chomp.should == "pengwynn sferik"
451
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
522
452
  end
523
453
  context "--csv" do
524
454
  before do
@@ -526,7 +456,7 @@ ID Posted at Screen name Text
526
456
  end
527
457
  it "should output in CSV format" do
528
458
  @cli.groupies
529
- $stdout.string.should == <<-eos
459
+ expect($stdout.string).to eq <<-eos
530
460
  ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
531
461
  14100886,2008-03-08 16:34:22 +0000,2012-07-07 20:33:19 +0000,6940,192,358,3427,5457,pengwynn,Wynn Netherland ⚡
532
462
  7505382,2007-07-16 12:59:01 +0000,2012-07-08 18:29:20 +0000,7890,3755,118,212,2262,sferik,Erik Michaels-Ober
@@ -539,7 +469,7 @@ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name
539
469
  end
540
470
  it "should output in long format" do
541
471
  @cli.groupies
542
- $stdout.string.should == <<-eos
472
+ expect($stdout.string).to eq <<-eos
543
473
  ID Since Last tweeted at Tweets Favorites Listed Following...
544
474
  14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
545
475
  7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
@@ -552,7 +482,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
552
482
  end
553
483
  it "should reverse the order of the sort" do
554
484
  @cli.groupies
555
- $stdout.string.chomp.should == "sferik pengwynn"
485
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
556
486
  end
557
487
  end
558
488
  context "--sort=favorites" do
@@ -561,7 +491,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
561
491
  end
562
492
  it "should sort by number of favorites" do
563
493
  @cli.groupies
564
- $stdout.string.chomp.should == "pengwynn sferik"
494
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
565
495
  end
566
496
  end
567
497
  context "--sort=followers" do
@@ -570,7 +500,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
570
500
  end
571
501
  it "should sort by number of followers" do
572
502
  @cli.groupies
573
- $stdout.string.chomp.should == "sferik pengwynn"
503
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
574
504
  end
575
505
  end
576
506
  context "--sort=friends" do
@@ -579,7 +509,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
579
509
  end
580
510
  it "should sort by number of friends" do
581
511
  @cli.groupies
582
- $stdout.string.chomp.should == "sferik pengwynn"
512
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
583
513
  end
584
514
  end
585
515
  context "--sort=listed" do
@@ -588,7 +518,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
588
518
  end
589
519
  it "should sort by number of list memberships" do
590
520
  @cli.groupies
591
- $stdout.string.chomp.should == "sferik pengwynn"
521
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
592
522
  end
593
523
  end
594
524
  context "--sort=since" do
@@ -597,7 +527,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
597
527
  end
598
528
  it "should sort by the time when Twitter acount was created" do
599
529
  @cli.groupies
600
- $stdout.string.chomp.should == "sferik pengwynn"
530
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
601
531
  end
602
532
  end
603
533
  context "--sort=tweets" do
@@ -606,7 +536,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
606
536
  end
607
537
  it "should sort by number of Tweets" do
608
538
  @cli.groupies
609
- $stdout.string.chomp.should == "pengwynn sferik"
539
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
610
540
  end
611
541
  end
612
542
  context "--sort=tweeted" do
@@ -615,7 +545,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
615
545
  end
616
546
  it "should sort by the time of the last Tweet" do
617
547
  @cli.groupies
618
- $stdout.string.chomp.should == "pengwynn sferik"
548
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
619
549
  end
620
550
  end
621
551
  context "--unsorted" do
@@ -624,51 +554,31 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
624
554
  end
625
555
  it "should not be sorted" do
626
556
  @cli.groupies
627
- $stdout.string.chomp.should == "pengwynn sferik"
557
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
628
558
  end
629
559
  end
630
560
  context "with a user passed" do
631
561
  before do
632
- stub_get("/1.1/followers/ids.json").
633
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
634
- to_return(:body => fixture("followers_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
635
- stub_get("/1.1/friends/ids.json").
636
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
637
- to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
562
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("followers_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
563
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
638
564
  end
639
565
  it "should request the correct resource" do
640
566
  @cli.groupies("sferik")
641
- a_get("/1.1/followers/ids.json").
642
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
643
- should have_been_made
644
- a_get("/1.1/friends/ids.json").
645
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
646
- should have_been_made
647
- a_post("/1.1/users/lookup.json").
648
- with(:body => {:user_id => "213747670,428004849"}).
649
- should have_been_made
567
+ expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
568
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
569
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "213747670,428004849"})).to have_been_made
650
570
  end
651
571
  context "--id" do
652
572
  before do
653
573
  @cli.options = @cli.options.merge("id" => true)
654
- stub_get("/1.1/followers/ids.json").
655
- with(:query => {:cursor => "-1", :user_id => "7505382"}).
656
- to_return(:body => fixture("followers_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
657
- stub_get("/1.1/friends/ids.json").
658
- with(:query => {:cursor => "-1", :user_id => "7505382"}).
659
- to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
574
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("followers_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
575
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
660
576
  end
661
577
  it "should request the correct resource" do
662
578
  @cli.groupies("7505382")
663
- a_get("/1.1/followers/ids.json").
664
- with(:query => {:cursor => "-1", :user_id => "7505382"}).
665
- should have_been_made
666
- a_get("/1.1/friends/ids.json").
667
- with(:query => {:cursor => "-1", :user_id => "7505382"}).
668
- should have_been_made
669
- a_post("/1.1/users/lookup.json").
670
- with(:body => {:user_id => "213747670,428004849"}).
671
- should have_been_made
579
+ expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
580
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
581
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "213747670,428004849"})).to have_been_made
672
582
  end
673
583
  end
674
584
  end
@@ -677,32 +587,24 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
677
587
  describe "#dm" do
678
588
  before do
679
589
  @cli.options = @cli.options.merge("profile" => fixture_path + "/.trc")
680
- stub_post("/1.1/direct_messages/new.json").
681
- with(:body => {:screen_name => "pengwynn", :text => "Creating a fixture for the Twitter gem"}).
682
- to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
590
+ stub_post("/1.1/direct_messages/new.json").with(:body => {:screen_name => "pengwynn", :text => "Creating a fixture for the Twitter gem"}).to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
683
591
  end
684
592
  it "should request the correct resource" do
685
593
  @cli.dm("pengwynn", "Creating a fixture for the Twitter gem")
686
- a_post("/1.1/direct_messages/new.json").
687
- with(:body => {:screen_name => "pengwynn", :text => "Creating a fixture for the Twitter gem"}).
688
- should have_been_made
594
+ expect(a_post("/1.1/direct_messages/new.json").with(:body => {:screen_name => "pengwynn", :text => "Creating a fixture for the Twitter gem"})).to have_been_made
689
595
  end
690
596
  it "should have the correct output" do
691
597
  @cli.dm("pengwynn", "Creating a fixture for the Twitter gem")
692
- $stdout.string.chomp.should == "Direct Message sent from @testcli to @pengwynn."
598
+ expect($stdout.string.chomp).to eq "Direct Message sent from @testcli to @pengwynn."
693
599
  end
694
600
  context "--id" do
695
601
  before do
696
602
  @cli.options = @cli.options.merge("id" => true)
697
- stub_post("/1.1/direct_messages/new.json").
698
- with(:body => {:user_id => "14100886", :text => "Creating a fixture for the Twitter gem"}).
699
- to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
603
+ stub_post("/1.1/direct_messages/new.json").with(:body => {:user_id => "14100886", :text => "Creating a fixture for the Twitter gem"}).to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
700
604
  end
701
605
  it "should request the correct resource" do
702
606
  @cli.dm("14100886", "Creating a fixture for the Twitter gem")
703
- a_post("/1.1/direct_messages/new.json").
704
- with(:body => {:user_id => "14100886", :text => "Creating a fixture for the Twitter gem"}).
705
- should have_been_made
607
+ expect(a_post("/1.1/direct_messages/new.json").with(:body => {:user_id => "14100886", :text => "Creating a fixture for the Twitter gem"})).to have_been_made
706
608
  end
707
609
  end
708
610
  end
@@ -710,85 +612,61 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
710
612
  describe "#does_contain" do
711
613
  before do
712
614
  @cli.options = @cli.options.merge("profile" => fixture_path + "/.trc")
713
- stub_get("/1.1/lists/members/show.json").
714
- with(:query => {:owner_screen_name => "testcli", :screen_name => "testcli", :slug => "presidents"}).
715
- to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
615
+ stub_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => "testcli", :screen_name => "testcli", :slug => "presidents"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
716
616
  end
717
617
  it "should request the correct resource" do
718
618
  @cli.does_contain("presidents")
719
- a_get("/1.1/lists/members/show.json").
720
- with(:query => {:owner_screen_name => "testcli", :screen_name => "testcli", :slug => "presidents"}).
721
- should have_been_made
619
+ expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => "testcli", :screen_name => "testcli", :slug => "presidents"})).to have_been_made
722
620
  end
723
621
  it "should have the correct output" do
724
622
  @cli.does_contain("presidents")
725
- $stdout.string.chomp.should == "Yes, presidents contains @testcli."
623
+ expect($stdout.string.chomp).to eq "Yes, presidents contains @testcli."
726
624
  end
727
625
  context "--id" do
728
626
  before do
729
627
  @cli.options = @cli.options.merge("id" => true)
730
- stub_get("/1.1/users/show.json").
731
- with(:query => {:user_id => "7505382"}).
732
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
733
- stub_get("/1.1/lists/members/show.json").
734
- with(:query => {:owner_screen_name => "testcli", :screen_name => "sferik", :slug => "presidents"}).
735
- to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
628
+ stub_get("/1.1/users/show.json").with(:query => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
629
+ stub_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => "testcli", :screen_name => "sferik", :slug => "presidents"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
736
630
  end
737
631
  it "should request the correct resource" do
738
632
  @cli.does_contain("presidents", "7505382")
739
- a_get("/1.1/users/show.json").
740
- with(:query => {:user_id => "7505382"}).
741
- should have_been_made
742
- a_get("/1.1/lists/members/show.json").
743
- with(:query => {:owner_screen_name => "testcli", :screen_name => "sferik", :slug => "presidents"}).
744
- should have_been_made
633
+ expect(a_get("/1.1/users/show.json").with(:query => {:user_id => "7505382"})).to have_been_made
634
+ expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => "testcli", :screen_name => "sferik", :slug => "presidents"})).to have_been_made
745
635
  end
746
636
  end
747
637
  context "with an owner passed" do
748
638
  it "should have the correct output" do
749
639
  @cli.does_contain("testcli/presidents", "testcli")
750
- $stdout.string.chomp.should == "Yes, presidents contains @testcli."
640
+ expect($stdout.string.chomp).to eq "Yes, presidents contains @testcli."
751
641
  end
752
642
  context "--id" do
753
643
  before do
754
644
  @cli.options = @cli.options.merge("id" => true)
755
- stub_get("/1.1/users/show.json").
756
- with(:query => {:user_id => "7505382"}).
757
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
758
- stub_get("/1.1/lists/members/show.json").
759
- with(:query => {:owner_id => "7505382", :screen_name => "sferik", :slug => "presidents"}).
760
- to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
645
+ stub_get("/1.1/users/show.json").with(:query => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
646
+ stub_get("/1.1/lists/members/show.json").with(:query => {:owner_id => "7505382", :screen_name => "sferik", :slug => "presidents"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
761
647
  end
762
648
  it "should request the correct resource" do
763
649
  @cli.does_contain("7505382/presidents", "7505382")
764
- a_get("/1.1/users/show.json").
765
- with(:query => {:user_id => "7505382"}).
766
- should have_been_made
767
- a_get("/1.1/lists/members/show.json").
768
- with(:query => {:owner_id => "7505382", :screen_name => "sferik", :slug => "presidents"}).
769
- should have_been_made
650
+ expect(a_get("/1.1/users/show.json").with(:query => {:user_id => "7505382"})).to have_been_made
651
+ expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_id => "7505382", :screen_name => "sferik", :slug => "presidents"})).to have_been_made
770
652
  end
771
653
  end
772
654
  end
773
655
  context "with a user passed" do
774
656
  it "should have the correct output" do
775
657
  @cli.does_contain("presidents", "testcli")
776
- $stdout.string.chomp.should == "Yes, presidents contains @testcli."
658
+ expect($stdout.string.chomp).to eq "Yes, presidents contains @testcli."
777
659
  end
778
660
  end
779
661
  context "false" do
780
662
  before do
781
- stub_get("/1.1/lists/members/show.json").
782
- with(:query => {:owner_screen_name => "testcli", :screen_name => "testcli", :slug => "presidents"}).
783
- to_return(:body => fixture("not_found.json"), :status => 404, :headers => {:content_type => "application/json; charset=utf-8"})
663
+ stub_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => "testcli", :screen_name => "testcli", :slug => "presidents"}).to_return(:body => fixture("not_found.json"), :status => 404, :headers => {:content_type => "application/json; charset=utf-8"})
784
664
  end
785
665
  it "should exit" do
786
- lambda do
666
+ expect do
787
667
  @cli.does_contain("presidents")
788
- end.should raise_error(SystemExit)
789
- a_get("/1.1/lists/members/show.json").
790
- with(:query => {:owner_screen_name => "testcli", :screen_name => "testcli", :slug => "presidents"}).
791
- should have_been_made
668
+ end.to raise_error(SystemExit)
669
+ expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => "testcli", :screen_name => "testcli", :slug => "presidents"})).to have_been_made
792
670
  end
793
671
  end
794
672
  end
@@ -796,91 +674,61 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
796
674
  describe "#does_follow" do
797
675
  before do
798
676
  @cli.options = @cli.options.merge("profile" => fixture_path + "/.trc")
799
- stub_get("/1.1/friendships/show.json").
800
- with(:query => {:source_screen_name => "ev", :target_screen_name => "testcli"}).
801
- to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
677
+ stub_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "ev", :target_screen_name => "testcli"}).to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
802
678
  end
803
679
  it "should request the correct resource" do
804
680
  @cli.does_follow("ev")
805
- a_get("/1.1/friendships/show.json").
806
- with(:query => {:source_screen_name => "ev", :target_screen_name => "testcli"}).
807
- should have_been_made
681
+ expect(a_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "ev", :target_screen_name => "testcli"})).to have_been_made
808
682
  end
809
683
  it "should have the correct output" do
810
684
  @cli.does_follow("ev")
811
- $stdout.string.chomp.should == "Yes, @ev follows @testcli."
685
+ expect($stdout.string.chomp).to eq "Yes, @ev follows @testcli."
812
686
  end
813
687
  context "--id" do
814
688
  before do
815
689
  @cli.options = @cli.options.merge("id" => true)
816
- stub_get("/1.1/users/show.json").
817
- with(:query => {:user_id => "20"}).
818
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
819
- stub_get("/1.1/friendships/show.json").
820
- with(:query => {:source_screen_name => "sferik", :target_screen_name => "testcli"}).
821
- to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
690
+ stub_get("/1.1/users/show.json").with(:query => {:user_id => "20"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
691
+ stub_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "sferik", :target_screen_name => "testcli"}).to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
822
692
  end
823
693
  it "should request the correct resource" do
824
694
  @cli.does_follow("20")
825
- a_get("/1.1/users/show.json").
826
- with(:query => {:user_id => "20"}).
827
- should have_been_made
828
- a_get("/1.1/friendships/show.json").
829
- with(:query => {:source_screen_name => "sferik", :target_screen_name => "testcli"}).
830
- should have_been_made
695
+ expect(a_get("/1.1/users/show.json").with(:query => {:user_id => "20"})).to have_been_made
696
+ expect(a_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "sferik", :target_screen_name => "testcli"})).to have_been_made
831
697
  end
832
698
  end
833
699
  context "with a user passed" do
834
700
  before do
835
701
  @cli.options = @cli.options.merge("id" => true)
836
- stub_get("/1.1/users/show.json").
837
- with(:query => {:user_id => "0"}).
838
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
839
- stub_get("/1.1/friendships/show.json").
840
- with(:query => {:source_screen_name => "sferik", :target_screen_name => "sferik"}).
841
- to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
702
+ stub_get("/1.1/users/show.json").with(:query => {:user_id => "0"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
703
+ stub_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "sferik", :target_screen_name => "sferik"}).to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
842
704
  end
843
705
  it "should have the correct output" do
844
706
  @cli.does_follow("ev", "testcli")
845
- $stdout.string.chomp.should == "Yes, @sferik follows @sferik."
707
+ expect($stdout.string.chomp).to eq "Yes, @sferik follows @sferik."
846
708
  end
847
709
  context "--id" do
848
710
  before do
849
711
  @cli.options = @cli.options.merge("id" => true)
850
- stub_get("/1.1/users/show.json").
851
- with(:query => {:user_id => "20"}).
852
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
853
- stub_get("/1.1/users/show.json").
854
- with(:query => {:user_id => "428004849"}).
855
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
712
+ stub_get("/1.1/users/show.json").with(:query => {:user_id => "20"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
713
+ stub_get("/1.1/users/show.json").with(:query => {:user_id => "428004849"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
856
714
  end
857
715
  it "should request the correct resource" do
858
716
  @cli.does_follow("20", "428004849")
859
- a_get("/1.1/users/show.json").
860
- with(:query => {:user_id => "20"}).
861
- should have_been_made
862
- a_get("/1.1/users/show.json").
863
- with(:query => {:user_id => "428004849"}).
864
- should have_been_made
865
- a_get("/1.1/friendships/show.json").
866
- with(:query => {:source_screen_name => "sferik", :target_screen_name => "sferik"}).
867
- should have_been_made
717
+ expect(a_get("/1.1/users/show.json").with(:query => {:user_id => "20"})).to have_been_made
718
+ expect(a_get("/1.1/users/show.json").with(:query => {:user_id => "428004849"})).to have_been_made
719
+ expect(a_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "sferik", :target_screen_name => "sferik"})).to have_been_made
868
720
  end
869
721
  end
870
722
  end
871
723
  context "false" do
872
724
  before do
873
- stub_get("/1.1/friendships/show.json").
874
- with(:query => {:source_screen_name => "ev", :target_screen_name => "testcli"}).
875
- to_return(:body => fixture("not_following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
725
+ stub_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "ev", :target_screen_name => "testcli"}).to_return(:body => fixture("not_following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
876
726
  end
877
727
  it "should exit" do
878
- lambda do
728
+ expect do
879
729
  @cli.does_follow("ev")
880
- end.should raise_error(SystemExit)
881
- a_get("/1.1/friendships/show.json").
882
- with(:query => {:source_screen_name => "ev", :target_screen_name => "testcli"}).
883
- should have_been_made
730
+ end.to raise_error(SystemExit)
731
+ expect(a_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "ev", :target_screen_name => "testcli"})).to have_been_made
884
732
  end
885
733
  end
886
734
  end
@@ -888,37 +736,29 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
888
736
  describe "#favorite" do
889
737
  before do
890
738
  @cli.options = @cli.options.merge("profile" => fixture_path + "/.trc")
891
- stub_post("/1.1/favorites/create.json").
892
- with(:body => {:id => "26755176471724032"}).
893
- to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
739
+ stub_post("/1.1/favorites/create.json").with(:body => {:id => "26755176471724032"}).to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
894
740
  end
895
741
  it "should request the correct resource" do
896
742
  @cli.favorite("26755176471724032")
897
- a_post("/1.1/favorites/create.json").
898
- with(:body => {:id => "26755176471724032"}).
899
- should have_been_made
743
+ expect(a_post("/1.1/favorites/create.json").with(:body => {:id => "26755176471724032"})).to have_been_made
900
744
  end
901
745
  it "should have the correct output" do
902
746
  @cli.favorite("26755176471724032")
903
- $stdout.string.should =~ /^@testcli favorited 1 tweet.$/
747
+ expect($stdout.string).to match /^@testcli favorited 1 tweet.$/
904
748
  end
905
749
  end
906
750
 
907
751
  describe "#favorites" do
908
752
  before do
909
- stub_get("/1.1/favorites/list.json").
910
- with(:query => {:count => "20"}).
911
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
753
+ stub_get("/1.1/favorites/list.json").with(:query => {:count => "20"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
912
754
  end
913
755
  it "should request the correct resource" do
914
756
  @cli.favorites
915
- a_get("/1.1/favorites/list.json").
916
- with(:query => {:count => "20"}).
917
- should have_been_made
757
+ expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "20"})).to have_been_made
918
758
  end
919
759
  it "should have the correct output" do
920
760
  @cli.favorites
921
- $stdout.string.should == <<-eos
761
+ expect($stdout.string).to eq <<-eos
922
762
  \e[1m\e[33m @mutgoff\e[0m
923
763
  Happy Birthday @imdane. Watch out for those @rally pranksters!
924
764
 
@@ -1002,7 +842,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1002
842
  end
1003
843
  it "should output in CSV format" do
1004
844
  @cli.favorites
1005
- $stdout.string.should == <<-eos
845
+ expect($stdout.string).to eq <<-eos
1006
846
  ID,Posted at,Screen name,Text
1007
847
  244111636544225280,2012-09-07 16:35:24 +0000,mutgoff,Happy Birthday @imdane. Watch out for those @rally pranksters!
1008
848
  244111183165157376,2012-09-07 16:33:36 +0000,ironicsans,"If you like good real-life stories, check out @NarrativelyNY's just-launched site http://t.co/wiUL07jE (and also visit http://t.co/ZoyQxqWA)"
@@ -1033,7 +873,7 @@ ID,Posted at,Screen name,Text
1033
873
  end
1034
874
  it "should output in long format" do
1035
875
  @cli.favorites
1036
- $stdout.string.should == <<-eos
876
+ expect($stdout.string).to eq <<-eos
1037
877
  ID Posted at Screen name Text
1038
878
  244111636544225280 Sep 7 08:35 @mutgoff Happy Birthday @imdane. W...
1039
879
  244111183165157376 Sep 7 08:33 @ironicsans If you like good real-lif...
@@ -1063,7 +903,7 @@ ID Posted at Screen name Text
1063
903
  end
1064
904
  it "should reverse the order of the sort" do
1065
905
  @cli.favorites
1066
- $stdout.string.should == <<-eos
906
+ expect($stdout.string).to eq <<-eos
1067
907
  ID Posted at Screen name Text
1068
908
  244099460672679938 Sep 7 07:47 @dwiskus Gentlemen, you can't figh...
1069
909
  244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did y...
@@ -1091,68 +931,44 @@ ID Posted at Screen name Text
1091
931
  end
1092
932
  context "--number" do
1093
933
  before do
1094
- stub_get("/1.1/favorites/list.json").
1095
- with(:query => {:count => "1"}).
1096
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1097
- stub_get("/1.1/favorites/list.json").
1098
- with(:query => {:count => "200"}).
1099
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1100
- stub_get("/1.1/favorites/list.json").
1101
- with(:query => {:count => "200", :max_id => "244099460672679937"}).
1102
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
934
+ stub_get("/1.1/favorites/list.json").with(:query => {:count => "1"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
935
+ 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"})
936
+ stub_get("/1.1/favorites/list.json").with(:query => {:count => "200", :max_id => "244099460672679937"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1103
937
  (5..185).step(20).to_a.reverse.each do |count|
1104
- stub_get("/1.1/favorites/list.json").
1105
- with(:query => {:count => count, :max_id => "244099460672679937"}).
1106
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
938
+ stub_get("/1.1/favorites/list.json").with(:query => {:count => count, :max_id => "244099460672679937"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1107
939
  end
1108
940
  end
1109
941
  it "should limit the number of results to 1" do
1110
942
  @cli.options = @cli.options.merge("number" => 1)
1111
943
  @cli.favorites
1112
- a_get("/1.1/favorites/list.json").
1113
- with(:query => {:count => "1"}).
1114
- should have_been_made
944
+ expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "1"})).to have_been_made
1115
945
  end
1116
946
  it "should limit the number of results to 345" do
1117
947
  @cli.options = @cli.options.merge("number" => 345)
1118
948
  @cli.favorites
1119
- a_get("/1.1/favorites/list.json").
1120
- with(:query => {:count => "200"}).
1121
- should have_been_made
1122
- a_get("/1.1/favorites/list.json").
1123
- with(:query => {:count => "200", :max_id => "244099460672679937"}).
1124
- should have_been_made.times(7)
949
+ expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "200"})).to have_been_made
950
+ expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "200", :max_id => "244099460672679937"})).to have_been_made.times(7)
1125
951
  (5..185).step(20).to_a.reverse.each do |count|
1126
- a_get("/1.1/favorites/list.json").
1127
- with(:query => {:count => count, :max_id => "244099460672679937"}).
1128
- should have_been_made
952
+ expect(a_get("/1.1/favorites/list.json").with(:query => {:count => count, :max_id => "244099460672679937"})).to have_been_made
1129
953
  end
1130
954
  end
1131
955
  end
1132
956
  context "with a user passed" do
1133
957
  before do
1134
- stub_get("/1.1/favorites/list.json").
1135
- with(:query => {:count => "20", :screen_name => "sferik"}).
1136
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
958
+ stub_get("/1.1/favorites/list.json").with(:query => {:count => "20", :screen_name => "sferik"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1137
959
  end
1138
960
  it "should request the correct resource" do
1139
961
  @cli.favorites("sferik")
1140
- a_get("/1.1/favorites/list.json").
1141
- with(:query => {:count => "20", :screen_name => "sferik"}).
1142
- should have_been_made
962
+ expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "20", :screen_name => "sferik"})).to have_been_made
1143
963
  end
1144
964
  context "--id" do
1145
965
  before do
1146
966
  @cli.options = @cli.options.merge("id" => true)
1147
- stub_get("/1.1/favorites/list.json").
1148
- with(:query => {:user_id => "7505382", :count => "20"}).
1149
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
967
+ stub_get("/1.1/favorites/list.json").with(:query => {:user_id => "7505382", :count => "20"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1150
968
  end
1151
969
  it "should request the correct resource" do
1152
970
  @cli.favorites("7505382")
1153
- a_get("/1.1/favorites/list.json").
1154
- with(:query => {:user_id => "7505382", :count => "20"}).
1155
- should have_been_made
971
+ expect(a_get("/1.1/favorites/list.json").with(:query => {:user_id => "7505382", :count => "20"})).to have_been_made
1156
972
  end
1157
973
  end
1158
974
  end
@@ -1164,81 +980,45 @@ ID Posted at Screen name Text
1164
980
  end
1165
981
  context "one user" do
1166
982
  before do
1167
- stub_get("/1.1/friends/ids.json").
1168
- with(:query => {:cursor => "-1"}).
1169
- to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1170
- stub_post("/1.1/users/lookup.json").
1171
- with(:body => {:screen_name => "sferik,pengwynn"}).
1172
- to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1173
- stub_post("/1.1/friendships/create.json").
1174
- with(:body => {:user_id => "14100886"}).
1175
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
983
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
984
+ stub_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
985
+ stub_post("/1.1/friendships/create.json").with(:body => {:user_id => "14100886"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1176
986
  end
1177
987
  it "should request the correct resource" do
1178
988
  @cli.follow("sferik", "pengwynn")
1179
- a_get("/1.1/friends/ids.json").
1180
- with(:query => {:cursor => "-1"}).
1181
- should have_been_made
1182
- a_post("/1.1/users/lookup.json").
1183
- with(:body => {:screen_name => "sferik,pengwynn"}).
1184
- should have_been_made
1185
- a_post("/1.1/friendships/create.json").
1186
- with(:body => {:user_id => "14100886"}).
1187
- should have_been_made
989
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
990
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"})).to have_been_made
991
+ expect(a_post("/1.1/friendships/create.json").with(:body => {:user_id => "14100886"})).to have_been_made
1188
992
  end
1189
993
  it "should have the correct output" do
1190
994
  @cli.follow("sferik", "pengwynn")
1191
- $stdout.string.should =~ /^@testcli is now following 1 more user\.$/
995
+ expect($stdout.string).to match /^@testcli is now following 1 more user\.$/
1192
996
  end
1193
997
  context "--id" do
1194
998
  before do
1195
999
  @cli.options = @cli.options.merge("id" => true)
1196
- stub_get("/1.1/friends/ids.json").
1197
- with(:query => {:cursor => "-1"}).
1198
- to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1199
- stub_post("/1.1/users/lookup.json").
1200
- with(:body => {:user_id => "7505382,14100886"}).
1201
- to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1202
- stub_post("/1.1/friendships/create.json").
1203
- with(:body => {:user_id => "14100886"}).
1204
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1000
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1001
+ stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382,14100886"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1002
+ stub_post("/1.1/friendships/create.json").with(:body => {:user_id => "14100886"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1205
1003
  end
1206
1004
  it "should request the correct resource" do
1207
1005
  @cli.follow("7505382", "14100886")
1208
- a_get("/1.1/friends/ids.json").
1209
- with(:query => {:cursor => "-1"}).
1210
- should have_been_made
1211
- a_post("/1.1/users/lookup.json").
1212
- with(:body => {:user_id => "7505382,14100886"}).
1213
- should have_been_made
1214
- a_post("/1.1/friendships/create.json").
1215
- with(:body => {:user_id => "14100886"}).
1216
- should have_been_made
1006
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
1007
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382,14100886"})).to have_been_made
1008
+ expect(a_post("/1.1/friendships/create.json").with(:body => {:user_id => "14100886"})).to have_been_made
1217
1009
  end
1218
1010
  end
1219
1011
  context "Twitter is down" do
1220
1012
  it "should retry 3 times and then raise an error" do
1221
- stub_get("/1.1/friends/ids.json").
1222
- with(:query => {:cursor => "-1"}).
1223
- to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1224
- stub_post("/1.1/users/lookup.json").
1225
- with(:body => {:screen_name => "sferik,pengwynn"}).
1226
- to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1227
- stub_post("/1.1/friendships/create.json").
1228
- with(:body => {:user_id => "14100886"}).
1229
- to_return(:status => 502)
1230
- lambda do
1013
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1014
+ stub_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1015
+ stub_post("/1.1/friendships/create.json").with(:body => {:user_id => "14100886"}).to_return(:status => 502)
1016
+ expect do
1231
1017
  @cli.follow("sferik", "pengwynn")
1232
- end.should raise_error("Twitter is down or being upgraded.")
1233
- a_get("/1.1/friends/ids.json").
1234
- with(:query => {:cursor => "-1"}).
1235
- should have_been_made.times(3)
1236
- a_post("/1.1/users/lookup.json").
1237
- with(:body => {:screen_name => "sferik,pengwynn"}).
1238
- should have_been_made.times(3)
1239
- a_post("/1.1/friendships/create.json").
1240
- with(:body => {:user_id => "14100886"}).
1241
- should have_been_made.times(3)
1018
+ end.to raise_error("Twitter is down or being upgraded.")
1019
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"})).to have_been_made.times(3)
1020
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"})).to have_been_made.times(3)
1021
+ expect(a_post("/1.1/friendships/create.json").with(:body => {:user_id => "14100886"})).to have_been_made.times(3)
1242
1022
  end
1243
1023
  end
1244
1024
  end
@@ -1246,25 +1026,17 @@ ID Posted at Screen name Text
1246
1026
 
1247
1027
  describe "#followings" do
1248
1028
  before do
1249
- stub_get("/1.1/friends/ids.json").
1250
- with(:query => {:cursor => "-1"}).
1251
- to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1252
- stub_post("/1.1/users/lookup.json").
1253
- with(:body => {:user_id => "7505382"}).
1254
- to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1029
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1030
+ stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1255
1031
  end
1256
1032
  it "should request the correct resource" do
1257
1033
  @cli.followings
1258
- a_get("/1.1/friends/ids.json").
1259
- with(:query => {:cursor => "-1"}).
1260
- should have_been_made
1261
- a_post("/1.1/users/lookup.json").
1262
- with(:body => {:user_id => "7505382"}).
1263
- should have_been_made
1034
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
1035
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"})).to have_been_made
1264
1036
  end
1265
1037
  it "should have the correct output" do
1266
1038
  @cli.followings
1267
- $stdout.string.chomp.should == "pengwynn sferik"
1039
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
1268
1040
  end
1269
1041
  context "--csv" do
1270
1042
  before do
@@ -1272,7 +1044,7 @@ ID Posted at Screen name Text
1272
1044
  end
1273
1045
  it "should output in CSV format" do
1274
1046
  @cli.followings
1275
- $stdout.string.should == <<-eos
1047
+ expect($stdout.string).to eq <<-eos
1276
1048
  ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
1277
1049
  14100886,2008-03-08 16:34:22 +0000,2012-07-07 20:33:19 +0000,6940,192,358,3427,5457,pengwynn,Wynn Netherland ⚡
1278
1050
  7505382,2007-07-16 12:59:01 +0000,2012-07-08 18:29:20 +0000,7890,3755,118,212,2262,sferik,Erik Michaels-Ober
@@ -1285,7 +1057,7 @@ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name
1285
1057
  end
1286
1058
  it "should output in long format" do
1287
1059
  @cli.followings
1288
- $stdout.string.should == <<-eos
1060
+ expect($stdout.string).to eq <<-eos
1289
1061
  ID Since Last tweeted at Tweets Favorites Listed Following...
1290
1062
  14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
1291
1063
  7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
@@ -1298,7 +1070,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1298
1070
  end
1299
1071
  it "should reverse the order of the sort" do
1300
1072
  @cli.followings
1301
- $stdout.string.chomp.should == "sferik pengwynn"
1073
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
1302
1074
  end
1303
1075
  end
1304
1076
  context "--sort=favorites" do
@@ -1307,7 +1079,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1307
1079
  end
1308
1080
  it "should sort by number of favorites" do
1309
1081
  @cli.followings
1310
- $stdout.string.chomp.should == "pengwynn sferik"
1082
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
1311
1083
  end
1312
1084
  end
1313
1085
  context "--sort=followers" do
@@ -1316,7 +1088,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1316
1088
  end
1317
1089
  it "should sort by number of followers" do
1318
1090
  @cli.followings
1319
- $stdout.string.chomp.should == "sferik pengwynn"
1091
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
1320
1092
  end
1321
1093
  end
1322
1094
  context "--sort=friends" do
@@ -1325,7 +1097,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1325
1097
  end
1326
1098
  it "should sort by number of friends" do
1327
1099
  @cli.followings
1328
- $stdout.string.chomp.should == "sferik pengwynn"
1100
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
1329
1101
  end
1330
1102
  end
1331
1103
  context "--sort=listed" do
@@ -1334,7 +1106,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1334
1106
  end
1335
1107
  it "should sort by number of list memberships" do
1336
1108
  @cli.followings
1337
- $stdout.string.chomp.should == "sferik pengwynn"
1109
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
1338
1110
  end
1339
1111
  end
1340
1112
  context "--sort=since" do
@@ -1343,7 +1115,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1343
1115
  end
1344
1116
  it "should sort by the time when Twitter acount was created" do
1345
1117
  @cli.followings
1346
- $stdout.string.chomp.should == "sferik pengwynn"
1118
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
1347
1119
  end
1348
1120
  end
1349
1121
  context "--sort=tweets" do
@@ -1352,7 +1124,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1352
1124
  end
1353
1125
  it "should sort by number of Tweets" do
1354
1126
  @cli.followings
1355
- $stdout.string.chomp.should == "pengwynn sferik"
1127
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
1356
1128
  end
1357
1129
  end
1358
1130
  context "--sort=tweeted" do
@@ -1361,7 +1133,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1361
1133
  end
1362
1134
  it "should sort by the time of the last Tweet" do
1363
1135
  @cli.followings
1364
- $stdout.string.chomp.should == "pengwynn sferik"
1136
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
1365
1137
  end
1366
1138
  end
1367
1139
  context "--unsorted" do
@@ -1370,65 +1142,45 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1370
1142
  end
1371
1143
  it "should not be sorted" do
1372
1144
  @cli.followings
1373
- $stdout.string.chomp.should == "pengwynn sferik"
1145
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
1374
1146
  end
1375
1147
  end
1376
1148
  context "with a user passed" do
1377
1149
  before do
1378
- stub_get("/1.1/friends/ids.json").
1379
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
1380
- to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1150
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1381
1151
  end
1382
1152
  it "should request the correct resource" do
1383
1153
  @cli.followings("sferik")
1384
- a_get("/1.1/friends/ids.json").
1385
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
1386
- should have_been_made
1387
- a_post("/1.1/users/lookup.json").
1388
- with(:body => {:user_id => "7505382"}).
1389
- should have_been_made
1154
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
1155
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"})).to have_been_made
1390
1156
  end
1391
1157
  end
1392
1158
  context "--id" do
1393
1159
  before do
1394
1160
  @cli.options = @cli.options.merge("id" => true)
1395
- stub_get("/1.1/friends/ids.json").
1396
- with(:query => {:cursor => "-1", :user_id => "7505382"}).
1397
- to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1161
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1398
1162
  end
1399
1163
  it "should request the correct resource" do
1400
1164
  @cli.followings("7505382")
1401
- a_get("/1.1/friends/ids.json").
1402
- with(:query => {:cursor => "-1", :user_id => "7505382"}).
1403
- should have_been_made
1404
- a_post("/1.1/users/lookup.json").
1405
- with(:body => {:user_id => "7505382"}).
1406
- should have_been_made
1165
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
1166
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"})).to have_been_made
1407
1167
  end
1408
1168
  end
1409
1169
  end
1410
1170
 
1411
1171
  describe "#followers" do
1412
1172
  before do
1413
- stub_get("/1.1/followers/ids.json").
1414
- with(:query => {:cursor => "-1"}).
1415
- to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1416
- stub_post("/1.1/users/lookup.json").
1417
- with(:body => {:user_id => "7505382"}).
1418
- to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1173
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1174
+ stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1419
1175
  end
1420
1176
  it "should request the correct resource" do
1421
1177
  @cli.followers
1422
- a_get("/1.1/followers/ids.json").
1423
- with(:query => {:cursor => "-1"}).
1424
- should have_been_made
1425
- a_post("/1.1/users/lookup.json").
1426
- with(:body => {:user_id => "7505382"}).
1427
- should have_been_made
1178
+ expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
1179
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"})).to have_been_made
1428
1180
  end
1429
1181
  it "should have the correct output" do
1430
1182
  @cli.followers
1431
- $stdout.string.chomp.should == "pengwynn sferik"
1183
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
1432
1184
  end
1433
1185
  context "--csv" do
1434
1186
  before do
@@ -1436,7 +1188,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1436
1188
  end
1437
1189
  it "should output in CSV format" do
1438
1190
  @cli.followers
1439
- $stdout.string.should == <<-eos
1191
+ expect($stdout.string).to eq <<-eos
1440
1192
  ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
1441
1193
  14100886,2008-03-08 16:34:22 +0000,2012-07-07 20:33:19 +0000,6940,192,358,3427,5457,pengwynn,Wynn Netherland ⚡
1442
1194
  7505382,2007-07-16 12:59:01 +0000,2012-07-08 18:29:20 +0000,7890,3755,118,212,2262,sferik,Erik Michaels-Ober
@@ -1449,7 +1201,7 @@ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name
1449
1201
  end
1450
1202
  it "should output in long format" do
1451
1203
  @cli.followers
1452
- $stdout.string.should == <<-eos
1204
+ expect($stdout.string).to eq <<-eos
1453
1205
  ID Since Last tweeted at Tweets Favorites Listed Following...
1454
1206
  14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
1455
1207
  7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
@@ -1462,7 +1214,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1462
1214
  end
1463
1215
  it "should reverse the order of the sort" do
1464
1216
  @cli.followers
1465
- $stdout.string.chomp.should == "sferik pengwynn"
1217
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
1466
1218
  end
1467
1219
  end
1468
1220
  context "--sort=favorites" do
@@ -1471,7 +1223,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1471
1223
  end
1472
1224
  it "should sort by number of favorites" do
1473
1225
  @cli.followers
1474
- $stdout.string.chomp.should == "pengwynn sferik"
1226
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
1475
1227
  end
1476
1228
  end
1477
1229
  context "--sort=followers" do
@@ -1480,7 +1232,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1480
1232
  end
1481
1233
  it "should sort by number of followers" do
1482
1234
  @cli.followers
1483
- $stdout.string.chomp.should == "sferik pengwynn"
1235
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
1484
1236
  end
1485
1237
  end
1486
1238
  context "--sort=friends" do
@@ -1489,7 +1241,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1489
1241
  end
1490
1242
  it "should sort by number of friends" do
1491
1243
  @cli.followers
1492
- $stdout.string.chomp.should == "sferik pengwynn"
1244
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
1493
1245
  end
1494
1246
  end
1495
1247
  context "--sort=listed" do
@@ -1498,7 +1250,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1498
1250
  end
1499
1251
  it "should sort by number of list memberships" do
1500
1252
  @cli.followers
1501
- $stdout.string.chomp.should == "sferik pengwynn"
1253
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
1502
1254
  end
1503
1255
  end
1504
1256
  context "--sort=since" do
@@ -1507,7 +1259,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1507
1259
  end
1508
1260
  it "should sort by the time when Twitter acount was created" do
1509
1261
  @cli.followers
1510
- $stdout.string.chomp.should == "sferik pengwynn"
1262
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
1511
1263
  end
1512
1264
  end
1513
1265
  context "--sort=tweets" do
@@ -1516,7 +1268,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1516
1268
  end
1517
1269
  it "should sort by number of Tweets" do
1518
1270
  @cli.followers
1519
- $stdout.string.chomp.should == "pengwynn sferik"
1271
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
1520
1272
  end
1521
1273
  end
1522
1274
  context "--sort=tweeted" do
@@ -1525,7 +1277,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1525
1277
  end
1526
1278
  it "should sort by the time of the last Tweet" do
1527
1279
  @cli.followers
1528
- $stdout.string.chomp.should == "pengwynn sferik"
1280
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
1529
1281
  end
1530
1282
  end
1531
1283
  context "--unsorted" do
@@ -1534,42 +1286,28 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1534
1286
  end
1535
1287
  it "should not be sorted" do
1536
1288
  @cli.followers
1537
- $stdout.string.chomp.should == "pengwynn sferik"
1289
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
1538
1290
  end
1539
1291
  end
1540
1292
  context "with a user passed" do
1541
1293
  before do
1542
- stub_get("/1.1/followers/ids.json").
1543
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
1544
- to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1545
- stub_post("/1.1/users/lookup.json").
1546
- with(:body => {:user_id => "213747670,428004849"}).
1547
- to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1294
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1295
+ stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "213747670,428004849"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1548
1296
  end
1549
1297
  it "should request the correct resource" do
1550
1298
  @cli.followers("sferik")
1551
- a_get("/1.1/followers/ids.json").
1552
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
1553
- should have_been_made
1554
- a_post("/1.1/users/lookup.json").
1555
- with(:body => {:user_id => "7505382"}).
1556
- should have_been_made
1299
+ expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
1300
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"})).to have_been_made
1557
1301
  end
1558
1302
  context "--id" do
1559
1303
  before do
1560
1304
  @cli.options = @cli.options.merge("id" => true)
1561
- stub_get("/1.1/followers/ids.json").
1562
- with(:query => {:cursor => "-1", :user_id => "7505382"}).
1563
- to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1305
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1564
1306
  end
1565
1307
  it "should request the correct resource" do
1566
1308
  @cli.followers("7505382")
1567
- a_get("/1.1/followers/ids.json").
1568
- with(:query => {:cursor => "-1", :user_id => "7505382"}).
1569
- should have_been_made
1570
- a_post("/1.1/users/lookup.json").
1571
- with(:body => {:user_id => "7505382"}).
1572
- should have_been_made
1309
+ expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
1310
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"})).to have_been_made
1573
1311
  end
1574
1312
  end
1575
1313
  end
@@ -1577,31 +1315,19 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1577
1315
 
1578
1316
  describe "#friends" do
1579
1317
  before do
1580
- stub_get("/1.1/friends/ids.json").
1581
- with(:query => {:cursor => "-1"}).
1582
- to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1583
- stub_get("/1.1/followers/ids.json").
1584
- with(:query => {:cursor => "-1"}).
1585
- to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1586
- stub_post("/1.1/users/lookup.json").
1587
- with(:body => {:user_id => "7505382"}).
1588
- to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1318
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1319
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1320
+ stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1589
1321
  end
1590
1322
  it "should request the correct resource" do
1591
1323
  @cli.friends
1592
- a_get("/1.1/friends/ids.json").
1593
- with(:query => {:cursor => "-1"}).
1594
- should have_been_made
1595
- a_get("/1.1/followers/ids.json").
1596
- with(:query => {:cursor => "-1"}).
1597
- should have_been_made
1598
- a_post("/1.1/users/lookup.json").
1599
- with(:body => {:user_id => "7505382"}).
1600
- should have_been_made
1324
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
1325
+ expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
1326
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"})).to have_been_made
1601
1327
  end
1602
1328
  it "should have the correct output" do
1603
1329
  @cli.friends
1604
- $stdout.string.chomp.should == "pengwynn sferik"
1330
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
1605
1331
  end
1606
1332
  context "--csv" do
1607
1333
  before do
@@ -1609,7 +1335,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1609
1335
  end
1610
1336
  it "should output in CSV format" do
1611
1337
  @cli.friends
1612
- $stdout.string.should == <<-eos
1338
+ expect($stdout.string).to eq <<-eos
1613
1339
  ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
1614
1340
  14100886,2008-03-08 16:34:22 +0000,2012-07-07 20:33:19 +0000,6940,192,358,3427,5457,pengwynn,Wynn Netherland ⚡
1615
1341
  7505382,2007-07-16 12:59:01 +0000,2012-07-08 18:29:20 +0000,7890,3755,118,212,2262,sferik,Erik Michaels-Ober
@@ -1622,7 +1348,7 @@ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name
1622
1348
  end
1623
1349
  it "should output in long format" do
1624
1350
  @cli.friends
1625
- $stdout.string.should == <<-eos
1351
+ expect($stdout.string).to eq <<-eos
1626
1352
  ID Since Last tweeted at Tweets Favorites Listed Following...
1627
1353
  14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
1628
1354
  7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
@@ -1635,7 +1361,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1635
1361
  end
1636
1362
  it "should reverse the order of the sort" do
1637
1363
  @cli.friends
1638
- $stdout.string.chomp.should == "sferik pengwynn"
1364
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
1639
1365
  end
1640
1366
  end
1641
1367
  context "--sort=favorites" do
@@ -1644,7 +1370,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1644
1370
  end
1645
1371
  it "should sort by number of favorites" do
1646
1372
  @cli.friends
1647
- $stdout.string.chomp.should == "pengwynn sferik"
1373
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
1648
1374
  end
1649
1375
  end
1650
1376
  context "--sort=followers" do
@@ -1653,7 +1379,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1653
1379
  end
1654
1380
  it "should sort by number of followers" do
1655
1381
  @cli.friends
1656
- $stdout.string.chomp.should == "sferik pengwynn"
1382
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
1657
1383
  end
1658
1384
  end
1659
1385
  context "--sort=friends" do
@@ -1662,7 +1388,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1662
1388
  end
1663
1389
  it "should sort by number of friends" do
1664
1390
  @cli.friends
1665
- $stdout.string.chomp.should == "sferik pengwynn"
1391
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
1666
1392
  end
1667
1393
  end
1668
1394
  context "--sort=listed" do
@@ -1671,7 +1397,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1671
1397
  end
1672
1398
  it "should sort by number of list memberships" do
1673
1399
  @cli.friends
1674
- $stdout.string.chomp.should == "sferik pengwynn"
1400
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
1675
1401
  end
1676
1402
  end
1677
1403
  context "--sort=since" do
@@ -1680,7 +1406,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1680
1406
  end
1681
1407
  it "should sort by the time when Twitter acount was created" do
1682
1408
  @cli.friends
1683
- $stdout.string.chomp.should == "sferik pengwynn"
1409
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
1684
1410
  end
1685
1411
  end
1686
1412
  context "--sort=tweets" do
@@ -1689,7 +1415,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1689
1415
  end
1690
1416
  it "should sort by number of Tweets" do
1691
1417
  @cli.friends
1692
- $stdout.string.chomp.should == "pengwynn sferik"
1418
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
1693
1419
  end
1694
1420
  end
1695
1421
  context "--sort=tweeted" do
@@ -1698,7 +1424,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1698
1424
  end
1699
1425
  it "should sort by the time of the last Tweet" do
1700
1426
  @cli.friends
1701
- $stdout.string.chomp.should == "pengwynn sferik"
1427
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
1702
1428
  end
1703
1429
  end
1704
1430
  context "--unsorted" do
@@ -1707,51 +1433,31 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1707
1433
  end
1708
1434
  it "should not be sorted" do
1709
1435
  @cli.friends
1710
- $stdout.string.chomp.should == "pengwynn sferik"
1436
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
1711
1437
  end
1712
1438
  end
1713
1439
  context "with a user passed" do
1714
1440
  before do
1715
- stub_get("/1.1/friends/ids.json").
1716
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
1717
- to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1718
- stub_get("/1.1/followers/ids.json").
1719
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
1720
- to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1441
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1442
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1721
1443
  end
1722
1444
  it "should request the correct resource" do
1723
1445
  @cli.friends("sferik")
1724
- a_get("/1.1/friends/ids.json").
1725
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
1726
- should have_been_made
1727
- a_get("/1.1/followers/ids.json").
1728
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
1729
- should have_been_made
1730
- a_post("/1.1/users/lookup.json").
1731
- with(:body => {:user_id => "7505382"}).
1732
- should have_been_made
1446
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
1447
+ expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
1448
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"})).to have_been_made
1733
1449
  end
1734
1450
  context "--id" do
1735
1451
  before do
1736
1452
  @cli.options = @cli.options.merge("id" => true)
1737
- stub_get("/1.1/friends/ids.json").
1738
- with(:query => {:cursor => "-1", :user_id => "7505382"}).
1739
- to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1740
- stub_get("/1.1/followers/ids.json").
1741
- with(:query => {:cursor => "-1", :user_id => "7505382"}).
1742
- to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1453
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1454
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1743
1455
  end
1744
1456
  it "should request the correct resource" do
1745
1457
  @cli.friends("7505382")
1746
- a_get("/1.1/friends/ids.json").
1747
- with(:query => {:cursor => "-1", :user_id => "7505382"}).
1748
- should have_been_made
1749
- a_get("/1.1/followers/ids.json").
1750
- with(:query => {:cursor => "-1", :user_id => "7505382"}).
1751
- should have_been_made
1752
- a_post("/1.1/users/lookup.json").
1753
- with(:body => {:user_id => "7505382"}).
1754
- should have_been_made
1458
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
1459
+ expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
1460
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"})).to have_been_made
1755
1461
  end
1756
1462
  end
1757
1463
  end
@@ -1759,31 +1465,19 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1759
1465
 
1760
1466
  describe "#leaders" do
1761
1467
  before do
1762
- stub_get("/1.1/friends/ids.json").
1763
- with(:query => {:cursor => "-1"}).
1764
- to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1765
- stub_get("/1.1/followers/ids.json").
1766
- with(:query => {:cursor => "-1"}).
1767
- to_return(:body => fixture("followers_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1768
- stub_post("/1.1/users/lookup.json").
1769
- with(:body => {:user_id => "7505382"}).
1770
- to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1468
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1469
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("followers_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1470
+ stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1771
1471
  end
1772
1472
  it "should request the correct resource" do
1773
1473
  @cli.leaders
1774
- a_get("/1.1/friends/ids.json").
1775
- with(:query => {:cursor => "-1"}).
1776
- should have_been_made
1777
- a_get("/1.1/followers/ids.json").
1778
- with(:query => {:cursor => "-1"}).
1779
- should have_been_made
1780
- a_post("/1.1/users/lookup.json").
1781
- with(:body => {:user_id => "7505382"}).
1782
- should have_been_made
1474
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
1475
+ expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
1476
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"})).to have_been_made
1783
1477
  end
1784
1478
  it "should have the correct output" do
1785
1479
  @cli.leaders
1786
- $stdout.string.chomp.should == "pengwynn sferik"
1480
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
1787
1481
  end
1788
1482
  context "--csv" do
1789
1483
  before do
@@ -1791,7 +1485,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1791
1485
  end
1792
1486
  it "should output in CSV format" do
1793
1487
  @cli.leaders
1794
- $stdout.string.should == <<-eos
1488
+ expect($stdout.string).to eq <<-eos
1795
1489
  ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
1796
1490
  14100886,2008-03-08 16:34:22 +0000,2012-07-07 20:33:19 +0000,6940,192,358,3427,5457,pengwynn,Wynn Netherland ⚡
1797
1491
  7505382,2007-07-16 12:59:01 +0000,2012-07-08 18:29:20 +0000,7890,3755,118,212,2262,sferik,Erik Michaels-Ober
@@ -1804,7 +1498,7 @@ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name
1804
1498
  end
1805
1499
  it "should output in long format" do
1806
1500
  @cli.leaders
1807
- $stdout.string.should == <<-eos
1501
+ expect($stdout.string).to eq <<-eos
1808
1502
  ID Since Last tweeted at Tweets Favorites Listed Following...
1809
1503
  14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
1810
1504
  7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
@@ -1817,7 +1511,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1817
1511
  end
1818
1512
  it "should reverse the order of the sort" do
1819
1513
  @cli.leaders
1820
- $stdout.string.chomp.should == "sferik pengwynn"
1514
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
1821
1515
  end
1822
1516
  end
1823
1517
  context "--sort=favorites" do
@@ -1826,7 +1520,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1826
1520
  end
1827
1521
  it "should sort by number of favorites" do
1828
1522
  @cli.leaders
1829
- $stdout.string.chomp.should == "pengwynn sferik"
1523
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
1830
1524
  end
1831
1525
  end
1832
1526
  context "--sort=followers" do
@@ -1835,7 +1529,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1835
1529
  end
1836
1530
  it "should sort by number of followers" do
1837
1531
  @cli.leaders
1838
- $stdout.string.chomp.should == "sferik pengwynn"
1532
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
1839
1533
  end
1840
1534
  end
1841
1535
  context "--sort=friends" do
@@ -1844,7 +1538,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1844
1538
  end
1845
1539
  it "should sort by number of friends" do
1846
1540
  @cli.leaders
1847
- $stdout.string.chomp.should == "sferik pengwynn"
1541
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
1848
1542
  end
1849
1543
  end
1850
1544
  context "--sort=listed" do
@@ -1853,7 +1547,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1853
1547
  end
1854
1548
  it "should sort by number of list memberships" do
1855
1549
  @cli.leaders
1856
- $stdout.string.chomp.should == "sferik pengwynn"
1550
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
1857
1551
  end
1858
1552
  end
1859
1553
  context "--sort=since" do
@@ -1862,7 +1556,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1862
1556
  end
1863
1557
  it "should sort by the time when Twitter acount was created" do
1864
1558
  @cli.leaders
1865
- $stdout.string.chomp.should == "sferik pengwynn"
1559
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
1866
1560
  end
1867
1561
  end
1868
1562
  context "--sort=tweets" do
@@ -1871,7 +1565,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1871
1565
  end
1872
1566
  it "should sort by number of Tweets" do
1873
1567
  @cli.leaders
1874
- $stdout.string.chomp.should == "pengwynn sferik"
1568
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
1875
1569
  end
1876
1570
  end
1877
1571
  context "--sort=tweeted" do
@@ -1880,7 +1574,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1880
1574
  end
1881
1575
  it "should sort by the time of the last Tweet" do
1882
1576
  @cli.leaders
1883
- $stdout.string.chomp.should == "pengwynn sferik"
1577
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
1884
1578
  end
1885
1579
  end
1886
1580
  context "--unsorted" do
@@ -1889,51 +1583,31 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1889
1583
  end
1890
1584
  it "should not be sorted" do
1891
1585
  @cli.leaders
1892
- $stdout.string.chomp.should == "pengwynn sferik"
1586
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
1893
1587
  end
1894
1588
  end
1895
1589
  context "with a user passed" do
1896
1590
  before do
1897
- stub_get("/1.1/friends/ids.json").
1898
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
1899
- to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1900
- stub_get("/1.1/followers/ids.json").
1901
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
1902
- to_return(:body => fixture("followers_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1591
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1592
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("followers_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1903
1593
  end
1904
1594
  it "should request the correct resource" do
1905
1595
  @cli.leaders("sferik")
1906
- a_get("/1.1/friends/ids.json").
1907
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
1908
- should have_been_made
1909
- a_get("/1.1/followers/ids.json").
1910
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
1911
- should have_been_made
1912
- a_post("/1.1/users/lookup.json").
1913
- with(:body => {:user_id => "7505382"}).
1914
- should have_been_made
1596
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
1597
+ expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
1598
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"})).to have_been_made
1915
1599
  end
1916
1600
  context "--id" do
1917
1601
  before do
1918
1602
  @cli.options = @cli.options.merge("id" => true)
1919
- stub_get("/1.1/friends/ids.json").
1920
- with(:query => {:cursor => "-1", :user_id => "7505382"}).
1921
- to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1922
- stub_get("/1.1/followers/ids.json").
1923
- with(:query => {:cursor => "-1", :user_id => "7505382"}).
1924
- to_return(:body => fixture("followers_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1603
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1604
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("followers_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1925
1605
  end
1926
1606
  it "should request the correct resource" do
1927
1607
  @cli.leaders("7505382")
1928
- a_get("/1.1/friends/ids.json").
1929
- with(:query => {:cursor => "-1", :user_id => "7505382"}).
1930
- should have_been_made
1931
- a_get("/1.1/followers/ids.json").
1932
- with(:query => {:cursor => "-1", :user_id => "7505382"}).
1933
- should have_been_made
1934
- a_post("/1.1/users/lookup.json").
1935
- with(:body => {:user_id => "7505382"}).
1936
- should have_been_made
1608
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
1609
+ expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
1610
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"})).to have_been_made
1937
1611
  end
1938
1612
  end
1939
1613
  end
@@ -1941,17 +1615,15 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1941
1615
 
1942
1616
  describe "#lists" do
1943
1617
  before do
1944
- stub_get("/1.1/lists/list.json").
1945
- to_return(:body => fixture("lists.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1618
+ stub_get("/1.1/lists/list.json").to_return(:body => fixture("lists.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1946
1619
  end
1947
1620
  it "should request the correct resource" do
1948
1621
  @cli.lists
1949
- a_get("/1.1/lists/list.json").
1950
- should have_been_made
1622
+ expect(a_get("/1.1/lists/list.json")).to have_been_made
1951
1623
  end
1952
1624
  it "should have the correct output" do
1953
1625
  @cli.lists
1954
- $stdout.string.chomp.should == "@pengwynn/rubyists @twitter/team @sferik/test"
1626
+ expect($stdout.string.chomp).to eq "@pengwynn/rubyists @twitter/team @sferik/test"
1955
1627
  end
1956
1628
  context "--csv" do
1957
1629
  before do
@@ -1959,7 +1631,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1959
1631
  end
1960
1632
  it "should output in CSV format" do
1961
1633
  @cli.lists
1962
- $stdout.string.should == <<-eos
1634
+ expect($stdout.string).to eq <<-eos
1963
1635
  ID,Created at,Screen name,Slug,Members,Subscribers,Mode,Description
1964
1636
  1129440,2009-10-30 14:39:25 +0000,pengwynn,rubyists,499,39,public,""
1965
1637
  574,2009-09-23 01:18:01 +0000,twitter,team,1199,78078,public,""
@@ -1973,7 +1645,7 @@ ID,Created at,Screen name,Slug,Members,Subscribers,Mode,Description
1973
1645
  end
1974
1646
  it "should output in long format" do
1975
1647
  @cli.lists
1976
- $stdout.string.should == <<-eos
1648
+ expect($stdout.string).to eq <<-eos
1977
1649
  ID Created at Screen name Slug Members Subscribers Mode ...
1978
1650
  1129440 Oct 30 2009 @pengwynn rubyists 499 39 public
1979
1651
  574 Sep 22 2009 @twitter team 1199 78078 public
@@ -1987,7 +1659,7 @@ ID Created at Screen name Slug Members Subscribers Mode ...
1987
1659
  end
1988
1660
  it "should reverse the order of the sort" do
1989
1661
  @cli.lists
1990
- $stdout.string.chomp.should == "@sferik/test @twitter/team @pengwynn/rubyists"
1662
+ expect($stdout.string.chomp).to eq "@sferik/test @twitter/team @pengwynn/rubyists"
1991
1663
  end
1992
1664
  end
1993
1665
  context "--sort=members" do
@@ -1996,7 +1668,7 @@ ID Created at Screen name Slug Members Subscribers Mode ...
1996
1668
  end
1997
1669
  it "should sort by the time when Twitter acount was created" do
1998
1670
  @cli.lists
1999
- $stdout.string.chomp.should == "@sferik/test @pengwynn/rubyists @twitter/team"
1671
+ expect($stdout.string.chomp).to eq "@sferik/test @pengwynn/rubyists @twitter/team"
2000
1672
  end
2001
1673
  end
2002
1674
  context "--sort=mode" do
@@ -2005,7 +1677,7 @@ ID Created at Screen name Slug Members Subscribers Mode ...
2005
1677
  end
2006
1678
  it "should sort by the time when Twitter acount was created" do
2007
1679
  @cli.lists
2008
- $stdout.string.chomp.should == "@sferik/test @twitter/team @pengwynn/rubyists"
1680
+ expect($stdout.string.chomp).to eq "@sferik/test @twitter/team @pengwynn/rubyists"
2009
1681
  end
2010
1682
  end
2011
1683
  context "--sort=posted" do
@@ -2014,7 +1686,7 @@ ID Created at Screen name Slug Members Subscribers Mode ...
2014
1686
  end
2015
1687
  it "should sort by the time when Twitter acount was created" do
2016
1688
  @cli.lists
2017
- $stdout.string.chomp.should == "@twitter/team @pengwynn/rubyists @sferik/test"
1689
+ expect($stdout.string.chomp).to eq "@twitter/team @pengwynn/rubyists @sferik/test"
2018
1690
  end
2019
1691
  end
2020
1692
  context "--sort=subscribers" do
@@ -2023,7 +1695,7 @@ ID Created at Screen name Slug Members Subscribers Mode ...
2023
1695
  end
2024
1696
  it "should sort by the time when Twitter acount was created" do
2025
1697
  @cli.lists
2026
- $stdout.string.chomp.should == "@sferik/test @pengwynn/rubyists @twitter/team"
1698
+ expect($stdout.string.chomp).to eq "@sferik/test @pengwynn/rubyists @twitter/team"
2027
1699
  end
2028
1700
  end
2029
1701
  context "--unsorted" do
@@ -2032,33 +1704,25 @@ ID Created at Screen name Slug Members Subscribers Mode ...
2032
1704
  end
2033
1705
  it "should not be sorted" do
2034
1706
  @cli.lists
2035
- $stdout.string.chomp.should == "@pengwynn/rubyists @twitter/team @sferik/test"
1707
+ expect($stdout.string.chomp).to eq "@pengwynn/rubyists @twitter/team @sferik/test"
2036
1708
  end
2037
1709
  end
2038
1710
  context "with a user passed" do
2039
1711
  before do
2040
- stub_get("/1.1/lists/list.json").
2041
- with(:query => {:screen_name => "sferik"}).
2042
- to_return(:body => fixture("lists.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1712
+ stub_get("/1.1/lists/list.json").with(:query => {:screen_name => "sferik"}).to_return(:body => fixture("lists.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2043
1713
  end
2044
1714
  it "should request the correct resource" do
2045
1715
  @cli.lists("sferik")
2046
- a_get("/1.1/lists/list.json").
2047
- with(:query => {:screen_name => "sferik"}).
2048
- should have_been_made
1716
+ expect(a_get("/1.1/lists/list.json").with(:query => {:screen_name => "sferik"})).to have_been_made
2049
1717
  end
2050
1718
  context "--id" do
2051
1719
  before do
2052
1720
  @cli.options = @cli.options.merge("id" => true)
2053
- stub_get("/1.1/lists/list.json").
2054
- with(:query => {:user_id => "7505382"}).
2055
- to_return(:body => fixture("lists.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1721
+ stub_get("/1.1/lists/list.json").with(:query => {:user_id => "7505382"}).to_return(:body => fixture("lists.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2056
1722
  end
2057
1723
  it "should request the correct resource" do
2058
1724
  @cli.lists("7505382")
2059
- a_get("/1.1/lists/list.json").
2060
- with(:query => {:user_id => "7505382"}).
2061
- should have_been_made
1725
+ expect(a_get("/1.1/lists/list.json").with(:query => {:user_id => "7505382"})).to have_been_made
2062
1726
  end
2063
1727
  end
2064
1728
  end
@@ -2066,19 +1730,15 @@ ID Created at Screen name Slug Members Subscribers Mode ...
2066
1730
 
2067
1731
  describe "#mentions" do
2068
1732
  before do
2069
- stub_get("/1.1/statuses/mentions_timeline.json").
2070
- with(:query => {:count => "20"}).
2071
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1733
+ stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "20"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2072
1734
  end
2073
1735
  it "should request the correct resource" do
2074
1736
  @cli.mentions
2075
- a_get("/1.1/statuses/mentions_timeline.json").
2076
- with(:query => {:count => "20"}).
2077
- should have_been_made
1737
+ expect(a_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "20"})).to have_been_made
2078
1738
  end
2079
1739
  it "should have the correct output" do
2080
1740
  @cli.mentions
2081
- $stdout.string.should == <<-eos
1741
+ expect($stdout.string).to eq <<-eos
2082
1742
  \e[1m\e[33m @mutgoff\e[0m
2083
1743
  Happy Birthday @imdane. Watch out for those @rally pranksters!
2084
1744
 
@@ -2162,7 +1822,7 @@ ID Created at Screen name Slug Members Subscribers Mode ...
2162
1822
  end
2163
1823
  it "should output in CSV format" do
2164
1824
  @cli.mentions
2165
- $stdout.string.should == <<-eos
1825
+ expect($stdout.string).to eq <<-eos
2166
1826
  ID,Posted at,Screen name,Text
2167
1827
  244111636544225280,2012-09-07 16:35:24 +0000,mutgoff,Happy Birthday @imdane. Watch out for those @rally pranksters!
2168
1828
  244111183165157376,2012-09-07 16:33:36 +0000,ironicsans,"If you like good real-life stories, check out @NarrativelyNY's just-launched site http://t.co/wiUL07jE (and also visit http://t.co/ZoyQxqWA)"
@@ -2193,7 +1853,7 @@ ID,Posted at,Screen name,Text
2193
1853
  end
2194
1854
  it "should output in long format" do
2195
1855
  @cli.mentions
2196
- $stdout.string.should == <<-eos
1856
+ expect($stdout.string).to eq <<-eos
2197
1857
  ID Posted at Screen name Text
2198
1858
  244111636544225280 Sep 7 08:35 @mutgoff Happy Birthday @imdane. W...
2199
1859
  244111183165157376 Sep 7 08:33 @ironicsans If you like good real-lif...
@@ -2223,7 +1883,7 @@ ID Posted at Screen name Text
2223
1883
  end
2224
1884
  it "should reverse the order of the sort" do
2225
1885
  @cli.mentions
2226
- $stdout.string.should == <<-eos
1886
+ expect($stdout.string).to eq <<-eos
2227
1887
  ID Posted at Screen name Text
2228
1888
  244099460672679938 Sep 7 07:47 @dwiskus Gentlemen, you can't figh...
2229
1889
  244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did y...
@@ -2251,41 +1911,25 @@ ID Posted at Screen name Text
2251
1911
  end
2252
1912
  context "--number" do
2253
1913
  before do
2254
- stub_get("/1.1/statuses/mentions_timeline.json").
2255
- with(:query => {:count => "1"}).
2256
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2257
- stub_get("/1.1/statuses/mentions_timeline.json").
2258
- with(:query => {:count => "200"}).
2259
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2260
- stub_get("/1.1/statuses/mentions_timeline.json").
2261
- with(:query => {:count => "200", :max_id => "244099460672679937"}).
2262
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1914
+ stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "1"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1915
+ 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"})
1916
+ stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "200", :max_id => "244099460672679937"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2263
1917
  (5..185).step(20).to_a.reverse.each do |count|
2264
- stub_get("/1.1/statuses/mentions_timeline.json").
2265
- with(:query => {:count => count, :max_id => "244099460672679937"}).
2266
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1918
+ stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => count, :max_id => "244099460672679937"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2267
1919
  end
2268
1920
  end
2269
1921
  it "should limit the number of results to 1" do
2270
1922
  @cli.options = @cli.options.merge("number" => 1)
2271
1923
  @cli.mentions
2272
- a_get("/1.1/statuses/mentions_timeline.json").
2273
- with(:query => {:count => "1"}).
2274
- should have_been_made
1924
+ expect(a_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "1"})).to have_been_made
2275
1925
  end
2276
1926
  it "should limit the number of results to 345" do
2277
1927
  @cli.options = @cli.options.merge("number" => 345)
2278
1928
  @cli.mentions
2279
- a_get("/1.1/statuses/mentions_timeline.json").
2280
- with(:query => {:count => "200"}).
2281
- should have_been_made
2282
- a_get("/1.1/statuses/mentions_timeline.json").
2283
- with(:query => {:count => "200", :max_id => "244099460672679937"}).
2284
- should have_been_made.times(7)
1929
+ expect(a_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "200"})).to have_been_made
1930
+ expect(a_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "200", :max_id => "244099460672679937"})).to have_been_made.times(7)
2285
1931
  (5..185).step(20).to_a.reverse.each do |count|
2286
- a_get("/1.1/statuses/mentions_timeline.json").
2287
- with(:query => {:count => count, :max_id => "244099460672679937"}).
2288
- should have_been_made
1932
+ expect(a_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => count, :max_id => "244099460672679937"})).to have_been_made
2289
1933
  end
2290
1934
  end
2291
1935
  end
@@ -2296,41 +1940,33 @@ ID Posted at Screen name Text
2296
1940
  @cli.options = @cli.options.merge("display-url" => true)
2297
1941
  end
2298
1942
  it "should have the correct output" do
2299
- lambda do
1943
+ expect do
2300
1944
  @cli.open("sferik")
2301
- end.should_not raise_error
1945
+ end.not_to raise_error
2302
1946
  end
2303
1947
  context "--id" do
2304
1948
  before do
2305
1949
  @cli.options = @cli.options.merge("id" => true)
2306
- stub_get("/1.1/users/show.json").
2307
- with(:query => {:user_id => "420"}).
2308
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1950
+ stub_get("/1.1/users/show.json").with(:query => {:user_id => "420"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2309
1951
  end
2310
1952
  it "should request the correct resource" do
2311
1953
  @cli.open("420")
2312
- a_get("/1.1/users/show.json").
2313
- with(:query => {:user_id => "420"}).
2314
- should have_been_made
1954
+ expect(a_get("/1.1/users/show.json").with(:query => {:user_id => "420"})).to have_been_made
2315
1955
  end
2316
1956
  end
2317
1957
  context "--status" do
2318
1958
  before do
2319
1959
  @cli.options = @cli.options.merge("status" => true)
2320
- stub_get("/1.1/statuses/show/55709764298092545.json").
2321
- with(:query => {:include_my_retweet => "false"}).
2322
- to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1960
+ stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2323
1961
  end
2324
1962
  it "should request the correct resource" do
2325
1963
  @cli.open("55709764298092545")
2326
- a_get("/1.1/statuses/show/55709764298092545.json").
2327
- with(:query => {:include_my_retweet => "false"}).
2328
- should have_been_made
1964
+ expect(a_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"})).to have_been_made
2329
1965
  end
2330
1966
  it "should have the correct output" do
2331
- lambda do
1967
+ expect do
2332
1968
  @cli.open("55709764298092545")
2333
- end.should_not raise_error
1969
+ end.not_to raise_error
2334
1970
  end
2335
1971
  end
2336
1972
  end
@@ -2338,33 +1974,21 @@ ID Posted at Screen name Text
2338
1974
  describe "#reply" do
2339
1975
  before do
2340
1976
  @cli.options = @cli.options.merge("profile" => fixture_path + "/.trc", "location" => true)
2341
- stub_get("/1.1/statuses/show/55709764298092545.json").
2342
- with(:query => {:include_my_retweet => "false"}).
2343
- to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2344
- stub_post("/1.1/statuses/update.json").
2345
- with(:body => {:in_reply_to_status_id => "55709764298092545", :status => "@sferik Testing", :lat => "37.76969909668", :long => "-122.39330291748", :trim_user => "true"}).
2346
- to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2347
- stub_request(:get, "http://checkip.dyndns.org/").
2348
- to_return(:body => fixture("checkip.html"), :headers => {:content_type => "text/html"})
2349
- stub_request(:get, "http://www.geoplugin.net/xml.gp?ip=50.131.22.169").
2350
- to_return(:body => fixture("geoplugin.xml"), :headers => {:content_type => "application/xml"})
1977
+ stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1978
+ stub_post("/1.1/statuses/update.json").with(:body => {:in_reply_to_status_id => "55709764298092545", :status => "@sferik Testing", :lat => "37.76969909668", :long => "-122.39330291748", :trim_user => "true"}).to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1979
+ stub_request(:get, "http://checkip.dyndns.org/").to_return(:body => fixture("checkip.html"), :headers => {:content_type => "text/html"})
1980
+ stub_request(:get, "http://www.geoplugin.net/xml.gp?ip=50.131.22.169").to_return(:body => fixture("geoplugin.xml"), :headers => {:content_type => "application/xml"})
2351
1981
  end
2352
1982
  it "should request the correct resource" do
2353
1983
  @cli.reply("55709764298092545", "Testing")
2354
- a_get("/1.1/statuses/show/55709764298092545.json").
2355
- with(:query => {:include_my_retweet => "false"}).
2356
- should have_been_made
2357
- a_post("/1.1/statuses/update.json").
2358
- with(:body => {:in_reply_to_status_id => "55709764298092545", :status => "@sferik Testing", :lat => "37.76969909668", :long => "-122.39330291748", :trim_user => "true"}).
2359
- should have_been_made
2360
- a_request(:get, "http://checkip.dyndns.org/").
2361
- should have_been_made
2362
- a_request(:get, "http://www.geoplugin.net/xml.gp?ip=50.131.22.169").
2363
- should have_been_made
1984
+ expect(a_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"})).to have_been_made
1985
+ expect(a_post("/1.1/statuses/update.json").with(:body => {:in_reply_to_status_id => "55709764298092545", :status => "@sferik Testing", :lat => "37.76969909668", :long => "-122.39330291748", :trim_user => "true"})).to have_been_made
1986
+ expect(a_request(:get, "http://checkip.dyndns.org/")).to have_been_made
1987
+ expect(a_request(:get, "http://www.geoplugin.net/xml.gp?ip=50.131.22.169")).to have_been_made
2364
1988
  end
2365
1989
  it "should have the correct output" do
2366
1990
  @cli.reply("55709764298092545", "Testing")
2367
- $stdout.string.split("\n").first.should == "Reply posted by @testcli to @sferik."
1991
+ expect($stdout.string.split("\n").first).to eq "Reply posted by @testcli to @sferik."
2368
1992
  end
2369
1993
  context "--all" do
2370
1994
  before do
@@ -2372,20 +1996,14 @@ ID Posted at Screen name Text
2372
1996
  end
2373
1997
  it "should request the correct resource" do
2374
1998
  @cli.reply("55709764298092545", "Testing")
2375
- a_get("/1.1/statuses/show/55709764298092545.json").
2376
- with(:query => {:include_my_retweet => "false"}).
2377
- should have_been_made
2378
- a_post("/1.1/statuses/update.json").
2379
- with(:body => {:in_reply_to_status_id => "55709764298092545", :status => "@sferik Testing", :lat => "37.76969909668", :long => "-122.39330291748", :trim_user => "true"}).
2380
- should have_been_made
2381
- a_request(:get, "http://checkip.dyndns.org/").
2382
- should have_been_made
2383
- a_request(:get, "http://www.geoplugin.net/xml.gp?ip=50.131.22.169").
2384
- should have_been_made
1999
+ expect(a_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"})).to have_been_made
2000
+ expect(a_post("/1.1/statuses/update.json").with(:body => {:in_reply_to_status_id => "55709764298092545", :status => "@sferik Testing", :lat => "37.76969909668", :long => "-122.39330291748", :trim_user => "true"})).to have_been_made
2001
+ expect(a_request(:get, "http://checkip.dyndns.org/")).to have_been_made
2002
+ expect(a_request(:get, "http://www.geoplugin.net/xml.gp?ip=50.131.22.169")).to have_been_made
2385
2003
  end
2386
2004
  it "should have the correct output" do
2387
2005
  @cli.reply("55709764298092545", "Testing")
2388
- $stdout.string.split("\n").first.should == "Reply posted by @testcli to @sferik."
2006
+ expect($stdout.string.split("\n").first).to eq "Reply posted by @testcli to @sferik."
2389
2007
  end
2390
2008
  end
2391
2009
  end
@@ -2393,32 +2011,24 @@ ID Posted at Screen name Text
2393
2011
  describe "#report_spam" do
2394
2012
  before do
2395
2013
  @cli.options = @cli.options.merge("profile" => fixture_path + "/.trc")
2396
- stub_post("/1.1/report_spam.json").
2397
- with(:body => {:screen_name => "sferik"}).
2398
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2014
+ stub_post("/1.1/report_spam.json").with(:body => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2399
2015
  end
2400
2016
  it "should request the correct resource" do
2401
2017
  @cli.report_spam("sferik")
2402
- a_post("/1.1/report_spam.json").
2403
- with(:body => {:screen_name => "sferik"}).
2404
- should have_been_made
2018
+ expect(a_post("/1.1/report_spam.json").with(:body => {:screen_name => "sferik"})).to have_been_made
2405
2019
  end
2406
2020
  it "should have the correct output" do
2407
2021
  @cli.report_spam("sferik")
2408
- $stdout.string.should =~ /^@testcli reported 1 user/
2022
+ expect($stdout.string).to match /^@testcli reported 1 user/
2409
2023
  end
2410
2024
  context "--id" do
2411
2025
  before do
2412
2026
  @cli.options = @cli.options.merge("id" => true)
2413
- stub_post("/1.1/report_spam.json").
2414
- with(:body => {:user_id => "7505382"}).
2415
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2027
+ stub_post("/1.1/report_spam.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2416
2028
  end
2417
2029
  it "should request the correct resource" do
2418
2030
  @cli.report_spam("7505382")
2419
- a_post("/1.1/report_spam.json").
2420
- with(:body => {:user_id => "7505382"}).
2421
- should have_been_made
2031
+ expect(a_post("/1.1/report_spam.json").with(:body => {:user_id => "7505382"})).to have_been_made
2422
2032
  end
2423
2033
  end
2424
2034
  end
@@ -2426,42 +2036,32 @@ ID Posted at Screen name Text
2426
2036
  describe "#retweet" do
2427
2037
  before do
2428
2038
  @cli.options = @cli.options.merge("profile" => fixture_path + "/.trc")
2429
- stub_post("/1.1/statuses/retweet/26755176471724032.json").
2430
- to_return(:body => fixture("retweet.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2039
+ stub_post("/1.1/statuses/retweet/26755176471724032.json").to_return(:body => fixture("retweet.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2431
2040
  end
2432
2041
  it "should request the correct resource" do
2433
2042
  @cli.retweet("26755176471724032")
2434
- a_post("/1.1/statuses/retweet/26755176471724032.json").
2435
- should have_been_made
2043
+ expect(a_post("/1.1/statuses/retweet/26755176471724032.json")).to have_been_made
2436
2044
  end
2437
2045
  it "should have the correct output" do
2438
2046
  @cli.retweet("26755176471724032")
2439
- $stdout.string.should =~ /^@testcli retweeted 1 tweet.$/
2047
+ expect($stdout.string).to match /^@testcli retweeted 1 tweet.$/
2440
2048
  end
2441
2049
  end
2442
2050
 
2443
2051
  describe "#retweets" do
2444
2052
  before do
2445
- stub_get("/1.1/statuses/user_timeline.json").
2446
- with(:query => {:count => "200", :include_rts => "true"}).
2447
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2448
- stub_get("/1.1/statuses/user_timeline.json").
2449
- with(:query => {:count => "200", :include_rts => "true", :max_id => "244102729860009983"}).
2450
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2053
+ 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"})
2054
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :max_id => "244102729860009983"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2451
2055
  end
2452
2056
  context "without arguments" do
2453
2057
  it "should request the correct resource" do
2454
2058
  @cli.retweets
2455
- a_get("/1.1/statuses/user_timeline.json").
2456
- with(:query => {:count => "200", :include_rts => "true"}).
2457
- should have_been_made
2458
- a_get("/1.1/statuses/user_timeline.json").
2459
- with(:query => {:count => "200", :include_rts => "true", :max_id => "244102729860009983"}).
2460
- should have_been_made.times(3)
2059
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true"})).to have_been_made
2060
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :max_id => "244102729860009983"})).to have_been_made.times(3)
2461
2061
  end
2462
2062
  it "should have the correct output" do
2463
2063
  @cli.retweets
2464
- $stdout.string.should == <<-eos
2064
+ expect($stdout.string).to eq <<-eos
2465
2065
  \e[1m\e[33m @calebelston\e[0m
2466
2066
  RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k
2467
2067
 
@@ -2551,7 +2151,7 @@ ID Posted at Screen name Text
2551
2151
  end
2552
2152
  it "should output in CSV format" do
2553
2153
  @cli.retweets
2554
- $stdout.string.should == <<-eos
2154
+ expect($stdout.string).to eq <<-eos
2555
2155
  ID,Posted at,Screen name,Text
2556
2156
  244108728834592770,2012-09-07 16:23:50 +0000,calebelston,RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k
2557
2157
  244107823733174272,2012-09-07 16:20:15 +0000,codeforamerica,"RT @randomhacks: Going to Code Across Austin II: Y'all Come Hack Now, Sat, Sep 8 http://t.co/Sk5BM7U3 We'll see y'all there! #rhok @codeforamerica @TheaClay"
@@ -2582,7 +2182,7 @@ ID,Posted at,Screen name,Text
2582
2182
  end
2583
2183
  it "should output in long format" do
2584
2184
  @cli.retweets
2585
- $stdout.string.should == <<-eos
2185
+ expect($stdout.string).to eq <<-eos
2586
2186
  ID Posted at Screen name Text
2587
2187
  244108728834592770 Sep 7 08:23 @calebelston RT @olivercameron: Mosaic ...
2588
2188
  244107823733174272 Sep 7 08:20 @codeforamerica RT @randomhacks: Going to ...
@@ -2612,7 +2212,7 @@ ID Posted at Screen name Text
2612
2212
  end
2613
2213
  it "should reverse the order of the sort" do
2614
2214
  @cli.retweets
2615
- $stdout.string.should == <<-eos
2215
+ expect($stdout.string).to eq <<-eos
2616
2216
  ID Posted at Screen name Text
2617
2217
  244107823733174272 Sep 7 08:20 @codeforamerica RT @randomhacks: Going to ...
2618
2218
  244108728834592770 Sep 7 08:23 @calebelston RT @olivercameron: Mosaic ...
@@ -2640,67 +2240,41 @@ ID Posted at Screen name Text
2640
2240
  end
2641
2241
  context "--number" do
2642
2242
  before do
2643
- stub_get("/1.1/statuses/user_timeline.json").
2644
- with(:query => {:count => "200", :include_rts => "true"}).
2645
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2646
- stub_get("/1.1/statuses/user_timeline.json").
2647
- with(:query => {:count => "200", :include_rts => "true", :max_id => "244107823733174271"}).
2648
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2243
+ 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"})
2244
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :max_id => "244107823733174271"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2649
2245
  end
2650
2246
  it "should limit the number of results to 1" do
2651
2247
  @cli.options = @cli.options.merge("number" => 1)
2652
2248
  @cli.retweets
2653
- a_get("/1.1/statuses/user_timeline.json").
2654
- with(:query => {:count => "200", :include_rts => "true"}).
2655
- should have_been_made
2249
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true"})).to have_been_made
2656
2250
  end
2657
2251
  it "should limit the number of results to 345" do
2658
2252
  @cli.options = @cli.options.merge("number" => 345)
2659
2253
  @cli.retweets
2660
- a_get("/1.1/statuses/user_timeline.json").
2661
- with(:query => {:count => "200", :include_rts => "true"}).
2662
- should have_been_made
2663
- a_get("/1.1/statuses/user_timeline.json").
2664
- with(:query => {:count => "200", :include_rts => "true", :max_id => "244107823733174271"}).
2665
- should have_been_made
2254
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true"})).to have_been_made
2255
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :max_id => "244107823733174271"})).to have_been_made
2666
2256
  end
2667
2257
  end
2668
2258
  context "with a user passed" do
2669
2259
  before do
2670
- stub_get("/1.1/statuses/user_timeline.json").
2671
- with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik"}).
2672
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2673
- stub_get("/1.1/statuses/user_timeline.json").
2674
- with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik", :max_id => "244102729860009983"}).
2675
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2260
+ 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"})
2261
+ 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("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2676
2262
  end
2677
2263
  it "should request the correct resource" do
2678
2264
  @cli.retweets("sferik")
2679
- a_get("/1.1/statuses/user_timeline.json").
2680
- with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik"}).
2681
- should have_been_made
2682
- a_get("/1.1/statuses/user_timeline.json").
2683
- with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik", :max_id => "244102729860009983"}).
2684
- should have_been_made.times(3)
2265
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik"})).to have_been_made
2266
+ 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(3)
2685
2267
  end
2686
2268
  context "--id" do
2687
2269
  before do
2688
2270
  @cli.options = @cli.options.merge("id" => true)
2689
- stub_get("/1.1/statuses/user_timeline.json").
2690
- with(:query => {:count => "200", :include_rts => "true", :user_id => "7505382"}).
2691
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2692
- stub_get("/1.1/statuses/user_timeline.json").
2693
- with(:query => {:count => "200", :include_rts => "true", :user_id => "7505382", :max_id => "244102729860009983"}).
2694
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2271
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :user_id => "7505382"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2272
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :user_id => "7505382", :max_id => "244102729860009983"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2695
2273
  end
2696
2274
  it "should request the correct resource" do
2697
2275
  @cli.retweets("7505382")
2698
- a_get("/1.1/statuses/user_timeline.json").
2699
- with(:query => {:count => "200", :include_rts => "true", :user_id => "7505382"}).
2700
- should have_been_made
2701
- a_get("/1.1/statuses/user_timeline.json").
2702
- with(:query => {:count => "200", :include_rts => "true", :user_id => "7505382", :max_id => "244102729860009983"}).
2703
- should have_been_made.times(3)
2276
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :user_id => "7505382"})).to have_been_made
2277
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :user_id => "7505382", :max_id => "244102729860009983"})).to have_been_made.times(3)
2704
2278
  end
2705
2279
  end
2706
2280
  end
@@ -2709,8 +2283,8 @@ ID Posted at Screen name Text
2709
2283
  describe "#ruler" do
2710
2284
  it "should have the correct output" do
2711
2285
  @cli.ruler
2712
- $stdout.string.chomp.size.should == 140
2713
- $stdout.string.chomp.should == "----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|"
2286
+ expect($stdout.string.chomp.size).to eq 140
2287
+ expect($stdout.string.chomp).to eq "----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|"
2714
2288
  end
2715
2289
  context "with indentation" do
2716
2290
  before do
@@ -2718,27 +2292,23 @@ ID Posted at Screen name Text
2718
2292
  end
2719
2293
  it "should have the correct output" do
2720
2294
  @cli.ruler
2721
- $stdout.string.chomp.size.should == 142
2722
- $stdout.string.chomp.should == " ----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|"
2295
+ expect($stdout.string.chomp.size).to eq 142
2296
+ expect($stdout.string.chomp).to eq " ----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|"
2723
2297
  end
2724
2298
  end
2725
2299
  end
2726
2300
 
2727
2301
  describe "#status" do
2728
2302
  before do
2729
- stub_get("/1.1/statuses/show/55709764298092545.json").
2730
- with(:query => {:include_my_retweet => "false"}).
2731
- to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2303
+ stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2732
2304
  end
2733
2305
  it "should request the correct resource" do
2734
2306
  @cli.status("55709764298092545")
2735
- a_get("/1.1/statuses/show/55709764298092545.json").
2736
- with(:query => {:include_my_retweet => "false"}).
2737
- should have_been_made
2307
+ expect(a_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"})).to have_been_made
2738
2308
  end
2739
2309
  it "should have the correct output" do
2740
2310
  @cli.status("55709764298092545")
2741
- $stdout.string.should == <<-eos
2311
+ expect($stdout.string).to eq <<-eos
2742
2312
  ID 55709764298092545
2743
2313
  Text The problem with your code is that it's doing exactly what you told it to do.
2744
2314
  Screen name @sferik
@@ -2755,7 +2325,7 @@ URL https://twitter.com/sferik/status/55709764298092545
2755
2325
  end
2756
2326
  it "should have the correct output" do
2757
2327
  @cli.status("55709764298092545")
2758
- $stdout.string.should == <<-eos
2328
+ expect($stdout.string).to eq <<-eos
2759
2329
  ID,Text,Screen name,Posted at,Location,Retweets,Source,URL
2760
2330
  55709764298092545,The problem with your code is that it's doing exactly what you told it to do.,sferik,2011-04-06 19:13:37 +0000,"Blowfish Sushi To Die For, 2170 Bryant St, San Francisco, California, United States",320,Twitter for iPhone,https://twitter.com/sferik/status/55709764298092545
2761
2331
  eos
@@ -2763,13 +2333,11 @@ ID,Text,Screen name,Posted at,Location,Retweets,Source,URL
2763
2333
  end
2764
2334
  context "with no street address" do
2765
2335
  before do
2766
- stub_get("/1.1/statuses/show/55709764298092550.json").
2767
- with(:query => {:include_my_retweet => "false"}).
2768
- to_return(:body => fixture("status_no_street_address.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2336
+ stub_get("/1.1/statuses/show/55709764298092550.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_street_address.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2769
2337
  end
2770
2338
  it "should have the correct output" do
2771
2339
  @cli.status("55709764298092550")
2772
- $stdout.string.should == <<-eos
2340
+ expect($stdout.string).to eq <<-eos
2773
2341
  ID 55709764298092550
2774
2342
  Text The problem with your code is that it's doing exactly what you told it to do.
2775
2343
  Screen name @sferik
@@ -2783,13 +2351,11 @@ URL https://twitter.com/sferik/status/55709764298092550
2783
2351
  end
2784
2352
  context "with no locality" do
2785
2353
  before do
2786
- stub_get("/1.1/statuses/show/55709764298092549.json").
2787
- with(:query => {:include_my_retweet => "false"}).
2788
- to_return(:body => fixture("status_no_locality.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2354
+ stub_get("/1.1/statuses/show/55709764298092549.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_locality.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2789
2355
  end
2790
2356
  it "should have the correct output" do
2791
2357
  @cli.status("55709764298092549")
2792
- $stdout.string.should == <<-eos
2358
+ expect($stdout.string).to eq <<-eos
2793
2359
  ID 55709764298092549
2794
2360
  Text The problem with your code is that it's doing exactly what you told it to do.
2795
2361
  Screen name @sferik
@@ -2803,13 +2369,11 @@ URL https://twitter.com/sferik/status/55709764298092549
2803
2369
  end
2804
2370
  context "with no attributes" do
2805
2371
  before do
2806
- stub_get("/1.1/statuses/show/55709764298092546.json").
2807
- with(:query => {:include_my_retweet => "false"}).
2808
- to_return(:body => fixture("status_no_attributes.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2372
+ stub_get("/1.1/statuses/show/55709764298092546.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_attributes.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2809
2373
  end
2810
2374
  it "should have the correct output" do
2811
2375
  @cli.status("55709764298092546")
2812
- $stdout.string.should == <<-eos
2376
+ expect($stdout.string).to eq <<-eos
2813
2377
  ID 55709764298092546
2814
2378
  Text The problem with your code is that it's doing exactly what you told it to do.
2815
2379
  Screen name @sferik
@@ -2823,13 +2387,11 @@ URL https://twitter.com/sferik/status/55709764298092546
2823
2387
  end
2824
2388
  context "with no country" do
2825
2389
  before do
2826
- stub_get("/1.1/statuses/show/55709764298092547.json").
2827
- with(:query => {:include_my_retweet => "false"}).
2828
- to_return(:body => fixture("status_no_country.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2390
+ stub_get("/1.1/statuses/show/55709764298092547.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_country.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2829
2391
  end
2830
2392
  it "should have the correct output" do
2831
2393
  @cli.status("55709764298092547")
2832
- $stdout.string.should == <<-eos
2394
+ expect($stdout.string).to eq <<-eos
2833
2395
  ID 55709764298092547
2834
2396
  Text The problem with your code is that it's doing exactly what you told it to do.
2835
2397
  Screen name @sferik
@@ -2843,13 +2405,11 @@ URL https://twitter.com/sferik/status/55709764298092547
2843
2405
  end
2844
2406
  context "with no full name" do
2845
2407
  before do
2846
- stub_get("/1.1/statuses/show/55709764298092548.json").
2847
- with(:query => {:include_my_retweet => "false"}).
2848
- to_return(:body => fixture("status_no_full_name.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2408
+ stub_get("/1.1/statuses/show/55709764298092548.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_full_name.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2849
2409
  end
2850
2410
  it "should have the correct output" do
2851
2411
  @cli.status("55709764298092548")
2852
- $stdout.string.should == <<-eos
2412
+ expect($stdout.string).to eq <<-eos
2853
2413
  ID 55709764298092548
2854
2414
  Text The problem with your code is that it's doing exactly what you told it to do.
2855
2415
  Screen name @sferik
@@ -2865,20 +2425,16 @@ URL https://twitter.com/sferik/status/55709764298092548
2865
2425
 
2866
2426
  describe "#timeline" do
2867
2427
  before do
2868
- stub_get("/1.1/statuses/home_timeline.json").
2869
- with(:query => {:count => "20"}).
2870
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2428
+ stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "20"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2871
2429
  end
2872
2430
  context "without user" do
2873
2431
  it "should request the correct resource" do
2874
2432
  @cli.timeline
2875
- a_get("/1.1/statuses/home_timeline.json").
2876
- with(:query => {:count => "20"}).
2877
- should have_been_made
2433
+ expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "20"})).to have_been_made
2878
2434
  end
2879
2435
  it "should have the correct output" do
2880
2436
  @cli.timeline
2881
- $stdout.string.should == <<-eos
2437
+ expect($stdout.string).to eq <<-eos
2882
2438
  \e[1m\e[33m @mutgoff\e[0m
2883
2439
  Happy Birthday @imdane. Watch out for those @rally pranksters!
2884
2440
 
@@ -2963,7 +2519,7 @@ URL https://twitter.com/sferik/status/55709764298092548
2963
2519
  end
2964
2520
  it "should output in CSV format" do
2965
2521
  @cli.timeline
2966
- $stdout.string.should == <<-eos
2522
+ expect($stdout.string).to eq <<-eos
2967
2523
  ID,Posted at,Screen name,Text
2968
2524
  244111636544225280,2012-09-07 16:35:24 +0000,mutgoff,Happy Birthday @imdane. Watch out for those @rally pranksters!
2969
2525
  244111183165157376,2012-09-07 16:33:36 +0000,ironicsans,"If you like good real-life stories, check out @NarrativelyNY's just-launched site http://t.co/wiUL07jE (and also visit http://t.co/ZoyQxqWA)"
@@ -2994,7 +2550,7 @@ ID,Posted at,Screen name,Text
2994
2550
  end
2995
2551
  it "should output in long format" do
2996
2552
  @cli.timeline
2997
- $stdout.string.should == <<-eos
2553
+ expect($stdout.string).to eq <<-eos
2998
2554
  ID Posted at Screen name Text
2999
2555
  244111636544225280 Sep 7 08:35 @mutgoff Happy Birthday @imdane. W...
3000
2556
  244111183165157376 Sep 7 08:33 @ironicsans If you like good real-lif...
@@ -3024,7 +2580,7 @@ ID Posted at Screen name Text
3024
2580
  end
3025
2581
  it "should reverse the order of the sort" do
3026
2582
  @cli.timeline
3027
- $stdout.string.should == <<-eos
2583
+ expect($stdout.string).to eq <<-eos
3028
2584
  ID Posted at Screen name Text
3029
2585
  244099460672679938 Sep 7 07:47 @dwiskus Gentlemen, you can't figh...
3030
2586
  244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did y...
@@ -3052,107 +2608,67 @@ ID Posted at Screen name Text
3052
2608
  end
3053
2609
  context "--number" do
3054
2610
  before do
3055
- stub_get("/1.1/statuses/home_timeline.json").
3056
- with(:query => {:count => "1"}).
3057
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3058
- stub_get("/1.1/statuses/home_timeline.json").
3059
- with(:query => {:count => "200"}).
3060
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3061
- stub_get("/1.1/statuses/home_timeline.json").
3062
- with(:query => {:count => "200", :max_id => "244099460672679937"}).
3063
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2611
+ stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "1"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2612
+ 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"})
2613
+ stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200", :max_id => "244099460672679937"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3064
2614
  (5..185).step(20).to_a.reverse.each do |count|
3065
- stub_get("/1.1/statuses/home_timeline.json").
3066
- with(:query => {:count => count, :max_id => "244099460672679937"}).
3067
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2615
+ stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => count, :max_id => "244099460672679937"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3068
2616
  end
3069
2617
  end
3070
2618
  it "should limit the number of results to 1" do
3071
2619
  @cli.options = @cli.options.merge("number" => 1)
3072
2620
  @cli.timeline
3073
- a_get("/1.1/statuses/home_timeline.json").
3074
- with(:query => {:count => "1"}).
3075
- should have_been_made
2621
+ expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "1"})).to have_been_made
3076
2622
  end
3077
2623
  it "should limit the number of results to 345" do
3078
2624
  @cli.options = @cli.options.merge("number" => 345)
3079
2625
  @cli.timeline
3080
- a_get("/1.1/statuses/home_timeline.json").
3081
- with(:query => {:count => "200"}).
3082
- should have_been_made
3083
- a_get("/1.1/statuses/home_timeline.json").
3084
- with(:query => {:count => "200", :max_id => "244099460672679937"}).
3085
- should have_been_made.times(7)
2626
+ expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200"})).to have_been_made
2627
+ expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200", :max_id => "244099460672679937"})).to have_been_made.times(7)
3086
2628
  (5..185).step(20).to_a.reverse.each do |count|
3087
- a_get("/1.1/statuses/home_timeline.json").
3088
- with(:query => {:count => count, :max_id => "244099460672679937"}).
3089
- should have_been_made
2629
+ expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => count, :max_id => "244099460672679937"})).to have_been_made
3090
2630
  end
3091
2631
  end
3092
2632
  end
3093
2633
  context "with a user passed" do
3094
2634
  before do
3095
- stub_get("/1.1/statuses/user_timeline.json").
3096
- with(:query => {:count => "20", :screen_name => "sferik"}).
3097
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2635
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "20", :screen_name => "sferik"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3098
2636
  end
3099
2637
  it "should request the correct resource" do
3100
2638
  @cli.timeline("sferik")
3101
- a_get("/1.1/statuses/user_timeline.json").
3102
- with(:query => {:count => "20", :screen_name => "sferik"}).
3103
- should have_been_made
2639
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "20", :screen_name => "sferik"})).to have_been_made
3104
2640
  end
3105
2641
  context "--id" do
3106
2642
  before do
3107
2643
  @cli.options = @cli.options.merge("id" => true)
3108
- stub_get("/1.1/statuses/user_timeline.json").
3109
- with(:query => {:count => "20", :user_id => "7505382"}).
3110
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2644
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "20", :user_id => "7505382"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3111
2645
  end
3112
2646
  it "should request the correct resource" do
3113
2647
  @cli.timeline("7505382")
3114
- a_get("/1.1/statuses/user_timeline.json").
3115
- with(:query => {:count => "20", :user_id => "7505382"}).
3116
- should have_been_made
2648
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "20", :user_id => "7505382"})).to have_been_made
3117
2649
  end
3118
2650
  end
3119
2651
  context "--number" do
3120
2652
  before do
3121
- stub_get("/1.1/statuses/user_timeline.json").
3122
- with(:query => {:count => "1", :screen_name => "sferik"}).
3123
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3124
- stub_get("/1.1/statuses/user_timeline.json").
3125
- with(:query => {:count => "200", :screen_name => "sferik"}).
3126
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3127
- stub_get("/1.1/statuses/user_timeline.json").
3128
- with(:query => {:count => "200", :screen_name => "sferik", :max_id => "244099460672679937"}).
3129
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2653
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "1", :screen_name => "sferik"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2654
+ 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"})
2655
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :screen_name => "sferik", :max_id => "244099460672679937"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3130
2656
  (5..185).step(20).to_a.reverse.each do |count|
3131
- stub_get("/1.1/statuses/user_timeline.json").
3132
- with(:query => {:count => count, :screen_name => "sferik", :max_id => "244099460672679937"}).
3133
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2657
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => count, :screen_name => "sferik", :max_id => "244099460672679937"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3134
2658
  end
3135
2659
  end
3136
2660
  it "should limit the number of results to 1" do
3137
2661
  @cli.options = @cli.options.merge("number" => 1)
3138
2662
  @cli.timeline("sferik")
3139
- a_get("/1.1/statuses/user_timeline.json").
3140
- with(:query => {:count => "1", :screen_name => "sferik"}).
3141
- should have_been_made
2663
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "1", :screen_name => "sferik"})).to have_been_made
3142
2664
  end
3143
2665
  it "should limit the number of results to 345" do
3144
2666
  @cli.options = @cli.options.merge("number" => 345)
3145
2667
  @cli.timeline("sferik")
3146
- a_get("/1.1/statuses/user_timeline.json").
3147
- with(:query => {:count => "200", :screen_name => "sferik"}).
3148
- should have_been_made
3149
- a_get("/1.1/statuses/user_timeline.json").
3150
- with(:query => {:count => "200", :screen_name => "sferik", :max_id => "244099460672679937"}).
3151
- should have_been_made.times(7)
2668
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :screen_name => "sferik"})).to have_been_made
2669
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :screen_name => "sferik", :max_id => "244099460672679937"})).to have_been_made.times(7)
3152
2670
  (5..185).step(20).to_a.reverse.each do |count|
3153
- a_get("/1.1/statuses/user_timeline.json").
3154
- with(:query => {:count => count, :screen_name => "sferik", :max_id => "244099460672679937"}).
3155
- should have_been_made
2671
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => count, :screen_name => "sferik", :max_id => "244099460672679937"})).to have_been_made
3156
2672
  end
3157
2673
  end
3158
2674
  end
@@ -3161,70 +2677,56 @@ ID Posted at Screen name Text
3161
2677
 
3162
2678
  describe "#trends" do
3163
2679
  before do
3164
- stub_get("/1.1/trends/place.json").
3165
- with(:query => {:id => "1"}).
3166
- to_return(:body => fixture("trends.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2680
+ stub_get("/1.1/trends/place.json").with(:query => {:id => "1"}).to_return(:body => fixture("trends.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3167
2681
  end
3168
2682
  it "should request the correct resource" do
3169
2683
  @cli.trends
3170
- a_get("/1.1/trends/place.json").
3171
- with(:query => {:id => "1"}).
3172
- should have_been_made
2684
+ expect(a_get("/1.1/trends/place.json").with(:query => {:id => "1"})).to have_been_made
3173
2685
  end
3174
2686
  it "should have the correct output" do
3175
2687
  @cli.trends
3176
- $stdout.string.chomp.should == "#sevenwordsaftersex Walkman Allen Iverson"
2688
+ expect($stdout.string.chomp).to eq "#sevenwordsaftersex Walkman Allen Iverson"
3177
2689
  end
3178
2690
  context "--exclude-hashtags" do
3179
2691
  before do
3180
2692
  @cli.options = @cli.options.merge("exclude-hashtags" => true)
3181
- stub_get("/1.1/trends/place.json").
3182
- with(:query => {:id => "1", :exclude => "hashtags"}).
3183
- to_return(:body => fixture("trends.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2693
+ stub_get("/1.1/trends/place.json").with(:query => {:id => "1", :exclude => "hashtags"}).to_return(:body => fixture("trends.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3184
2694
  end
3185
2695
  it "should request the correct resource" do
3186
2696
  @cli.trends
3187
- a_get("/1.1/trends/place.json").
3188
- with(:query => {:id => "1", :exclude => "hashtags"}).
3189
- should have_been_made
2697
+ expect(a_get("/1.1/trends/place.json").with(:query => {:id => "1", :exclude => "hashtags"})).to have_been_made
3190
2698
  end
3191
2699
  it "should have the correct output" do
3192
2700
  @cli.trends
3193
- $stdout.string.chomp.should == "#sevenwordsaftersex Walkman Allen Iverson"
2701
+ expect($stdout.string.chomp).to eq "#sevenwordsaftersex Walkman Allen Iverson"
3194
2702
  end
3195
2703
  end
3196
2704
  context "with a WOEID passed" do
3197
2705
  before do
3198
- stub_get("/1.1/trends/place.json").
3199
- with(:query => {:id => "2487956"}).
3200
- to_return(:body => fixture("trends.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2706
+ stub_get("/1.1/trends/place.json").with(:query => {:id => "2487956"}).to_return(:body => fixture("trends.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3201
2707
  end
3202
2708
  it "should request the correct resource" do
3203
2709
  @cli.trends("2487956")
3204
- a_get("/1.1/trends/place.json").
3205
- with(:query => {:id => "2487956"}).
3206
- should have_been_made
2710
+ expect(a_get("/1.1/trends/place.json").with(:query => {:id => "2487956"})).to have_been_made
3207
2711
  end
3208
2712
  it "should have the correct output" do
3209
2713
  @cli.trends("2487956")
3210
- $stdout.string.chomp.should == "#sevenwordsaftersex Walkman Allen Iverson"
2714
+ expect($stdout.string.chomp).to eq "#sevenwordsaftersex Walkman Allen Iverson"
3211
2715
  end
3212
2716
  end
3213
2717
  end
3214
2718
 
3215
2719
  describe "#trend_locations" do
3216
2720
  before do
3217
- stub_get("/1.1/trends/available.json").
3218
- to_return(:body => fixture("locations.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2721
+ stub_get("/1.1/trends/available.json").to_return(:body => fixture("locations.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3219
2722
  end
3220
2723
  it "should request the correct resource" do
3221
2724
  @cli.trend_locations
3222
- a_get("/1.1/trends/available.json").
3223
- should have_been_made
2725
+ expect(a_get("/1.1/trends/available.json")).to have_been_made
3224
2726
  end
3225
2727
  it "should have the correct output" do
3226
2728
  @cli.trend_locations
3227
- $stdout.string.chomp.should == "Boston New York San Francisco United States Worldwide"
2729
+ expect($stdout.string.chomp).to eq "Boston New York San Francisco United States Worldwide"
3228
2730
  end
3229
2731
  context "--csv" do
3230
2732
  before do
@@ -3232,7 +2734,7 @@ ID Posted at Screen name Text
3232
2734
  end
3233
2735
  it "should output in CSV format" do
3234
2736
  @cli.trend_locations
3235
- $stdout.string.chomp.should == <<-eos.chomp
2737
+ expect($stdout.string.chomp).to eq <<-eos.chomp
3236
2738
  WOEID,Parent ID,Type,Name,Country
3237
2739
  2367105,,Town,Boston,United States
3238
2740
  2459115,,Town,New York,United States
@@ -3248,7 +2750,7 @@ WOEID,Parent ID,Type,Name,Country
3248
2750
  end
3249
2751
  it "should output in long format" do
3250
2752
  @cli.trend_locations
3251
- $stdout.string.chomp.should == <<-eos.chomp
2753
+ expect($stdout.string.chomp).to eq <<-eos.chomp
3252
2754
  WOEID Parent ID Type Name Country
3253
2755
  2367105 Town Boston United States
3254
2756
  2459115 Town New York United States
@@ -3264,7 +2766,7 @@ WOEID Parent ID Type Name Country
3264
2766
  end
3265
2767
  it "should reverse the order of the sort" do
3266
2768
  @cli.trend_locations
3267
- $stdout.string.chomp.should == "Worldwide United States San Francisco New York Boston"
2769
+ expect($stdout.string.chomp).to eq "Worldwide United States San Francisco New York Boston"
3268
2770
  end
3269
2771
  end
3270
2772
  context "--sort=country" do
@@ -3273,7 +2775,7 @@ WOEID Parent ID Type Name Country
3273
2775
  end
3274
2776
  it "should sort by number of favorites" do
3275
2777
  @cli.trend_locations
3276
- $stdout.string.chomp.should == "Worldwide New York Boston United States San Francisco"
2778
+ expect($stdout.string.chomp).to eq "Worldwide New York Boston United States San Francisco"
3277
2779
  end
3278
2780
  end
3279
2781
  context "--sort=parent" do
@@ -3282,7 +2784,7 @@ WOEID Parent ID Type Name Country
3282
2784
  end
3283
2785
  it "should sort by number of favorites" do
3284
2786
  @cli.trend_locations
3285
- $stdout.string.chomp.should == "Boston Worldwide New York United States San Francisco"
2787
+ expect($stdout.string.chomp).to eq "Boston Worldwide New York United States San Francisco"
3286
2788
  end
3287
2789
  end
3288
2790
  context "--sort=type" do
@@ -3291,7 +2793,7 @@ WOEID Parent ID Type Name Country
3291
2793
  end
3292
2794
  it "should sort by number of favorites" do
3293
2795
  @cli.trend_locations
3294
- $stdout.string.chomp.should == "United States Worldwide New York Boston San Francisco"
2796
+ expect($stdout.string.chomp).to eq "United States Worldwide New York Boston San Francisco"
3295
2797
  end
3296
2798
  end
3297
2799
  context "--sort=woeid" do
@@ -3300,7 +2802,7 @@ WOEID Parent ID Type Name Country
3300
2802
  end
3301
2803
  it "should sort by number of favorites" do
3302
2804
  @cli.trend_locations
3303
- $stdout.string.chomp.should == "Worldwide Boston New York San Francisco United States"
2805
+ expect($stdout.string.chomp).to eq "Worldwide Boston New York San Francisco United States"
3304
2806
  end
3305
2807
  end
3306
2808
  context "--unsorted" do
@@ -3309,7 +2811,7 @@ WOEID Parent ID Type Name Country
3309
2811
  end
3310
2812
  it "should not be sorted" do
3311
2813
  @cli.trend_locations
3312
- $stdout.string.chomp.should == "Boston Worldwide New York United States San Francisco"
2814
+ expect($stdout.string.chomp).to eq "Boston Worldwide New York United States San Francisco"
3313
2815
  end
3314
2816
  end
3315
2817
  end
@@ -3320,46 +2822,32 @@ WOEID Parent ID Type Name Country
3320
2822
  end
3321
2823
  context "one user" do
3322
2824
  it "should request the correct resource" do
3323
- stub_post("/1.1/friendships/destroy.json").
3324
- with(:body => {:screen_name => "sferik"}).
3325
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2825
+ stub_post("/1.1/friendships/destroy.json").with(:body => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3326
2826
  @cli.unfollow("sferik")
3327
- a_post("/1.1/friendships/destroy.json").
3328
- with(:body => {:screen_name => "sferik"}).
3329
- should have_been_made
2827
+ expect(a_post("/1.1/friendships/destroy.json").with(:body => {:screen_name => "sferik"})).to have_been_made
3330
2828
  end
3331
2829
  it "should have the correct output" do
3332
- stub_post("/1.1/friendships/destroy.json").
3333
- with(:body => {:screen_name => "sferik"}).
3334
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2830
+ stub_post("/1.1/friendships/destroy.json").with(:body => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3335
2831
  @cli.unfollow("sferik")
3336
- $stdout.string.should =~ /^@testcli is no longer following 1 user\.$/
2832
+ expect($stdout.string).to match /^@testcli is no longer following 1 user\.$/
3337
2833
  end
3338
2834
  context "--id" do
3339
2835
  before do
3340
2836
  @cli.options = @cli.options.merge("id" => true)
3341
- stub_post("/1.1/friendships/destroy.json").
3342
- with(:body => {:user_id => "7505382"}).
3343
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2837
+ stub_post("/1.1/friendships/destroy.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3344
2838
  end
3345
2839
  it "should request the correct resource" do
3346
2840
  @cli.unfollow("7505382")
3347
- a_post("/1.1/friendships/destroy.json").
3348
- with(:body => {:user_id => "7505382"}).
3349
- should have_been_made
2841
+ expect(a_post("/1.1/friendships/destroy.json").with(:body => {:user_id => "7505382"})).to have_been_made
3350
2842
  end
3351
2843
  end
3352
2844
  context "Twitter is down" do
3353
2845
  it "should retry 3 times and then raise an error" do
3354
- stub_post("/1.1/friendships/destroy.json").
3355
- with(:body => {:screen_name => "sferik"}).
3356
- to_return(:status => 502)
3357
- lambda do
2846
+ stub_post("/1.1/friendships/destroy.json").with(:body => {:screen_name => "sferik"}).to_return(:status => 502)
2847
+ expect do
3358
2848
  @cli.unfollow("sferik")
3359
- end.should raise_error("Twitter is down or being upgraded.")
3360
- a_post("/1.1/friendships/destroy.json").
3361
- with(:body => {:screen_name => "sferik"}).
3362
- should have_been_made.times(3)
2849
+ end.to raise_error("Twitter is down or being upgraded.")
2850
+ expect(a_post("/1.1/friendships/destroy.json").with(:body => {:screen_name => "sferik"})).to have_been_made.times(3)
3363
2851
  end
3364
2852
  end
3365
2853
  end
@@ -3368,61 +2856,47 @@ WOEID Parent ID Type Name Country
3368
2856
  describe "#update" do
3369
2857
  before do
3370
2858
  @cli.options = @cli.options.merge("profile" => fixture_path + "/.trc", "location" => true)
3371
- stub_post("/1.1/statuses/update.json").
3372
- with(:body => {:status => "Testing", :lat => "37.76969909668", :long => "-122.39330291748", :trim_user => "true"}).
3373
- to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3374
- stub_request(:get, "http://checkip.dyndns.org/").
3375
- to_return(:body => fixture("checkip.html"), :headers => {:content_type => "text/html"})
3376
- stub_request(:get, "http://www.geoplugin.net/xml.gp?ip=50.131.22.169").
3377
- to_return(:body => fixture("geoplugin.xml"), :headers => {:content_type => "application/xml"})
2859
+ stub_post("/1.1/statuses/update.json").with(:body => {:status => "Testing", :lat => "37.76969909668", :long => "-122.39330291748", :trim_user => "true"}).to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2860
+ stub_request(:get, "http://checkip.dyndns.org/").to_return(:body => fixture("checkip.html"), :headers => {:content_type => "text/html"})
2861
+ stub_request(:get, "http://www.geoplugin.net/xml.gp?ip=50.131.22.169").to_return(:body => fixture("geoplugin.xml"), :headers => {:content_type => "application/xml"})
3378
2862
  end
3379
2863
  it "should request the correct resource" do
3380
2864
  @cli.update("Testing")
3381
- a_post("/1.1/statuses/update.json").
3382
- with(:body => {:status => "Testing", :lat => "37.76969909668", :long => "-122.39330291748", :trim_user => "true"}).
3383
- should have_been_made
3384
- a_request(:get, "http://checkip.dyndns.org/").
3385
- should have_been_made
3386
- a_request(:get, "http://www.geoplugin.net/xml.gp?ip=50.131.22.169").
3387
- should have_been_made
2865
+ expect(a_post("/1.1/statuses/update.json").with(:body => {:status => "Testing", :lat => "37.76969909668", :long => "-122.39330291748", :trim_user => "true"})).to have_been_made
2866
+ expect(a_request(:get, "http://checkip.dyndns.org/")).to have_been_made
2867
+ expect(a_request(:get, "http://www.geoplugin.net/xml.gp?ip=50.131.22.169")).to have_been_made
3388
2868
  end
3389
2869
  it "should have the correct output" do
3390
2870
  @cli.update("Testing")
3391
- $stdout.string.split("\n").first.should == "Tweet posted by @testcli."
2871
+ expect($stdout.string.split("\n").first).to eq "Tweet posted by @testcli."
3392
2872
  end
3393
2873
  context "with file" do
3394
2874
  before do
3395
2875
  @cli.options = @cli.options.merge("file" => fixture_path + "/long.png")
3396
- stub_post("/1.1/statuses/update_with_media.json").
3397
- to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2876
+ stub_post("/1.1/statuses/update_with_media.json").to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3398
2877
  end
3399
2878
  it "should request the correct resource" do
3400
2879
  @cli.update("Testing")
3401
- a_post("/1.1/statuses/update_with_media.json").
3402
- should have_been_made
2880
+ expect(a_post("/1.1/statuses/update_with_media.json")).to have_been_made
3403
2881
  end
3404
2882
  it "should have the correct output" do
3405
2883
  @cli.update("Testing")
3406
- $stdout.string.split("\n").first.should == "Tweet posted by @testcli."
2884
+ expect($stdout.string.split("\n").first).to eq "Tweet posted by @testcli."
3407
2885
  end
3408
2886
  end
3409
2887
  end
3410
2888
 
3411
2889
  describe "#users" do
3412
2890
  before do
3413
- stub_post("/1.1/users/lookup.json").
3414
- with(:body => {:screen_name => "sferik,pengwynn"}).
3415
- to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2891
+ stub_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3416
2892
  end
3417
2893
  it "should request the correct resource" do
3418
2894
  @cli.users("sferik", "pengwynn")
3419
- a_post("/1.1/users/lookup.json").
3420
- with(:body => {:screen_name => "sferik,pengwynn"}).
3421
- should have_been_made
2895
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"})).to have_been_made
3422
2896
  end
3423
2897
  it "should have the correct output" do
3424
2898
  @cli.users("sferik", "pengwynn")
3425
- $stdout.string.chomp.should == "pengwynn sferik"
2899
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
3426
2900
  end
3427
2901
  context "--csv" do
3428
2902
  before do
@@ -3430,7 +2904,7 @@ WOEID Parent ID Type Name Country
3430
2904
  end
3431
2905
  it "should output in CSV format" do
3432
2906
  @cli.users("sferik", "pengwynn")
3433
- $stdout.string.should == <<-eos
2907
+ expect($stdout.string).to eq <<-eos
3434
2908
  ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
3435
2909
  14100886,2008-03-08 16:34:22 +0000,2012-07-07 20:33:19 +0000,6940,192,358,3427,5457,pengwynn,Wynn Netherland ⚡
3436
2910
  7505382,2007-07-16 12:59:01 +0000,2012-07-08 18:29:20 +0000,7890,3755,118,212,2262,sferik,Erik Michaels-Ober
@@ -3443,7 +2917,7 @@ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name
3443
2917
  end
3444
2918
  it "should output in long format" do
3445
2919
  @cli.users("sferik", "pengwynn")
3446
- $stdout.string.should == <<-eos
2920
+ expect($stdout.string).to eq <<-eos
3447
2921
  ID Since Last tweeted at Tweets Favorites Listed Following...
3448
2922
  14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
3449
2923
  7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
@@ -3456,7 +2930,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
3456
2930
  end
3457
2931
  it "should reverse the order of the sort" do
3458
2932
  @cli.users("sferik", "pengwynn")
3459
- $stdout.string.chomp.should == "sferik pengwynn"
2933
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
3460
2934
  end
3461
2935
  end
3462
2936
  context "--sort=favorites" do
@@ -3465,7 +2939,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
3465
2939
  end
3466
2940
  it "should sort by number of favorites" do
3467
2941
  @cli.users("sferik", "pengwynn")
3468
- $stdout.string.chomp.should == "pengwynn sferik"
2942
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
3469
2943
  end
3470
2944
  end
3471
2945
  context "--sort=followers" do
@@ -3474,7 +2948,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
3474
2948
  end
3475
2949
  it "should sort by number of followers" do
3476
2950
  @cli.users("sferik", "pengwynn")
3477
- $stdout.string.chomp.should == "sferik pengwynn"
2951
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
3478
2952
  end
3479
2953
  end
3480
2954
  context "--sort=friends" do
@@ -3483,21 +2957,17 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
3483
2957
  end
3484
2958
  it "should sort by number of friends" do
3485
2959
  @cli.users("sferik", "pengwynn")
3486
- $stdout.string.chomp.should == "sferik pengwynn"
2960
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
3487
2961
  end
3488
2962
  end
3489
2963
  context "--id" do
3490
2964
  before do
3491
2965
  @cli.options = @cli.options.merge("id" => true)
3492
- stub_post("/1.1/users/lookup.json").
3493
- with(:body => {:user_id => "7505382,14100886"}).
3494
- to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2966
+ stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382,14100886"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3495
2967
  end
3496
2968
  it "should request the correct resource" do
3497
2969
  @cli.users("7505382", "14100886")
3498
- a_post("/1.1/users/lookup.json").
3499
- with(:body => {:user_id => "7505382,14100886"}).
3500
- should have_been_made
2970
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382,14100886"})).to have_been_made
3501
2971
  end
3502
2972
  end
3503
2973
  context "--sort=listed" do
@@ -3506,7 +2976,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
3506
2976
  end
3507
2977
  it "should sort by number of list memberships" do
3508
2978
  @cli.users("sferik", "pengwynn")
3509
- $stdout.string.chomp.should == "sferik pengwynn"
2979
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
3510
2980
  end
3511
2981
  end
3512
2982
  context "--sort=since" do
@@ -3515,7 +2985,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
3515
2985
  end
3516
2986
  it "should sort by the time when Twitter acount was created" do
3517
2987
  @cli.users("sferik", "pengwynn")
3518
- $stdout.string.chomp.should == "sferik pengwynn"
2988
+ expect($stdout.string.chomp).to eq "sferik pengwynn"
3519
2989
  end
3520
2990
  end
3521
2991
  context "--sort=tweets" do
@@ -3524,7 +2994,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
3524
2994
  end
3525
2995
  it "should sort by number of Tweets" do
3526
2996
  @cli.users("sferik", "pengwynn")
3527
- $stdout.string.chomp.should == "pengwynn sferik"
2997
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
3528
2998
  end
3529
2999
  end
3530
3000
  context "--sort=tweeted" do
@@ -3533,7 +3003,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
3533
3003
  end
3534
3004
  it "should sort by the time of the last Tweet" do
3535
3005
  @cli.users("sferik", "pengwynn")
3536
- $stdout.string.chomp.should == "pengwynn sferik"
3006
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
3537
3007
  end
3538
3008
  end
3539
3009
  context "--unsorted" do
@@ -3542,7 +3012,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
3542
3012
  end
3543
3013
  it "should not be sorted" do
3544
3014
  @cli.users("sferik", "pengwynn")
3545
- $stdout.string.chomp.should == "pengwynn sferik"
3015
+ expect($stdout.string.chomp).to eq "pengwynn sferik"
3546
3016
  end
3547
3017
  end
3548
3018
  end
@@ -3550,25 +3020,21 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
3550
3020
  describe "#version" do
3551
3021
  it "should have the correct output" do
3552
3022
  @cli.version
3553
- $stdout.string.chomp.should == T::Version.to_s
3023
+ expect($stdout.string.chomp).to eq T::Version.to_s
3554
3024
  end
3555
3025
  end
3556
3026
 
3557
3027
  describe "#whois" do
3558
3028
  before do
3559
- stub_get("/1.1/users/show.json").
3560
- with(:query => {:screen_name => "sferik"}).
3561
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3029
+ stub_get("/1.1/users/show.json").with(:query => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3562
3030
  end
3563
3031
  it "should request the correct resource" do
3564
3032
  @cli.whois("sferik")
3565
- a_get("/1.1/users/show.json").
3566
- with(:query => {:screen_name => "sferik"}).
3567
- should have_been_made
3033
+ expect(a_get("/1.1/users/show.json").with(:query => {:screen_name => "sferik"})).to have_been_made
3568
3034
  end
3569
3035
  it "should have the correct output" do
3570
3036
  @cli.whois("sferik")
3571
- $stdout.string.should == <<-eos
3037
+ expect($stdout.string).to eq <<-eos
3572
3038
  ID 7505382
3573
3039
  Name Erik Michaels-Ober
3574
3040
  Bio Vagabond.
@@ -3590,7 +3056,7 @@ URL https://github.com/sferik
3590
3056
  end
3591
3057
  it "should have the correct output" do
3592
3058
  @cli.whois("sferik")
3593
- $stdout.string.should == <<-eos
3059
+ expect($stdout.string).to eq <<-eos
3594
3060
  ID,Verified,Name,Screen name,Bio,Location,Following,Last update,Lasted updated at,Since,Tweets,Favorites,Listed,Following,Followers,URL
3595
3061
  7505382,false,Erik Michaels-Ober,sferik,Vagabond.,San Francisco,false,@goldman You're near my home town! Say hi to Woodstock for me.,2012-07-08 18:29:20 +0000,2007-07-16 12:59:01 +0000,7890,3755,118,212,2262,https://github.com/sferik
3596
3062
  eos
@@ -3599,15 +3065,11 @@ ID,Verified,Name,Screen name,Bio,Location,Following,Last update,Lasted updated a
3599
3065
  context "--id" do
3600
3066
  before do
3601
3067
  @cli.options = @cli.options.merge("id" => true)
3602
- stub_get("/1.1/users/show.json").
3603
- with(:query => {:user_id => "7505382"}).
3604
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3068
+ stub_get("/1.1/users/show.json").with(:query => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3605
3069
  end
3606
3070
  it "should request the correct resource" do
3607
3071
  @cli.whois("7505382")
3608
- a_get("/1.1/users/show.json").
3609
- with(:query => {:user_id => "7505382"}).
3610
- should have_been_made
3072
+ expect(a_get("/1.1/users/show.json").with(:query => {:user_id => "7505382"})).to have_been_made
3611
3073
  end
3612
3074
  end
3613
3075
  end