t 1.6.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,6 +16,7 @@ describe T::CLI do
16
16
  before :each do
17
17
  T::RCFile.instance.path = fixture_path + "/.trc"
18
18
  @cli = T::CLI.new
19
+ @cli.options = @cli.options.merge("color" => "always")
19
20
  @old_stderr = $stderr
20
21
  $stderr = StringIO.new
21
22
  @old_stdout = $stdout
@@ -46,7 +47,7 @@ testcli
46
47
  @cli.options = @cli.options.merge("profile" => project_path + "/tmp/authorize", "display-url" => true)
47
48
  stub_post("/oauth/request_token").to_return(:body => fixture("request_token"))
48
49
  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"})
50
+ stub_get("/1.1/account/verify_credentials.json").with(:query => {:include_entities => "false", :skip_status => "true"}).to_return(:body => fixture("sferik.json"))
50
51
  end
51
52
  it "requests the correct resource" do
52
53
  $stdout.should_receive(:print)
@@ -123,7 +124,7 @@ testcli
123
124
  describe "#block" do
124
125
  before do
125
126
  @cli.options = @cli.options.merge("profile" => fixture_path + "/.trc")
126
- 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"})
127
+ stub_post("/1.1/blocks/create.json").with(:body => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"))
127
128
  end
128
129
  it "requests the correct resource" do
129
130
  @cli.block("sferik")
@@ -136,7 +137,7 @@ testcli
136
137
  context "--id" do
137
138
  before do
138
139
  @cli.options = @cli.options.merge("id" => true)
139
- 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"})
140
+ stub_post("/1.1/blocks/create.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"))
140
141
  end
141
142
  it "requests the correct resource" do
142
143
  @cli.block("7505382")
@@ -147,8 +148,8 @@ testcli
147
148
 
148
149
  describe "#direct_messages" do
149
150
  before do
150
- 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"})
151
- 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"})
151
+ stub_get("/1.1/direct_messages.json").with(:query => {:count => "20"}).to_return(:body => fixture("direct_messages.json"))
152
+ stub_get("/1.1/direct_messages.json").with(:query => {:count => "10", "max_id" => "1624782205"}).to_return(:body => fixture("empty_array.json"))
152
153
  end
153
154
  it "requests the correct resource" do
154
155
  @cli.direct_messages
@@ -239,9 +240,9 @@ ID Posted at Screen name Text
239
240
  end
240
241
  context "--number" do
241
242
  before do
242
- 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"})
243
- stub_get("/1.1/direct_messages.json").with(:query => {:count => "200"}).to_return(:body => fixture("200_direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
244
- stub_get("/1.1/direct_messages.json").with(:query => {:count => "1", :max_id => "235851563443306495"}).to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
243
+ stub_get("/1.1/direct_messages.json").with(:query => {:count => "1"}).to_return(:body => fixture("direct_messages.json"))
244
+ stub_get("/1.1/direct_messages.json").with(:query => {:count => "200"}).to_return(:body => fixture("200_direct_messages.json"))
245
+ stub_get("/1.1/direct_messages.json").with(:query => {:count => "1", :max_id => "235851563443306495"}).to_return(:body => fixture("direct_messages.json"))
245
246
  end
246
247
  it "limits the number of results to 1" do
247
248
  @cli.options = @cli.options.merge("number" => 1)
@@ -305,8 +306,8 @@ ID Posted at Screen name Text
305
306
 
306
307
  describe "#direct_messages_sent" do
307
308
  before do
308
- 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"})
309
- 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"})
309
+ stub_get("/1.1/direct_messages/sent.json").with(:query => {:count => "20"}).to_return(:body => fixture("direct_messages.json"))
310
+ stub_get("/1.1/direct_messages/sent.json").with(:query => {:count => "10", "max_id" => "1624782205"}).to_return(:body => fixture("empty_array.json"))
310
311
  end
311
312
  it "requests the correct resource" do
312
313
  @cli.direct_messages_sent
@@ -397,9 +398,9 @@ ID Posted at Screen name Text
397
398
  end
398
399
  context "--number" do
399
400
  before do
400
- 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"})
401
- stub_get("/1.1/direct_messages/sent.json").with(:query => {:count => "200"}).to_return(:body => fixture("200_direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
402
- stub_get("/1.1/direct_messages/sent.json").with(:query => {:count => "1", :max_id => "235851563443306495"}).to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
401
+ stub_get("/1.1/direct_messages/sent.json").with(:query => {:count => "1"}).to_return(:body => fixture("direct_messages.json"))
402
+ stub_get("/1.1/direct_messages/sent.json").with(:query => {:count => "200"}).to_return(:body => fixture("200_direct_messages.json"))
403
+ stub_get("/1.1/direct_messages/sent.json").with(:query => {:count => "1", :max_id => "235851563443306495"}).to_return(:body => fixture("direct_messages.json"))
403
404
  end
404
405
  it "limits the number of results 1" do
405
406
  @cli.options = @cli.options.merge("number" => 1)
@@ -463,14 +464,16 @@ ID Posted at Screen name Text
463
464
 
464
465
  describe "#groupies" do
465
466
  before do
466
- 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"})
467
- 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"})
468
- 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"})
467
+ stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"))
468
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("followers_ids.json"))
469
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"))
470
+ stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "213747670,428004849"}).to_return(:body => fixture("users.json"))
469
471
  end
470
472
  it "requests the correct resource" do
471
473
  @cli.groupies
472
- expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
473
- expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
474
+ expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made
475
+ expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
476
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
474
477
  expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "213747670,428004849"})).to have_been_made
475
478
  end
476
479
  it "has the correct output" do
@@ -586,8 +589,8 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
586
589
  end
587
590
  context "with a user passed" do
588
591
  before do
589
- 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"})
590
- 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"})
592
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("followers_ids.json"))
593
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"))
591
594
  end
592
595
  it "requests the correct resource" do
593
596
  @cli.groupies("sferik")
@@ -598,8 +601,8 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
598
601
  context "--id" do
599
602
  before do
600
603
  @cli.options = @cli.options.merge("id" => true)
601
- 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"})
602
- 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"})
604
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("followers_ids.json"))
605
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("friends_ids.json"))
603
606
  end
604
607
  it "requests the correct resource" do
605
608
  @cli.groupies("7505382")
@@ -614,7 +617,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
614
617
  describe "#dm" do
615
618
  before do
616
619
  @cli.options = @cli.options.merge("profile" => fixture_path + "/.trc")
617
- 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"})
620
+ 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"))
618
621
  end
619
622
  it "requests the correct resource" do
620
623
  @cli.dm("pengwynn", "Creating a fixture for the Twitter gem")
@@ -627,7 +630,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
627
630
  context "--id" do
628
631
  before do
629
632
  @cli.options = @cli.options.merge("id" => true)
630
- 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"})
633
+ 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"))
631
634
  end
632
635
  it "requests the correct resource" do
633
636
  @cli.dm("14100886", "Creating a fixture for the Twitter gem")
@@ -639,7 +642,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
639
642
  describe "#does_contain" do
640
643
  before do
641
644
  @cli.options = @cli.options.merge("profile" => fixture_path + "/.trc")
642
- 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"})
645
+ 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"))
643
646
  end
644
647
  it "requests the correct resource" do
645
648
  @cli.does_contain("presidents")
@@ -652,8 +655,8 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
652
655
  context "--id" do
653
656
  before do
654
657
  @cli.options = @cli.options.merge("id" => true)
655
- 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"})
656
- 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"})
658
+ stub_get("/1.1/users/show.json").with(:query => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"))
659
+ 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"))
657
660
  end
658
661
  it "requests the correct resource" do
659
662
  @cli.does_contain("presidents", "7505382")
@@ -669,8 +672,8 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
669
672
  context "--id" do
670
673
  before do
671
674
  @cli.options = @cli.options.merge("id" => true)
672
- 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"})
673
- 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"})
675
+ stub_get("/1.1/users/show.json").with(:query => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"))
676
+ stub_get("/1.1/lists/members/show.json").with(:query => {:owner_id => "7505382", :screen_name => "sferik", :slug => "presidents"}).to_return(:body => fixture("list.json"))
674
677
  end
675
678
  it "requests the correct resource" do
676
679
  @cli.does_contain("7505382/presidents", "7505382")
@@ -687,7 +690,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
687
690
  end
688
691
  context "false" do
689
692
  before do
690
- 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"})
693
+ 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)
691
694
  end
692
695
  it "exits" do
693
696
  expect do
@@ -701,7 +704,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
701
704
  describe "#does_follow" do
702
705
  before do
703
706
  @cli.options = @cli.options.merge("profile" => fixture_path + "/.trc")
704
- 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"})
707
+ stub_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "ev", :target_screen_name => "testcli"}).to_return(:body => fixture("following.json"))
705
708
  end
706
709
  it "requests the correct resource" do
707
710
  @cli.does_follow("ev")
@@ -714,8 +717,8 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
714
717
  context "--id" do
715
718
  before do
716
719
  @cli.options = @cli.options.merge("id" => true)
717
- 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"})
718
- 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"})
720
+ stub_get("/1.1/users/show.json").with(:query => {:user_id => "20"}).to_return(:body => fixture("sferik.json"))
721
+ stub_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "sferik", :target_screen_name => "testcli"}).to_return(:body => fixture("following.json"))
719
722
  end
720
723
  it "requests the correct resource" do
721
724
  @cli.does_follow("20")
@@ -729,7 +732,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
729
732
  end
730
733
  context "with a user passed" do
731
734
  before do
732
- stub_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "ev", :target_screen_name => "sferik"}).to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
735
+ stub_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "ev", :target_screen_name => "sferik"}).to_return(:body => fixture("following.json"))
733
736
  end
734
737
  it "requests the correct resource" do
735
738
  @cli.does_follow("ev", "sferik")
@@ -742,9 +745,9 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
742
745
  context "--id" do
743
746
  before do
744
747
  @cli.options = @cli.options.merge("id" => true)
745
- 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"})
746
- 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"})
747
- 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"})
748
+ stub_get("/1.1/users/show.json").with(:query => {:user_id => "20"}).to_return(:body => fixture("sferik.json"))
749
+ stub_get("/1.1/users/show.json").with(:query => {:user_id => "428004849"}).to_return(:body => fixture("sferik.json"))
750
+ stub_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "sferik", :target_screen_name => "sferik"}).to_return(:body => fixture("following.json"))
748
751
  end
749
752
  it "requests the correct resource" do
750
753
  @cli.does_follow("20", "428004849")
@@ -760,7 +763,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
760
763
  end
761
764
  context "false" do
762
765
  before do
763
- 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"})
766
+ stub_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "ev", :target_screen_name => "testcli"}).to_return(:body => fixture("not_following.json"))
764
767
  end
765
768
  it "exits" do
766
769
  expect do
@@ -774,7 +777,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
774
777
  describe "#favorite" do
775
778
  before do
776
779
  @cli.options = @cli.options.merge("profile" => fixture_path + "/.trc")
777
- 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"})
780
+ stub_post("/1.1/favorites/create.json").with(:body => {:id => "26755176471724032"}).to_return(:body => fixture("status.json"))
778
781
  end
779
782
  it "requests the correct resource" do
780
783
  @cli.favorite("26755176471724032")
@@ -788,7 +791,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
788
791
 
789
792
  describe "#favorites" do
790
793
  before do
791
- 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"})
794
+ stub_get("/1.1/favorites/list.json").with(:query => {:count => "20"}).to_return(:body => fixture("statuses.json"))
792
795
  end
793
796
  it "requests the correct resource" do
794
797
  @cli.favorites
@@ -969,9 +972,9 @@ ID Posted at Screen name Text
969
972
  end
970
973
  context "--number" do
971
974
  before do
972
- 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"})
973
- stub_get("/1.1/favorites/list.json").with(:query => {:count => "200"}).to_return(:body => fixture("200_statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
974
- stub_get("/1.1/favorites/list.json").with(:query => {:count => "1", :max_id => "265500541700956160"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
975
+ stub_get("/1.1/favorites/list.json").with(:query => {:count => "1"}).to_return(:body => fixture("statuses.json"))
976
+ stub_get("/1.1/favorites/list.json").with(:query => {:count => "200"}).to_return(:body => fixture("200_statuses.json"))
977
+ stub_get("/1.1/favorites/list.json").with(:query => {:count => "1", :max_id => "265500541700956160"}).to_return(:body => fixture("statuses.json"))
975
978
  end
976
979
  it "limits the number of results to 1" do
977
980
  @cli.options = @cli.options.merge("number" => 1)
@@ -987,7 +990,7 @@ ID Posted at Screen name Text
987
990
  end
988
991
  context "with a user passed" do
989
992
  before do
990
- 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"})
993
+ stub_get("/1.1/favorites/list.json").with(:query => {:count => "20", :screen_name => "sferik"}).to_return(:body => fixture("statuses.json"))
991
994
  end
992
995
  it "requests the correct resource" do
993
996
  @cli.favorites("sferik")
@@ -996,7 +999,7 @@ ID Posted at Screen name Text
996
999
  context "--id" do
997
1000
  before do
998
1001
  @cli.options = @cli.options.merge("id" => true)
999
- 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"})
1002
+ stub_get("/1.1/favorites/list.json").with(:query => {:user_id => "7505382", :count => "20"}).to_return(:body => fixture("statuses.json"))
1000
1003
  end
1001
1004
  it "requests the correct resource" do
1002
1005
  @cli.favorites("7505382")
@@ -1012,13 +1015,15 @@ ID Posted at Screen name Text
1012
1015
  end
1013
1016
  context "one user" do
1014
1017
  before do
1015
- 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"})
1016
- 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"})
1017
- 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"})
1018
+ stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"))
1019
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"))
1020
+ stub_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"}).to_return(:body => fixture("users.json"))
1021
+ stub_post("/1.1/friendships/create.json").with(:body => {:user_id => "14100886"}).to_return(:body => fixture("sferik.json"))
1018
1022
  end
1019
1023
  it "requests the correct resource" do
1020
1024
  @cli.follow("sferik", "pengwynn")
1021
- expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
1025
+ expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made
1026
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
1022
1027
  expect(a_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"})).to have_been_made
1023
1028
  expect(a_post("/1.1/friendships/create.json").with(:body => {:user_id => "14100886"})).to have_been_made
1024
1029
  end
@@ -1029,26 +1034,26 @@ ID Posted at Screen name Text
1029
1034
  context "--id" do
1030
1035
  before do
1031
1036
  @cli.options = @cli.options.merge("id" => true)
1032
- 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"})
1033
- 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"})
1034
- 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"})
1037
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"))
1038
+ stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382,14100886"}).to_return(:body => fixture("users.json"))
1039
+ stub_post("/1.1/friendships/create.json").with(:body => {:user_id => "14100886"}).to_return(:body => fixture("sferik.json"))
1035
1040
  end
1036
1041
  it "requests the correct resource" do
1037
1042
  @cli.follow("7505382", "14100886")
1038
- expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
1043
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
1039
1044
  expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382,14100886"})).to have_been_made
1040
1045
  expect(a_post("/1.1/friendships/create.json").with(:body => {:user_id => "14100886"})).to have_been_made
1041
1046
  end
1042
1047
  end
1043
1048
  context "Twitter is down" do
1044
1049
  it "retries 3 times and then raise an error" do
1045
- 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"})
1046
- 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"})
1050
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"))
1051
+ stub_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"}).to_return(:body => fixture("users.json"))
1047
1052
  stub_post("/1.1/friendships/create.json").with(:body => {:user_id => "14100886"}).to_return(:status => 502)
1048
1053
  expect do
1049
1054
  @cli.follow("sferik", "pengwynn")
1050
1055
  end.to raise_error("Twitter is down or being upgraded.")
1051
- expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"})).to have_been_made.times(3)
1056
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made.times(3)
1052
1057
  expect(a_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"})).to have_been_made.times(3)
1053
1058
  expect(a_post("/1.1/friendships/create.json").with(:body => {:user_id => "14100886"})).to have_been_made.times(3)
1054
1059
  end
@@ -1058,12 +1063,14 @@ ID Posted at Screen name Text
1058
1063
 
1059
1064
  describe "#followings" do
1060
1065
  before do
1061
- 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"})
1062
- 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"})
1066
+ stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"))
1067
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"))
1068
+ stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("users.json"))
1063
1069
  end
1064
1070
  it "requests the correct resource" do
1065
1071
  @cli.followings
1066
- expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
1072
+ expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made
1073
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
1067
1074
  expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"})).to have_been_made
1068
1075
  end
1069
1076
  it "has the correct output" do
@@ -1179,7 +1186,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1179
1186
  end
1180
1187
  context "with a user passed" do
1181
1188
  before do
1182
- 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"})
1189
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"))
1183
1190
  end
1184
1191
  it "requests the correct resource" do
1185
1192
  @cli.followings("sferik")
@@ -1190,7 +1197,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1190
1197
  context "--id" do
1191
1198
  before do
1192
1199
  @cli.options = @cli.options.merge("id" => true)
1193
- 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"})
1200
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("friends_ids.json"))
1194
1201
  end
1195
1202
  it "requests the correct resource" do
1196
1203
  @cli.followings("7505382")
@@ -1202,12 +1209,14 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1202
1209
 
1203
1210
  describe "#followers" do
1204
1211
  before do
1205
- 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"})
1206
- 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"})
1212
+ stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"))
1213
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"))
1214
+ stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("users.json"))
1207
1215
  end
1208
1216
  it "requests the correct resource" do
1209
1217
  @cli.followers
1210
- expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
1218
+ expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made
1219
+ expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
1211
1220
  expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"})).to have_been_made
1212
1221
  end
1213
1222
  it "has the correct output" do
@@ -1323,8 +1332,8 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1323
1332
  end
1324
1333
  context "with a user passed" do
1325
1334
  before do
1326
- 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"})
1327
- 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"})
1335
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"))
1336
+ stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "213747670,428004849"}).to_return(:body => fixture("users.json"))
1328
1337
  end
1329
1338
  it "requests the correct resource" do
1330
1339
  @cli.followers("sferik")
@@ -1334,7 +1343,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1334
1343
  context "--id" do
1335
1344
  before do
1336
1345
  @cli.options = @cli.options.merge("id" => true)
1337
- 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"})
1346
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("friends_ids.json"))
1338
1347
  end
1339
1348
  it "requests the correct resource" do
1340
1349
  @cli.followers("7505382")
@@ -1347,14 +1356,16 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1347
1356
 
1348
1357
  describe "#friends" do
1349
1358
  before do
1350
- 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"})
1351
- 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"})
1352
- 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"})
1359
+ stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"))
1360
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"))
1361
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"))
1362
+ stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("users.json"))
1353
1363
  end
1354
1364
  it "requests the correct resource" do
1355
1365
  @cli.friends
1356
- expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
1357
- expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
1366
+ expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made
1367
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
1368
+ expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
1358
1369
  expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"})).to have_been_made
1359
1370
  end
1360
1371
  it "has the correct output" do
@@ -1470,8 +1481,8 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1470
1481
  end
1471
1482
  context "with a user passed" do
1472
1483
  before do
1473
- 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"})
1474
- 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"})
1484
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"))
1485
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"))
1475
1486
  end
1476
1487
  it "requests the correct resource" do
1477
1488
  @cli.friends("sferik")
@@ -1482,8 +1493,8 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1482
1493
  context "--id" do
1483
1494
  before do
1484
1495
  @cli.options = @cli.options.merge("id" => true)
1485
- 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"})
1486
- 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"})
1496
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("friends_ids.json"))
1497
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("friends_ids.json"))
1487
1498
  end
1488
1499
  it "requests the correct resource" do
1489
1500
  @cli.friends("7505382")
@@ -1497,14 +1508,16 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1497
1508
 
1498
1509
  describe "#leaders" do
1499
1510
  before do
1500
- 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"})
1501
- 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"})
1502
- 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"})
1511
+ stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"))
1512
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"))
1513
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("followers_ids.json"))
1514
+ stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("users.json"))
1503
1515
  end
1504
1516
  it "requests the correct resource" do
1505
1517
  @cli.leaders
1506
- expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
1507
- expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
1518
+ expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made
1519
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
1520
+ expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
1508
1521
  expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"})).to have_been_made
1509
1522
  end
1510
1523
  it "has the correct output" do
@@ -1620,8 +1633,8 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1620
1633
  end
1621
1634
  context "with a user passed" do
1622
1635
  before do
1623
- 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"})
1624
- 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"})
1636
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"))
1637
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("followers_ids.json"))
1625
1638
  end
1626
1639
  it "requests the correct resource" do
1627
1640
  @cli.leaders("sferik")
@@ -1632,8 +1645,8 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1632
1645
  context "--id" do
1633
1646
  before do
1634
1647
  @cli.options = @cli.options.merge("id" => true)
1635
- 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"})
1636
- 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"})
1648
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("friends_ids.json"))
1649
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("followers_ids.json"))
1637
1650
  end
1638
1651
  it "requests the correct resource" do
1639
1652
  @cli.leaders("7505382")
@@ -1647,7 +1660,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1647
1660
 
1648
1661
  describe "#lists" do
1649
1662
  before do
1650
- stub_get("/1.1/lists/list.json").to_return(:body => fixture("lists.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1663
+ stub_get("/1.1/lists/list.json").to_return(:body => fixture("lists.json"))
1651
1664
  end
1652
1665
  it "requests the correct resource" do
1653
1666
  @cli.lists
@@ -1741,7 +1754,7 @@ ID Created at Screen name Slug Members Subscribers Mode ...
1741
1754
  end
1742
1755
  context "with a user passed" do
1743
1756
  before do
1744
- 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"})
1757
+ stub_get("/1.1/lists/list.json").with(:query => {:screen_name => "sferik"}).to_return(:body => fixture("lists.json"))
1745
1758
  end
1746
1759
  it "requests the correct resource" do
1747
1760
  @cli.lists("sferik")
@@ -1750,7 +1763,7 @@ ID Created at Screen name Slug Members Subscribers Mode ...
1750
1763
  context "--id" do
1751
1764
  before do
1752
1765
  @cli.options = @cli.options.merge("id" => true)
1753
- 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"})
1766
+ stub_get("/1.1/lists/list.json").with(:query => {:user_id => "7505382"}).to_return(:body => fixture("lists.json"))
1754
1767
  end
1755
1768
  it "requests the correct resource" do
1756
1769
  @cli.lists("7505382")
@@ -1762,7 +1775,7 @@ ID Created at Screen name Slug Members Subscribers Mode ...
1762
1775
 
1763
1776
  describe "#mentions" do
1764
1777
  before do
1765
- 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"})
1778
+ stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "20"}).to_return(:body => fixture("statuses.json"))
1766
1779
  end
1767
1780
  it "requests the correct resource" do
1768
1781
  @cli.mentions
@@ -1943,9 +1956,9 @@ ID Posted at Screen name Text
1943
1956
  end
1944
1957
  context "--number" do
1945
1958
  before do
1946
- 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"})
1947
- stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "200"}).to_return(:body => fixture("200_statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1948
- stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "1", :max_id => "265500541700956160"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
1959
+ stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "1"}).to_return(:body => fixture("statuses.json"))
1960
+ stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "200"}).to_return(:body => fixture("200_statuses.json"))
1961
+ stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "1", :max_id => "265500541700956160"}).to_return(:body => fixture("statuses.json"))
1949
1962
  end
1950
1963
  it "limits the number of results to 1" do
1951
1964
  @cli.options = @cli.options.merge("number" => 1)
@@ -1973,7 +1986,7 @@ ID Posted at Screen name Text
1973
1986
  context "--id" do
1974
1987
  before do
1975
1988
  @cli.options = @cli.options.merge("id" => true)
1976
- 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"})
1989
+ stub_get("/1.1/users/show.json").with(:query => {:user_id => "420"}).to_return(:body => fixture("sferik.json"))
1977
1990
  end
1978
1991
  it "requests the correct resource" do
1979
1992
  @cli.open("420")
@@ -1983,7 +1996,7 @@ ID Posted at Screen name Text
1983
1996
  context "--status" do
1984
1997
  before do
1985
1998
  @cli.options = @cli.options.merge("status" => true)
1986
- 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"})
1999
+ stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status.json"))
1987
2000
  end
1988
2001
  it "requests the correct resource" do
1989
2002
  @cli.open("55709764298092545")
@@ -2000,8 +2013,8 @@ ID Posted at Screen name Text
2000
2013
  describe "#reply" do
2001
2014
  before do
2002
2015
  @cli.options = @cli.options.merge("profile" => fixture_path + "/.trc", "location" => true)
2003
- stub_get("/1.1/statuses/show/263813522369159169.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_with_mention.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2004
- stub_post("/1.1/statuses/update.json").with(:body => {:in_reply_to_status_id => "263813522369159169", :status => "@joshfrench Testing", :lat => "37.76969909668", :long => "-122.39330291748", :trim_user => "true"}).to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2016
+ stub_get("/1.1/statuses/show/263813522369159169.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_with_mention.json"))
2017
+ stub_post("/1.1/statuses/update.json").with(:body => {:in_reply_to_status_id => "263813522369159169", :status => "@joshfrench Testing", :lat => "37.76969909668", :long => "-122.39330291748", :trim_user => "true"}).to_return(:body => fixture("status.json"))
2005
2018
  stub_request(:get, "http://checkip.dyndns.org/").to_return(:body => fixture("checkip.html"), :headers => {:content_type => "text/html"})
2006
2019
  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"})
2007
2020
  end
@@ -2019,7 +2032,7 @@ ID Posted at Screen name Text
2019
2032
  context "--all" do
2020
2033
  before do
2021
2034
  @cli.options = @cli.options.merge("all" => true)
2022
- stub_post("/1.1/statuses/update.json").with(:body => {:in_reply_to_status_id => "263813522369159169", :status => "@joshfrench @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"})
2035
+ stub_post("/1.1/statuses/update.json").with(:body => {:in_reply_to_status_id => "263813522369159169", :status => "@joshfrench @sferik Testing", :lat => "37.76969909668", :long => "-122.39330291748", :trim_user => "true"}).to_return(:body => fixture("status.json"))
2023
2036
  end
2024
2037
  it "requests the correct resource" do
2025
2038
  @cli.reply("263813522369159169", "Testing")
@@ -2038,7 +2051,7 @@ ID Posted at Screen name Text
2038
2051
  describe "#report_spam" do
2039
2052
  before do
2040
2053
  @cli.options = @cli.options.merge("profile" => fixture_path + "/.trc")
2041
- stub_post("/1.1/users/report_spam.json").with(:body => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2054
+ stub_post("/1.1/users/report_spam.json").with(:body => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"))
2042
2055
  end
2043
2056
  it "requests the correct resource" do
2044
2057
  @cli.report_spam("sferik")
@@ -2051,7 +2064,7 @@ ID Posted at Screen name Text
2051
2064
  context "--id" do
2052
2065
  before do
2053
2066
  @cli.options = @cli.options.merge("id" => true)
2054
- stub_post("/1.1/users/report_spam.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2067
+ stub_post("/1.1/users/report_spam.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"))
2055
2068
  end
2056
2069
  it "requests the correct resource" do
2057
2070
  @cli.report_spam("7505382")
@@ -2063,7 +2076,7 @@ ID Posted at Screen name Text
2063
2076
  describe "#retweet" do
2064
2077
  before do
2065
2078
  @cli.options = @cli.options.merge("profile" => fixture_path + "/.trc")
2066
- stub_post("/1.1/statuses/retweet/26755176471724032.json").to_return(:body => fixture("retweet.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2079
+ stub_post("/1.1/statuses/retweet/26755176471724032.json").to_return(:body => fixture("retweet.json"))
2067
2080
  end
2068
2081
  it "requests the correct resource" do
2069
2082
  @cli.retweet("26755176471724032")
@@ -2077,8 +2090,8 @@ ID Posted at Screen name Text
2077
2090
 
2078
2091
  describe "#retweets" do
2079
2092
  before do
2080
- 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"})
2081
- 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"})
2093
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true"}).to_return(:body => fixture("statuses.json"))
2094
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :max_id => "244102729860009983"}).to_return(:body => fixture("statuses.json"))
2082
2095
  end
2083
2096
  context "without arguments" do
2084
2097
  it "requests the correct resource" do
@@ -2267,8 +2280,8 @@ ID Posted at Screen name Text
2267
2280
  end
2268
2281
  context "--number" do
2269
2282
  before do
2270
- 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"})
2271
- 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"})
2283
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true"}).to_return(:body => fixture("statuses.json"))
2284
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :max_id => "244107823733174271"}).to_return(:body => fixture("statuses.json"))
2272
2285
  end
2273
2286
  it "limits the number of results to 1" do
2274
2287
  @cli.options = @cli.options.merge("number" => 1)
@@ -2284,8 +2297,8 @@ ID Posted at Screen name Text
2284
2297
  end
2285
2298
  context "with a user passed" do
2286
2299
  before do
2287
- 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"})
2288
- 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"})
2300
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik"}).to_return(:body => fixture("statuses.json"))
2301
+ 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"))
2289
2302
  end
2290
2303
  it "requests the correct resource" do
2291
2304
  @cli.retweets("sferik")
@@ -2295,8 +2308,8 @@ ID Posted at Screen name Text
2295
2308
  context "--id" do
2296
2309
  before do
2297
2310
  @cli.options = @cli.options.merge("id" => true)
2298
- 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"})
2299
- 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"})
2311
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :user_id => "7505382"}).to_return(:body => fixture("statuses.json"))
2312
+ 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"))
2300
2313
  end
2301
2314
  it "requests the correct resource" do
2302
2315
  @cli.retweets("7505382")
@@ -2327,8 +2340,8 @@ ID Posted at Screen name Text
2327
2340
 
2328
2341
  describe "#status" do
2329
2342
  before do
2330
- 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"})
2331
- stub_get("/i/statuses/55709764298092545/activity/summary.json").to_return(:body => fixture("activity_summary.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2343
+ stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status.json"))
2344
+ stub_get("/i/statuses/55709764298092545/activity/summary.json").to_return(:body => fixture("activity_summary.json"))
2332
2345
  end
2333
2346
  it "requests the correct resources" do
2334
2347
  @cli.status("55709764298092545")
@@ -2363,7 +2376,7 @@ ID,Posted at,Screen name,Text,Retweets,Favorites,Replies,Source,Location
2363
2376
  end
2364
2377
  context "with no street address" do
2365
2378
  before do
2366
- stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_street_address.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2379
+ stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_street_address.json"))
2367
2380
  end
2368
2381
  it "has the correct output" do
2369
2382
  @cli.status("55709764298092545")
@@ -2382,7 +2395,7 @@ Location Blowfish Sushi To Die For, San Francisco, California, United States
2382
2395
  end
2383
2396
  context "with no locality" do
2384
2397
  before do
2385
- stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_locality.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2398
+ stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_locality.json"))
2386
2399
  end
2387
2400
  it "has the correct output" do
2388
2401
  @cli.status("55709764298092545")
@@ -2401,7 +2414,7 @@ Location Blowfish Sushi To Die For, San Francisco, California, United States
2401
2414
  end
2402
2415
  context "with no attributes" do
2403
2416
  before do
2404
- stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_attributes.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2417
+ stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_attributes.json"))
2405
2418
  end
2406
2419
  it "has the correct output" do
2407
2420
  @cli.status("55709764298092545")
@@ -2420,7 +2433,7 @@ Location Blowfish Sushi To Die For, San Francisco, United States
2420
2433
  end
2421
2434
  context "with no country" do
2422
2435
  before do
2423
- stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_country.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2436
+ stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_country.json"))
2424
2437
  end
2425
2438
  it "has the correct output" do
2426
2439
  @cli.status("55709764298092545")
@@ -2439,7 +2452,7 @@ Location Blowfish Sushi To Die For, San Francisco
2439
2452
  end
2440
2453
  context "with no full name" do
2441
2454
  before do
2442
- stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_full_name.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2455
+ stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_full_name.json"))
2443
2456
  end
2444
2457
  it "has the correct output" do
2445
2458
  @cli.status("55709764298092545")
@@ -2458,7 +2471,7 @@ Location Blowfish Sushi To Die For
2458
2471
  end
2459
2472
  context "with no place" do
2460
2473
  before do
2461
- stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_place.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2474
+ stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_place.json"))
2462
2475
  stub_request(:get, "http://maps.google.com/maps/geo").with(:query => hash_including({:key => "REPLACE_WITH_YOUR_GOOGLE_KEY", :oe => "utf-8", :output => "xml"})).to_return(:body => fixture("geo.kml"), :headers => {:content_type => "text/xml; charset=UTF-8"})
2463
2476
  end
2464
2477
  it "has the correct output" do
@@ -2477,7 +2490,7 @@ Location San Francisco, CA, USA
2477
2490
  end
2478
2491
  context "with no city" do
2479
2492
  before do
2480
- stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_place.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2493
+ stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_place.json"))
2481
2494
  stub_request(:get, "http://maps.google.com/maps/geo").with(:query => hash_including({:key => "REPLACE_WITH_YOUR_GOOGLE_KEY", :oe => "utf-8", :output => "xml"})).to_return(:body => fixture("geo_no_city.kml"), :headers => {:content_type => "text/xml; charset=UTF-8"})
2482
2495
  end
2483
2496
  it "has the correct output" do
@@ -2497,7 +2510,7 @@ Location CA, USA
2497
2510
  end
2498
2511
  context "with no state" do
2499
2512
  before do
2500
- stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_place.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2513
+ stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_place.json"))
2501
2514
  stub_request(:get, "http://maps.google.com/maps/geo").with(:query => hash_including({:key => "REPLACE_WITH_YOUR_GOOGLE_KEY", :oe => "utf-8", :output => "xml"})).to_return(:body => fixture("geo_no_state.kml"), :headers => {:content_type => "text/xml; charset=UTF-8"})
2502
2515
  end
2503
2516
  it "has the correct output" do
@@ -2532,7 +2545,7 @@ ID Posted at Screen name Text ...
2532
2545
 
2533
2546
  describe "#timeline" do
2534
2547
  before do
2535
- 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"})
2548
+ stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "20"}).to_return(:body => fixture("statuses.json"))
2536
2549
  end
2537
2550
  context "without user" do
2538
2551
  it "requests the correct resource" do
@@ -2654,7 +2667,7 @@ ID,Posted at,Screen name,Text
2654
2667
  context "--exclude=replies" do
2655
2668
  before do
2656
2669
  @cli.options = @cli.options.merge("exclude" => "replies")
2657
- stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "20", :exclude_replies => "true"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2670
+ stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "20", :exclude_replies => "true"}).to_return(:body => fixture("statuses.json"))
2658
2671
  end
2659
2672
  it "excludes replies" do
2660
2673
  @cli.timeline
@@ -2664,7 +2677,7 @@ ID,Posted at,Screen name,Text
2664
2677
  context "--exclude=retweets" do
2665
2678
  before do
2666
2679
  @cli.options = @cli.options.merge("exclude" => "retweets")
2667
- stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "20", :include_rts => "false"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2680
+ stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "20", :include_rts => "false"}).to_return(:body => fixture("statuses.json"))
2668
2681
  end
2669
2682
  it "excludes retweets" do
2670
2683
  @cli.timeline
@@ -2735,9 +2748,9 @@ ID Posted at Screen name Text
2735
2748
  end
2736
2749
  context "--number" do
2737
2750
  before do
2738
- 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"})
2739
- stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200"}).to_return(:body => fixture("200_statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2740
- stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "1", :max_id => "265500541700956160"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2751
+ stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "1"}).to_return(:body => fixture("statuses.json"))
2752
+ stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200"}).to_return(:body => fixture("200_statuses.json"))
2753
+ stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "1", :max_id => "265500541700956160"}).to_return(:body => fixture("statuses.json"))
2741
2754
  end
2742
2755
  it "limits the number of results to 1" do
2743
2756
  @cli.options = @cli.options.merge("number" => 1)
@@ -2751,9 +2764,19 @@ ID Posted at Screen name Text
2751
2764
  expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "1", :max_id => "265500541700956160"})).to have_been_made
2752
2765
  end
2753
2766
  end
2767
+ context "--since-id" do
2768
+ before do
2769
+ @cli.options = @cli.options.merge("since_id" => 244104558433951744)
2770
+ stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "20", :since_id => "244104558433951744"}).to_return(:body => fixture("statuses.json"))
2771
+ end
2772
+ it "requests the correct resource" do
2773
+ @cli.timeline
2774
+ expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "20", :since_id => "244104558433951744"})).to have_been_made
2775
+ end
2776
+ end
2754
2777
  context "with a user passed" do
2755
2778
  before do
2756
- 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"})
2779
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "20", :screen_name => "sferik"}).to_return(:body => fixture("statuses.json"))
2757
2780
  end
2758
2781
  it "requests the correct resource" do
2759
2782
  @cli.timeline("sferik")
@@ -2762,7 +2785,7 @@ ID Posted at Screen name Text
2762
2785
  context "--id" do
2763
2786
  before do
2764
2787
  @cli.options = @cli.options.merge("id" => true)
2765
- 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"})
2788
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "20", :user_id => "7505382"}).to_return(:body => fixture("statuses.json"))
2766
2789
  end
2767
2790
  it "requests the correct resource" do
2768
2791
  @cli.timeline("7505382")
@@ -2771,9 +2794,9 @@ ID Posted at Screen name Text
2771
2794
  end
2772
2795
  context "--number" do
2773
2796
  before do
2774
- 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"})
2775
- stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :screen_name => "sferik"}).to_return(:body => fixture("200_statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2776
- stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "1", :screen_name => "sferik", :max_id => "265500541700956160"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2797
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "1", :screen_name => "sferik"}).to_return(:body => fixture("statuses.json"))
2798
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :screen_name => "sferik"}).to_return(:body => fixture("200_statuses.json"))
2799
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "1", :screen_name => "sferik", :max_id => "265500541700956160"}).to_return(:body => fixture("statuses.json"))
2777
2800
  end
2778
2801
  it "limits the number of results to 1" do
2779
2802
  @cli.options = @cli.options.merge("number" => 1)
@@ -2787,12 +2810,22 @@ ID Posted at Screen name Text
2787
2810
  expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "1", :screen_name => "sferik", :max_id => "265500541700956160"})).to have_been_made
2788
2811
  end
2789
2812
  end
2813
+ context "--since-id" do
2814
+ before do
2815
+ @cli.options = @cli.options.merge("since_id" => 244104558433951744)
2816
+ stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "20", :screen_name => "sferik", :since_id => "244104558433951744"}).to_return(:body => fixture("statuses.json"))
2817
+ end
2818
+ it "requests the correct resource" do
2819
+ @cli.timeline("sferik")
2820
+ expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "20", :screen_name => "sferik", :since_id => "244104558433951744"})).to have_been_made
2821
+ end
2822
+ end
2790
2823
  end
2791
2824
  end
2792
2825
 
2793
2826
  describe "#trends" do
2794
2827
  before do
2795
- 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"})
2828
+ stub_get("/1.1/trends/place.json").with(:query => {:id => "1"}).to_return(:body => fixture("trends.json"))
2796
2829
  end
2797
2830
  it "requests the correct resource" do
2798
2831
  @cli.trends
@@ -2805,7 +2838,7 @@ ID Posted at Screen name Text
2805
2838
  context "--exclude-hashtags" do
2806
2839
  before do
2807
2840
  @cli.options = @cli.options.merge("exclude-hashtags" => true)
2808
- 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"})
2841
+ stub_get("/1.1/trends/place.json").with(:query => {:id => "1", :exclude => "hashtags"}).to_return(:body => fixture("trends.json"))
2809
2842
  end
2810
2843
  it "requests the correct resource" do
2811
2844
  @cli.trends
@@ -2818,7 +2851,7 @@ ID Posted at Screen name Text
2818
2851
  end
2819
2852
  context "with a WOEID passed" do
2820
2853
  before do
2821
- 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"})
2854
+ stub_get("/1.1/trends/place.json").with(:query => {:id => "2487956"}).to_return(:body => fixture("trends.json"))
2822
2855
  end
2823
2856
  it "requests the correct resource" do
2824
2857
  @cli.trends("2487956")
@@ -2833,7 +2866,7 @@ ID Posted at Screen name Text
2833
2866
 
2834
2867
  describe "#trend_locations" do
2835
2868
  before do
2836
- stub_get("/1.1/trends/available.json").to_return(:body => fixture("locations.json"), :headers => {:content_type => "application/json; charset=utf-8"})
2869
+ stub_get("/1.1/trends/available.json").to_return(:body => fixture("locations.json"))
2837
2870
  end
2838
2871
  it "requests the correct resource" do
2839
2872
  @cli.trend_locations
@@ -2937,19 +2970,19 @@ WOEID Parent ID Type Name Country
2937
2970
  end
2938
2971
  context "one user" do
2939
2972
  it "requests the correct resource" do
2940
- 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"})
2973
+ stub_post("/1.1/friendships/destroy.json").with(:body => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"))
2941
2974
  @cli.unfollow("sferik")
2942
2975
  expect(a_post("/1.1/friendships/destroy.json").with(:body => {:screen_name => "sferik"})).to have_been_made
2943
2976
  end
2944
2977
  it "has the correct output" do
2945
- 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"})
2978
+ stub_post("/1.1/friendships/destroy.json").with(:body => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"))
2946
2979
  @cli.unfollow("sferik")
2947
2980
  expect($stdout.string).to match /^@testcli is no longer following 1 user\.$/
2948
2981
  end
2949
2982
  context "--id" do
2950
2983
  before do
2951
2984
  @cli.options = @cli.options.merge("id" => true)
2952
- 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"})
2985
+ stub_post("/1.1/friendships/destroy.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"))
2953
2986
  end
2954
2987
  it "requests the correct resource" do
2955
2988
  @cli.unfollow("7505382")
@@ -2971,7 +3004,7 @@ WOEID Parent ID Type Name Country
2971
3004
  describe "#update" do
2972
3005
  before do
2973
3006
  @cli.options = @cli.options.merge("profile" => fixture_path + "/.trc", "location" => true)
2974
- 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"})
3007
+ 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"))
2975
3008
  stub_request(:get, "http://checkip.dyndns.org/").to_return(:body => fixture("checkip.html"), :headers => {:content_type => "text/html"})
2976
3009
  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"})
2977
3010
  end
@@ -2988,7 +3021,7 @@ WOEID Parent ID Type Name Country
2988
3021
  context "with file" do
2989
3022
  before do
2990
3023
  @cli.options = @cli.options.merge("file" => fixture_path + "/long.png")
2991
- stub_post("/1.1/statuses/update_with_media.json").to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
3024
+ stub_post("/1.1/statuses/update_with_media.json").to_return(:body => fixture("status.json"))
2992
3025
  end
2993
3026
  it "requests the correct resource" do
2994
3027
  @cli.update("Testing")
@@ -3003,7 +3036,7 @@ WOEID Parent ID Type Name Country
3003
3036
 
3004
3037
  describe "#users" do
3005
3038
  before do
3006
- 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"})
3039
+ stub_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"}).to_return(:body => fixture("users.json"))
3007
3040
  end
3008
3041
  it "requests the correct resource" do
3009
3042
  @cli.users("sferik", "pengwynn")
@@ -3078,7 +3111,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
3078
3111
  context "--id" do
3079
3112
  before do
3080
3113
  @cli.options = @cli.options.merge("id" => true)
3081
- 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"})
3114
+ stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382,14100886"}).to_return(:body => fixture("users.json"))
3082
3115
  end
3083
3116
  it "requests the correct resource" do
3084
3117
  @cli.users("7505382", "14100886")
@@ -3141,7 +3174,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
3141
3174
 
3142
3175
  describe "#whois" do
3143
3176
  before do
3144
- 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"})
3177
+ stub_get("/1.1/users/show.json").with(:query => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"))
3145
3178
  end
3146
3179
  it "requests the correct resource" do
3147
3180
  @cli.whois("sferik")
@@ -3180,7 +3213,7 @@ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name
3180
3213
  context "--id" do
3181
3214
  before do
3182
3215
  @cli.options = @cli.options.merge("id" => true)
3183
- 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"})
3216
+ stub_get("/1.1/users/show.json").with(:query => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"))
3184
3217
  end
3185
3218
  it "requests the correct resource" do
3186
3219
  @cli.whois("7505382")