/
cli_spec.rb
686 lines (663 loc) · 40.4 KB
/
cli_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
# encoding: utf-8
require 'helper'
describe T::CLI do
before do
rcfile = RCFile.instance
rcfile.path = fixture_path + "/.trc"
@t = T::CLI.new
@old_stderr = $stderr
$stderr = StringIO.new
@old_stdout = $stdout
$stdout = StringIO.new
Timecop.freeze(Time.local(2011, 11, 24, 16, 20, 0))
end
after do
Timecop.return
$stderr = @old_stderr
$stdout = @old_stdout
end
describe "#account" do
before do
@t.options = @t.options.merge(:profile => fixture_path + "/.trc")
end
it "should have the correct output" do
@t.accounts
$stdout.string.should == <<-eos.gsub(/^ {8}/, '')
testcli
abc123 (default)
eos
end
end
describe "#authorize" do
before do
@t.options = @t.options.merge(:profile => File.expand_path('/tmp/trc', __FILE__), :consumer_key => "abc123", :consumer_secret => "asdfasd223sd2", :prompt => true, :dry_run => true)
stub_post("/oauth/request_token").
to_return(:body => fixture("request_token"))
stub_post("/oauth/access_token").
to_return(:body => fixture("access_token"))
stub_get("/1/account/verify_credentials.json").
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "should request the correct resource" do
$stdout.should_receive(:print).with("Press [Enter] to open the Twitter app authorization page. ")
$stdin.should_receive(:gets).and_return("\n")
$stdout.should_receive(:print).with("Paste in the supplied PIN: ")
$stdin.should_receive(:gets).and_return("1234567890")
@t.authorize
a_post("/oauth/request_token").
should have_been_made
a_post("/oauth/access_token").
should have_been_made
a_get("/1/account/verify_credentials.json").
should have_been_made
end
it "should not raise error" do
lambda do
$stdout.should_receive(:print).with("Press [Enter] to open the Twitter app authorization page. ")
$stdin.should_receive(:gets).and_return("\n")
$stdout.should_receive(:print).with("Paste in the supplied PIN: ")
$stdin.should_receive(:gets).and_return("1234567890")
@t.authorize
end.should_not raise_error
end
end
describe "#block" do
before do
@t.options = @t.options.merge(:profile => fixture_path + "/.trc")
stub_post("/1/blocks/create.json").
with(:body => {:screen_name => "sferik", :include_entities => "false"}).
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "should request the correct resource" do
@t.block("sferik")
a_post("/1/blocks/create.json").
with(:body => {:screen_name => "sferik", :include_entities => "false"}).
should have_been_made
end
it "should have the correct output" do
@t.block("sferik")
$stdout.string.should =~ /^@testcli blocked @sferik/
end
end
describe "#direct_messages" do
before do
stub_get("/1/direct_messages.json").
with(:query => {:include_entities => "false"}).
to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "should request the correct resource" do
@t.direct_messages
a_get("/1/direct_messages.json").
with(:query => {:include_entities => "false"}).
should have_been_made
end
it "should have the correct output" do
@t.direct_messages
$stdout.string.should == <<-eos.gsub(/^/, ' ' * 6)
sferik: Sounds good. Meeting Tuesday is fine. (about 1 year ago)
sferik: if you want to add me to your GroupMe group, my phone number is 415-312-2382 (about 1 year ago)
sferik: That's great news! Let's plan to chat around 8 AM tomorrow Pacific time. Does that work for you? (about 1 year ago)
sferik: I asked Yehuda about the stipend. I believe it has already been sent. Glad you're feeling better. (about 1 year ago)
sferik: Just checking in. How's everything going? (about 1 year ago)
sferik: Any luck completing graphs this weekend? There have been lots of commits to RailsAdmin since summer ended but none from you. How's it going? (about 1 year ago)
sferik: Not sure about the payment. Feel free to ask Leah or Yehuda directly. Think you'll be able to finish up your work on graphs this weekend? (about 1 year ago)
sferik: Looks good to me. I'm going to pull in the change now. My only concern is that we don't have any tests for auth. (about 1 year ago)
sferik: How are the graph enhancements coming? (about 1 year ago)
sferik: Changes pushed. You should pull and re-bundle when you have a minute. (about 1 year ago)
sferik: Glad to hear the new graphs are coming along. Can't wait to see them! (about 1 year ago)
sferik: I figured out what was wrong with the tests: I accidentally unbundled webrat. The problem had nothing to do with rspec-rails. (about 1 year ago)
sferik: After the upgrade 54/80 specs are failing. I'm working on fixing them now. (about 1 year ago)
sferik: a new version of rspec-rails just shipped with some nice features and fixes http://github.com/rspec/rspec-rails/blob/master/History.md (about 1 year ago)
sferik: How are the graphs coming? I'm really looking forward to seeing what you do with Raphaël. (about 1 year ago)
sferik: Awesome! Any luck duplicating the Gemfile.lock error with Ruby 1.9.2 final? (about 1 year ago)
sferik: I just committed a bunch of cleanup and fixes to RailsAdmin that touched many of files. Make sure you pull to avoid conflicts. (about 1 year ago)
sferik: Can you try upgrading to 1.9.2 final, re-installing Bundler 1.0.0.rc.6 (don't remove 1.0.0) and see if you can reproduce the problem? (about 1 year ago)
sferik: I'm trying to debug the issue you were having with the Bundler Gemfile.lock shortref. What version of Ruby and RubyGems are you running? (about 1 year ago)
sferik: Let's try to debug that problem during our session in 1.5 hours. In the mean time, try working on the graphs or internationalization. (about 1 year ago)
eos
end
end
describe "#dm" do
before do
@t.options = @t.options.merge(:profile => fixture_path + "/.trc")
stub_post("/1/direct_messages/new.json").
with(:body => {:screen_name => "pengwynn", :text => "Creating a fixture for the Twitter gem", :include_entities => "false"}).
to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "should request the correct resource" do
@t.dm("pengwynn", "Creating a fixture for the Twitter gem")
a_post("/1/direct_messages/new.json").
with(:body => {:screen_name => "pengwynn", :text => "Creating a fixture for the Twitter gem", :include_entities => "false"}).
should have_been_made
end
it "should have the correct output" do
@t.dm("pengwynn", "Creating a fixture for the Twitter gem")
$stdout.string.chomp.should == "Direct Message sent from @testcli to @pengwynn (about 1 year ago)"
end
end
describe "#favorite" do
before do
@t.options = @t.options.merge(:profile => fixture_path + "/.trc")
end
context "not found" do
before do
stub_get("/1/users/show.json").
with(:query => {:screen_name => "sferik", :include_entities => "false"}).
to_return(:body => '{}', :headers => {:content_type => "application/json; charset=utf-8"})
end
it "should exit" do
lambda do
@t.favorite("sferik")
end.should raise_error(Thor::Error, "Tweet not found")
end
end
context "forbidden" do
before do
stub_get("/1/users/show.json").
with(:query => {:screen_name => "sferik", :include_entities => "false"}).
to_return(:body => '{"error":"Forbidden"}', :headers => {:content_type => "application/json; charset=utf-8"}, :status => 403)
end
it "should exit" do
lambda do
@t.favorite("sferik")
end.should raise_error(Twitter::Error::Forbidden, "Forbidden")
end
end
context "duplicate" do
before do
stub_get("/1/users/show.json").
with(:query => {:screen_name => "sferik", :include_entities => "false"}).
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
stub_post("/1/favorites/create/26755176471724032.json").
to_return(:body => '{"error":"You have already favorited this status."}', :headers => {:content_type => "application/json; charset=utf-8"}, :status => 403)
end
it "should have the correct output" do
@t.favorite("sferik")
$stdout.string.should =~ /^@testcli favorited @sferik's latest status: "RT @tenderlove: \[ANN\] sqlite3-ruby => sqlite3"$/
end
end
context "found" do
before do
stub_get("/1/users/show.json").
with(:query => {:screen_name => "sferik", :include_entities => "false"}).
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
stub_post("/1/favorites/create/26755176471724032.json").
to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "should request the correct resource" do
@t.favorite("sferik")
a_get("/1/users/show.json").
with(:query => {:screen_name => "sferik", :include_entities => "false"}).
should have_been_made
a_post("/1/favorites/create/26755176471724032.json").
should have_been_made
end
it "should have the correct output" do
@t.favorite("sferik")
$stdout.string.should =~ /^@testcli favorited @sferik's latest status: "RT @tenderlove: \[ANN\] sqlite3-ruby => sqlite3"$/
end
end
end
describe "#favorites" do
before do
stub_get("/1/favorites.json").
with(:query => {:include_entities => "false"}).
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "should request the correct resource" do
@t.favorites
a_get("/1/favorites.json").
with(:query => {:include_entities => "false"}).
should have_been_made
end
it "should have the correct output" do
@t.favorites
$stdout.string.should == <<-eos.gsub(/^/, ' ' * 6)
sferik: Ruby is the best programming language for hiding the ugly bits. (about 1 year ago)
sferik: There are 1.3 billion people in China; when people say there are 1 billion they are rounding off the entire population of the United States. (about 1 year ago)
sferik: The new Windows Phone campaign is the best advertising from Microsoft since "Start Me Up" (1995). Great work by CP+B. http://t.co/tIzxopI (about 1 year ago)
sferik: Fear not to sow seeds because of the birds. http://twitpic.com/2wg621 (about 1 year ago)
sferik: Speaking of things that are maddening: the interview with the Wall Street guys on the most recent This American Life http://bit.ly/af9pSD (about 1 year ago)
sferik: Holy cow! RailsAdmin is up to 200 watchers (from 100 yesterday). http://github.com/sferik/rails_admin (about 1 year ago)
sferik: Kind of cool that Facebook acts as a mirror for open-source projects that they use or like http://mirror.facebook.net/ (about 1 year ago)
sferik: RailsAdmin already has 100 watchers, 12 forks, and 6 contributors in less than 2 months. Let's keep the momentum going! http://bit.ly/cCMMqD (about 1 year ago)
sferik: This week's This American Life is amazing. @JoeLipari is an American hero. http://bit.ly/d9RbnB (about 1 year ago)
sferik: RT @polyseme: OH: shofars should be called jewvuzelas. (about 1 year ago)
sferik: Spent this morning fixing broken windows in RailsAdmin http://github.com/sferik/rails_admin/compare/ab6c598...0e3770f (about 1 year ago)
sferik: I'm a big believer that the broken windows theory applies to software development http://en.wikipedia.org/wiki/Broken_windows_theory (about 1 year ago)
sferik: I hope you idiots are happy with your piece of shit Android phones. http://www.apple.com/pr/library/2010/09/09statement.html (about 1 year ago)
sferik: Ping: kills MySpace dead. (about 1 year ago)
sferik: Crazy that iTunes Ping didn't leak a drop. (about 1 year ago)
sferik: The plot thickens http://twitpic.com/2k5lt2 (about 1 year ago)
sferik: 140 Proof Provides A Piece Of The Twitter Advertising Puzzle http://t.co/R2cUSDe via @techcrunch (about 1 year ago)
sferik: Try as you may http://www.thedoghousediaries.com/?p=1940 (about 1 year ago)
sferik: I know @SarahPalinUSA has a right to use Twitter, but should she? (over 1 year ago)
eos
end
end
describe "#mentions" do
before do
stub_get("/1/statuses/mentions.json").
with(:query => {:include_entities => "false"}).
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "should request the correct resource" do
@t.mentions
a_get("/1/statuses/mentions.json").
with(:query => {:include_entities => "false"}).
should have_been_made
end
it "should have the correct output" do
@t.mentions
$stdout.string.should == <<-eos.gsub(/^/, ' ' * 6)
sferik: Ruby is the best programming language for hiding the ugly bits. (about 1 year ago)
sferik: There are 1.3 billion people in China; when people say there are 1 billion they are rounding off the entire population of the United States. (about 1 year ago)
sferik: The new Windows Phone campaign is the best advertising from Microsoft since "Start Me Up" (1995). Great work by CP+B. http://t.co/tIzxopI (about 1 year ago)
sferik: Fear not to sow seeds because of the birds. http://twitpic.com/2wg621 (about 1 year ago)
sferik: Speaking of things that are maddening: the interview with the Wall Street guys on the most recent This American Life http://bit.ly/af9pSD (about 1 year ago)
sferik: Holy cow! RailsAdmin is up to 200 watchers (from 100 yesterday). http://github.com/sferik/rails_admin (about 1 year ago)
sferik: Kind of cool that Facebook acts as a mirror for open-source projects that they use or like http://mirror.facebook.net/ (about 1 year ago)
sferik: RailsAdmin already has 100 watchers, 12 forks, and 6 contributors in less than 2 months. Let's keep the momentum going! http://bit.ly/cCMMqD (about 1 year ago)
sferik: This week's This American Life is amazing. @JoeLipari is an American hero. http://bit.ly/d9RbnB (about 1 year ago)
sferik: RT @polyseme: OH: shofars should be called jewvuzelas. (about 1 year ago)
sferik: Spent this morning fixing broken windows in RailsAdmin http://github.com/sferik/rails_admin/compare/ab6c598...0e3770f (about 1 year ago)
sferik: I'm a big believer that the broken windows theory applies to software development http://en.wikipedia.org/wiki/Broken_windows_theory (about 1 year ago)
sferik: I hope you idiots are happy with your piece of shit Android phones. http://www.apple.com/pr/library/2010/09/09statement.html (about 1 year ago)
sferik: Ping: kills MySpace dead. (about 1 year ago)
sferik: Crazy that iTunes Ping didn't leak a drop. (about 1 year ago)
sferik: The plot thickens http://twitpic.com/2k5lt2 (about 1 year ago)
sferik: 140 Proof Provides A Piece Of The Twitter Advertising Puzzle http://t.co/R2cUSDe via @techcrunch (about 1 year ago)
sferik: Try as you may http://www.thedoghousediaries.com/?p=1940 (about 1 year ago)
sferik: I know @SarahPalinUSA has a right to use Twitter, but should she? (over 1 year ago)
eos
end
end
describe "#open" do
before do
@t.options = @t.options.merge(:dry_run => true)
end
it "should not raise error" do
lambda do
@t.open("sferik")
end.should_not raise_error
end
end
describe "#reply" do
before do
@t.options = @t.options.merge(:profile => fixture_path + "/.trc", :location => true)
stub_get("/1/users/show.json").
with(:query => {:screen_name => "sferik", :include_entities => "false"}).
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
stub_post("/1/statuses/update.json").
with(:body => {:in_reply_to_status_id => "26755176471724032", :status => "@sferik Testing", :lat => "37.76969909668", :long => "-122.39330291748", :include_entities => "false", :trim_user => "true"}).
to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
stub_request(:get, "http://checkip.dyndns.org/").
to_return(:body => fixture("checkip.html"), :headers => {:content_type => "text/html"})
stub_request(:get, "http://www.geoplugin.net/xml.gp?ip=50.131.22.169").
to_return(:body => fixture("xml.gp"), :headers => {:content_type => "application/xml"})
end
it "should request the correct resource" do
@t.reply("sferik", "Testing")
a_get("/1/users/show.json").
with(:query => {:screen_name => "sferik", :include_entities => "false"}).
should have_been_made
a_post("/1/statuses/update.json").
with(:body => {:in_reply_to_status_id => "26755176471724032", :status => "@sferik Testing", :lat => "37.76969909668", :long => "-122.39330291748", :include_entities => "false", :trim_user => "true"}).
should have_been_made
a_request(:get, "http://checkip.dyndns.org/").
should have_been_made
a_request(:get, "http://www.geoplugin.net/xml.gp?ip=50.131.22.169").
should have_been_made
end
it "should have the correct output" do
@t.reply("sferik", "Testing")
$stdout.string.should =~ /^Reply created by @testcli to @sferik \(about 1 year ago\)$/
end
end
describe "#retweet" do
before do
@t.options = @t.options.merge(:profile => fixture_path + "/.trc")
end
context "not found" do
before do
stub_get("/1/users/show.json").
with(:query => {:screen_name => "sferik", :include_entities => "false"}).
to_return(:body => '{}', :headers => {:content_type => "application/json; charset=utf-8"})
end
it "should exit" do
lambda do
@t.retweet("sferik")
end.should raise_error(Thor::Error, "Tweet not found")
end
end
context "forbidden" do
before do
stub_get("/1/users/show.json").
with(:query => {:screen_name => "sferik", :include_entities => "false"}).
to_return(:body => '{"error":"Forbidden"}', :headers => {:content_type => "application/json; charset=utf-8"}, :status => 403)
end
it "should exit" do
lambda do
@t.retweet("sferik")
end.should raise_error(Twitter::Error::Forbidden, "Forbidden")
end
end
context "duplicate" do
before do
stub_get("/1/users/show.json").
with(:query => {:screen_name => "sferik", :include_entities => "false"}).
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
stub_post("/1/statuses/retweet/26755176471724032.json").
to_return(:body => '{"error":"sharing is not permissable for this status (Share validations failed)"}', :headers => {:content_type => "application/json; charset=utf-8"}, :status => 403)
end
it "should have the correct output" do
@t.retweet("sferik")
$stdout.string.should =~ /^@testcli retweeted @sferik's latest status: "RT @tenderlove: \[ANN\] sqlite3-ruby => sqlite3"$/
end
end
context "found" do
before do
stub_get("/1/users/show.json").
with(:query => {:screen_name => "sferik", :include_entities => "false"}).
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
stub_post("/1/statuses/retweet/26755176471724032.json").
to_return(:body => fixture("retweet.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "should request the correct resource" do
@t.retweet("sferik")
a_get("/1/users/show.json").
with(:query => {:screen_name => "sferik", :include_entities => "false"}).
should have_been_made
a_post("/1/statuses/retweet/26755176471724032.json").
should have_been_made
end
it "should have the correct output" do
@t.retweet("sferik")
$stdout.string.should =~ /^@testcli retweeted @sferik's latest status: "RT @tenderlove: \[ANN\] sqlite3-ruby => sqlite3"$/
end
end
end
describe "#retweets" do
context "without arguments" do
before do
stub_get("/1/statuses/retweeted_by_me.json").
with(:query => {:include_entities => "false"}).
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "should request the correct resource" do
@t.retweets
a_get("/1/statuses/retweeted_by_me.json").
with(:query => {:include_entities => "false"}).
should have_been_made
end
it "should have the correct output" do
@t.retweets
$stdout.string.should == <<-eos.gsub(/^/, ' ' * 4)
sferik: Ruby is the best programming language for hiding the ugly bits. (about 1 year ago)
sferik: There are 1.3 billion people in China; when people say there are 1 billion they are rounding off the entire population of the United States. (about 1 year ago)
sferik: The new Windows Phone campaign is the best advertising from Microsoft since "Start Me Up" (1995). Great work by CP+B. http://t.co/tIzxopI (about 1 year ago)
sferik: Fear not to sow seeds because of the birds. http://twitpic.com/2wg621 (about 1 year ago)
sferik: Speaking of things that are maddening: the interview with the Wall Street guys on the most recent This American Life http://bit.ly/af9pSD (about 1 year ago)
sferik: Holy cow! RailsAdmin is up to 200 watchers (from 100 yesterday). http://github.com/sferik/rails_admin (about 1 year ago)
sferik: Kind of cool that Facebook acts as a mirror for open-source projects that they use or like http://mirror.facebook.net/ (about 1 year ago)
sferik: RailsAdmin already has 100 watchers, 12 forks, and 6 contributors in less than 2 months. Let's keep the momentum going! http://bit.ly/cCMMqD (about 1 year ago)
sferik: This week's This American Life is amazing. @JoeLipari is an American hero. http://bit.ly/d9RbnB (about 1 year ago)
sferik: RT @polyseme: OH: shofars should be called jewvuzelas. (about 1 year ago)
sferik: Spent this morning fixing broken windows in RailsAdmin http://github.com/sferik/rails_admin/compare/ab6c598...0e3770f (about 1 year ago)
sferik: I'm a big believer that the broken windows theory applies to software development http://en.wikipedia.org/wiki/Broken_windows_theory (about 1 year ago)
sferik: I hope you idiots are happy with your piece of shit Android phones. http://www.apple.com/pr/library/2010/09/09statement.html (about 1 year ago)
sferik: Ping: kills MySpace dead. (about 1 year ago)
sferik: Crazy that iTunes Ping didn't leak a drop. (about 1 year ago)
sferik: The plot thickens http://twitpic.com/2k5lt2 (about 1 year ago)
sferik: 140 Proof Provides A Piece Of The Twitter Advertising Puzzle http://t.co/R2cUSDe via @techcrunch (about 1 year ago)
sferik: Try as you may http://www.thedoghousediaries.com/?p=1940 (about 1 year ago)
sferik: I know @SarahPalinUSA has a right to use Twitter, but should she? (over 1 year ago)
eos
end
end
context "with a screen name passed" do
before do
stub_get("/1/statuses/retweeted_by_user.json").
with(:query => {:screen_name => "sferik", :include_entities => "false"}).
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "should request the correct resource" do
@t.retweets("sferik")
a_get("/1/statuses/retweeted_by_user.json").
with(:query => {:screen_name => "sferik", :include_entities => "false"}).
should have_been_made
end
it "should have the correct output" do
@t.retweets("sferik")
$stdout.string.should == <<-eos.gsub(/^/, ' ' * 4)
sferik: Ruby is the best programming language for hiding the ugly bits. (about 1 year ago)
sferik: There are 1.3 billion people in China; when people say there are 1 billion they are rounding off the entire population of the United States. (about 1 year ago)
sferik: The new Windows Phone campaign is the best advertising from Microsoft since "Start Me Up" (1995). Great work by CP+B. http://t.co/tIzxopI (about 1 year ago)
sferik: Fear not to sow seeds because of the birds. http://twitpic.com/2wg621 (about 1 year ago)
sferik: Speaking of things that are maddening: the interview with the Wall Street guys on the most recent This American Life http://bit.ly/af9pSD (about 1 year ago)
sferik: Holy cow! RailsAdmin is up to 200 watchers (from 100 yesterday). http://github.com/sferik/rails_admin (about 1 year ago)
sferik: Kind of cool that Facebook acts as a mirror for open-source projects that they use or like http://mirror.facebook.net/ (about 1 year ago)
sferik: RailsAdmin already has 100 watchers, 12 forks, and 6 contributors in less than 2 months. Let's keep the momentum going! http://bit.ly/cCMMqD (about 1 year ago)
sferik: This week's This American Life is amazing. @JoeLipari is an American hero. http://bit.ly/d9RbnB (about 1 year ago)
sferik: RT @polyseme: OH: shofars should be called jewvuzelas. (about 1 year ago)
sferik: Spent this morning fixing broken windows in RailsAdmin http://github.com/sferik/rails_admin/compare/ab6c598...0e3770f (about 1 year ago)
sferik: I'm a big believer that the broken windows theory applies to software development http://en.wikipedia.org/wiki/Broken_windows_theory (about 1 year ago)
sferik: I hope you idiots are happy with your piece of shit Android phones. http://www.apple.com/pr/library/2010/09/09statement.html (about 1 year ago)
sferik: Ping: kills MySpace dead. (about 1 year ago)
sferik: Crazy that iTunes Ping didn't leak a drop. (about 1 year ago)
sferik: The plot thickens http://twitpic.com/2k5lt2 (about 1 year ago)
sferik: 140 Proof Provides A Piece Of The Twitter Advertising Puzzle http://t.co/R2cUSDe via @techcrunch (about 1 year ago)
sferik: Try as you may http://www.thedoghousediaries.com/?p=1940 (about 1 year ago)
sferik: I know @SarahPalinUSA has a right to use Twitter, but should she? (over 1 year ago)
eos
end
end
end
describe "#sent_messages" do
before do
stub_get("/1/direct_messages/sent.json").
with(:query => {:include_entities => "false"}).
to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "should request the correct resource" do
@t.sent_messages
a_get("/1/direct_messages/sent.json").
with(:query => {:include_entities => "false"}).
should have_been_made
end
it "should have the correct output" do
@t.sent_messages
$stdout.string.should == <<-eos.gsub(/^/, ' ' * 3)
hurrycane: Sounds good. Meeting Tuesday is fine. (about 1 year ago)
technoweenie: if you want to add me to your GroupMe group, my phone number is 415-312-2382 (about 1 year ago)
hurrycane: That's great news! Let's plan to chat around 8 AM tomorrow Pacific time. Does that work for you? (about 1 year ago)
hurrycane: I asked Yehuda about the stipend. I believe it has already been sent. Glad you're feeling better. (about 1 year ago)
hurrycane: Just checking in. How's everything going? (about 1 year ago)
hurrycane: Any luck completing graphs this weekend? There have been lots of commits to RailsAdmin since summer ended but none from you. How's it going? (about 1 year ago)
hurrycane: Not sure about the payment. Feel free to ask Leah or Yehuda directly. Think you'll be able to finish up your work on graphs this weekend? (about 1 year ago)
hurrycane: Looks good to me. I'm going to pull in the change now. My only concern is that we don't have any tests for auth. (about 1 year ago)
hurrycane: How are the graph enhancements coming? (about 1 year ago)
hurrycane: Changes pushed. You should pull and re-bundle when you have a minute. (about 1 year ago)
hurrycane: Glad to hear the new graphs are coming along. Can't wait to see them! (about 1 year ago)
hurrycane: I figured out what was wrong with the tests: I accidentally unbundled webrat. The problem had nothing to do with rspec-rails. (about 1 year ago)
hurrycane: After the upgrade 54/80 specs are failing. I'm working on fixing them now. (about 1 year ago)
hurrycane: a new version of rspec-rails just shipped with some nice features and fixes http://github.com/rspec/rspec-rails/blob/master/History.md (about 1 year ago)
hurrycane: How are the graphs coming? I'm really looking forward to seeing what you do with Raphaël. (about 1 year ago)
hurrycane: Awesome! Any luck duplicating the Gemfile.lock error with Ruby 1.9.2 final? (about 1 year ago)
hurrycane: I just committed a bunch of cleanup and fixes to RailsAdmin that touched many of files. Make sure you pull to avoid conflicts. (about 1 year ago)
hurrycane: Can you try upgrading to 1.9.2 final, re-installing Bundler 1.0.0.rc.6 (don't remove 1.0.0) and see if you can reproduce the problem? (about 1 year ago)
hurrycane: I'm trying to debug the issue you were having with the Bundler Gemfile.lock shortref. What version of Ruby and RubyGems are you running? (about 1 year ago)
hurrycane: Let's try to debug that problem during our session in 1.5 hours. In the mean time, try working on the graphs or internationalization. (about 1 year ago)
eos
end
end
describe "#stats" do
before do
stub_get("/1/users/show.json").
with(:query => {:screen_name => "sferik", :include_entities => "false"}).
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "should request the correct resource" do
@t.stats("sferik")
a_get("/1/users/show.json").
with(:query => {:screen_name => "sferik", :include_entities => "false"}).
should have_been_made
end
it "should have the correct output" do
@t.stats("sferik")
$stdout.string.should =~ /^Tweets: 3,479$/
$stdout.string.should =~ /^Following: 197$/
$stdout.string.should =~ /^Followers: 1,048$/
$stdout.string.should =~ /^Favorites: 1,040$/
$stdout.string.should =~ /^Listed: 41$/
end
end
describe "#status" do
before do
@t.options = @t.options.merge(:profile => fixture_path + "/.trc", :location => true)
stub_post("/1/statuses/update.json").
with(:body => {:status => "Testing", :lat => "37.76969909668", :long => "-122.39330291748", :include_entities => "false", :trim_user => "true"}).
to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
stub_request(:get, "http://checkip.dyndns.org/").
to_return(:body => fixture("checkip.html"), :headers => {:content_type => "text/html"})
stub_request(:get, "http://www.geoplugin.net/xml.gp?ip=50.131.22.169").
to_return(:body => fixture("xml.gp"), :headers => {:content_type => "application/xml"})
end
it "should request the correct resource" do
@t.status("Testing")
a_post("/1/statuses/update.json").
with(:body => {:status => "Testing", :lat => "37.76969909668", :long => "-122.39330291748", :include_entities => "false", :trim_user => "true"}).
should have_been_made
a_request(:get, "http://checkip.dyndns.org/").
should have_been_made
a_request(:get, "http://www.geoplugin.net/xml.gp?ip=50.131.22.169").
should have_been_made
end
it "should have the correct output" do
@t.status("Testing")
$stdout.string.should =~ /^Tweet created by @testcli \(about 1 year ago\)$/
end
end
describe "#suggest" do
before do
stub_get("/1/users/recommendations.json").
with(:query => {:limit => "1", :include_entities => "false"}).
to_return(:body => fixture("recommendations.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "should request the correct resource" do
@t.suggest
a_get("/1/users/recommendations.json").
with(:query => {:limit => "1", :include_entities => "false"}).
should have_been_made
end
it "should have the correct output" do
@t.suggest
$stdout.string.should =~ /^Try following @jtrupiano\.$/
end
end
describe "#timeline" do
context "without user" do
before do
stub_get("/1/statuses/home_timeline.json").
with(:query => {:include_entities => "false"}).
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "should request the correct resource" do
@t.timeline
a_get("/1/statuses/home_timeline.json").
with(:query => {:include_entities => "false"}).
should have_been_made
end
it "should have the correct output" do
@t.timeline
$stdout.string.should == <<-eos.gsub(/^/, ' ' * 4)
sferik: Ruby is the best programming language for hiding the ugly bits. (about 1 year ago)
sferik: There are 1.3 billion people in China; when people say there are 1 billion they are rounding off the entire population of the United States. (about 1 year ago)
sferik: The new Windows Phone campaign is the best advertising from Microsoft since "Start Me Up" (1995). Great work by CP+B. http://t.co/tIzxopI (about 1 year ago)
sferik: Fear not to sow seeds because of the birds. http://twitpic.com/2wg621 (about 1 year ago)
sferik: Speaking of things that are maddening: the interview with the Wall Street guys on the most recent This American Life http://bit.ly/af9pSD (about 1 year ago)
sferik: Holy cow! RailsAdmin is up to 200 watchers (from 100 yesterday). http://github.com/sferik/rails_admin (about 1 year ago)
sferik: Kind of cool that Facebook acts as a mirror for open-source projects that they use or like http://mirror.facebook.net/ (about 1 year ago)
sferik: RailsAdmin already has 100 watchers, 12 forks, and 6 contributors in less than 2 months. Let's keep the momentum going! http://bit.ly/cCMMqD (about 1 year ago)
sferik: This week's This American Life is amazing. @JoeLipari is an American hero. http://bit.ly/d9RbnB (about 1 year ago)
sferik: RT @polyseme: OH: shofars should be called jewvuzelas. (about 1 year ago)
sferik: Spent this morning fixing broken windows in RailsAdmin http://github.com/sferik/rails_admin/compare/ab6c598...0e3770f (about 1 year ago)
sferik: I'm a big believer that the broken windows theory applies to software development http://en.wikipedia.org/wiki/Broken_windows_theory (about 1 year ago)
sferik: I hope you idiots are happy with your piece of shit Android phones. http://www.apple.com/pr/library/2010/09/09statement.html (about 1 year ago)
sferik: Ping: kills MySpace dead. (about 1 year ago)
sferik: Crazy that iTunes Ping didn't leak a drop. (about 1 year ago)
sferik: The plot thickens http://twitpic.com/2k5lt2 (about 1 year ago)
sferik: 140 Proof Provides A Piece Of The Twitter Advertising Puzzle http://t.co/R2cUSDe via @techcrunch (about 1 year ago)
sferik: Try as you may http://www.thedoghousediaries.com/?p=1940 (about 1 year ago)
sferik: I know @SarahPalinUSA has a right to use Twitter, but should she? (over 1 year ago)
eos
end
end
context "with user" do
before do
stub_get("/1/statuses/user_timeline.json").
with(:query => {:screen_name => "sferik", :include_entities => "false"}).
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "should request the correct resource" do
@t.timeline("sferik")
a_get("/1/statuses/user_timeline.json").
with(:query => {:screen_name => "sferik", :include_entities => "false"}).
should have_been_made
end
it "should have the correct output" do
@t.timeline("sferik")
$stdout.string.should == <<-eos.gsub(/^/, ' ' * 4)
sferik: Ruby is the best programming language for hiding the ugly bits. (about 1 year ago)
sferik: There are 1.3 billion people in China; when people say there are 1 billion they are rounding off the entire population of the United States. (about 1 year ago)
sferik: The new Windows Phone campaign is the best advertising from Microsoft since "Start Me Up" (1995). Great work by CP+B. http://t.co/tIzxopI (about 1 year ago)
sferik: Fear not to sow seeds because of the birds. http://twitpic.com/2wg621 (about 1 year ago)
sferik: Speaking of things that are maddening: the interview with the Wall Street guys on the most recent This American Life http://bit.ly/af9pSD (about 1 year ago)
sferik: Holy cow! RailsAdmin is up to 200 watchers (from 100 yesterday). http://github.com/sferik/rails_admin (about 1 year ago)
sferik: Kind of cool that Facebook acts as a mirror for open-source projects that they use or like http://mirror.facebook.net/ (about 1 year ago)
sferik: RailsAdmin already has 100 watchers, 12 forks, and 6 contributors in less than 2 months. Let's keep the momentum going! http://bit.ly/cCMMqD (about 1 year ago)
sferik: This week's This American Life is amazing. @JoeLipari is an American hero. http://bit.ly/d9RbnB (about 1 year ago)
sferik: RT @polyseme: OH: shofars should be called jewvuzelas. (about 1 year ago)
sferik: Spent this morning fixing broken windows in RailsAdmin http://github.com/sferik/rails_admin/compare/ab6c598...0e3770f (about 1 year ago)
sferik: I'm a big believer that the broken windows theory applies to software development http://en.wikipedia.org/wiki/Broken_windows_theory (about 1 year ago)
sferik: I hope you idiots are happy with your piece of shit Android phones. http://www.apple.com/pr/library/2010/09/09statement.html (about 1 year ago)
sferik: Ping: kills MySpace dead. (about 1 year ago)
sferik: Crazy that iTunes Ping didn't leak a drop. (about 1 year ago)
sferik: The plot thickens http://twitpic.com/2k5lt2 (about 1 year ago)
sferik: 140 Proof Provides A Piece Of The Twitter Advertising Puzzle http://t.co/R2cUSDe via @techcrunch (about 1 year ago)
sferik: Try as you may http://www.thedoghousediaries.com/?p=1940 (about 1 year ago)
sferik: I know @SarahPalinUSA has a right to use Twitter, but should she? (over 1 year ago)
eos
end
end
end
describe "#version" do
it "should have the correct output" do
@t.version
$stdout.string.chomp.should == T::Version.to_s
end
end
describe "#whois" do
before do
stub_get("/1/users/show.json").
with(:query => {:screen_name => "sferik", :include_entities => "false"}).
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "should request the correct resource" do
@t.whois("sferik")
a_get("/1/users/show.json").
with(:query => {:screen_name => "sferik", :include_entities => "false"}).
should have_been_made
end
it "should have the correct output" do
@t.whois("sferik")
$stdout.string.should == <<-eos.gsub(/^ {8}/, '')
id: #7,505,382
Erik Michaels-Ober, since Jul 2007.
bio: A mind forever voyaging through strange seas of thought, alone.
location: San Francisco
web: https://github.com/sferik
eos
end
end
end