diff --git a/lib/twitter/api/users.rb b/lib/twitter/api/users.rb index 19815e7df..f371a86d7 100644 --- a/lib/twitter/api/users.rb +++ b/lib/twitter/api/users.rb @@ -195,7 +195,7 @@ def block?(user, options={}) when Twitter::User user.id end - blocked_ids(options).all.map(&:to_i).include?(user_id) + blocked_ids(options).map(&:to_i).include?(user_id) end # Blocks the users specified by the authenticating user diff --git a/lib/twitter/cursor.rb b/lib/twitter/cursor.rb index a1b58bd38..fa4243143 100644 --- a/lib/twitter/cursor.rb +++ b/lib/twitter/cursor.rb @@ -43,10 +43,6 @@ def initialize(attrs, collection_name, klass, client, request_method, path, opti end end - def all - map{|element| element} - end - # @return [Enumerator] def each(&block) return to_enum(:each) unless block_given? diff --git a/spec/twitter/api/friends_and_followers_spec.rb b/spec/twitter/api/friends_and_followers_spec.rb index bc7bd967d..32ed846db 100644 --- a/spec/twitter/api/friends_and_followers_spec.rb +++ b/spec/twitter/api/friends_and_followers_spec.rb @@ -21,12 +21,12 @@ expect(friend_ids.ids).to be_an Array expect(friend_ids.ids.first).to eq 14100886 end - context "with all" do + context "with each" do before do stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.friend_ids("sferik").all + @client.friend_ids("sferik").each{} expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"})).to have_been_made end @@ -40,12 +40,12 @@ @client.friend_ids(7505382) expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made end - context "with all" do + context "with each" do before do stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "1305102810874389703", :user_id => "7505382"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.friend_ids(7505382).all + @client.friend_ids(7505382).each{} expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "1305102810874389703", :user_id => "7505382"})).to have_been_made end @@ -67,12 +67,12 @@ expect(friend_ids.ids).to be_an Array expect(friend_ids.ids.first).to eq 14100886 end - context "with all" do + context "with each" do before do stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.friend_ids.all + @client.friend_ids.each{} expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"})).to have_been_made @@ -96,12 +96,12 @@ expect(follower_ids.ids).to be_an Array expect(follower_ids.ids.first).to eq 14100886 end - context "with all" do + context "with each" do before do stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.follower_ids("sferik").all + @client.follower_ids("sferik").each{} expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"})).to have_been_made end @@ -115,12 +115,12 @@ @client.follower_ids(7505382) expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made end - context "with all" do + context "with each" do before do stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :user_id => "7505382"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.follower_ids(7505382).all + @client.follower_ids(7505382).each{} expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :user_id => "7505382"})).to have_been_made end @@ -142,12 +142,12 @@ expect(follower_ids.ids).to be_an Array expect(follower_ids.ids.first).to eq 14100886 end - context "with all" do + context "with each" do before do stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.follower_ids.all + @client.follower_ids.each{} expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"})).to have_been_made @@ -262,12 +262,12 @@ expect(friendships_incoming.ids).to be_an Array expect(friendships_incoming.ids.first).to eq 14100886 end - context "with all" do + context "with each" do before do stub_get("/1.1/friendships/incoming.json").with(:query => {:cursor => "1305102810874389703"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.friendships_incoming.all + @client.friendships_incoming.each{} expect(a_get("/1.1/friendships/incoming.json").with(:query => {:cursor => "1305102810874389703"})).to have_been_made end end @@ -287,12 +287,12 @@ expect(friendships_outgoing.ids).to be_an Array expect(friendships_outgoing.ids.first).to eq 14100886 end - context "with all" do + context "with each" do before do stub_get("/1.1/friendships/outgoing.json").with(:query => {:cursor => "1305102810874389703"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.friendships_outgoing.all + @client.friendships_outgoing.each{} expect(a_get("/1.1/friendships/outgoing.json").with(:query => {:cursor => "1305102810874389703"})).to have_been_made end end @@ -533,12 +533,12 @@ expect(followers.users).to be_an Array expect(followers.users.first).to be_a Twitter::User end - context "with all" do + context "with each" do before do stub_get("/1.1/followers/list.json").with(:query => {:cursor => "1419103567112105362", :screen_name => "sferik"}).to_return(:body => fixture("followers_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.followers("sferik").all + @client.followers("sferik").each{} expect(a_get("/1.1/followers/list.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made expect(a_get("/1.1/followers/list.json").with(:query => {:cursor => "1419103567112105362", :screen_name => "sferik"})).to have_been_made end @@ -552,12 +552,12 @@ @client.followers(7505382) expect(a_get("/1.1/followers/list.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made end - context "with all" do + context "with each" do before do stub_get("/1.1/followers/list.json").with(:query => {:cursor => "1419103567112105362", :user_id => "7505382"}).to_return(:body => fixture("followers_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.followers(7505382).all + @client.followers(7505382).each{} expect(a_get("/1.1/followers/list.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made expect(a_get("/1.1/followers/list.json").with(:query => {:cursor => "1419103567112105362", :user_id => "7505382"})).to have_been_made end @@ -579,12 +579,12 @@ expect(followers.users).to be_an Array expect(followers.users.first).to be_a Twitter::User end - context "with all" do + context "with each" do before do stub_get("/1.1/followers/list.json").with(:query => {:cursor => "1419103567112105362", :screen_name => "sferik"}).to_return(:body => fixture("followers_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.followers.all + @client.followers.each{} expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made expect(a_get("/1.1/followers/list.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made expect(a_get("/1.1/followers/list.json").with(:query => {:cursor => "1419103567112105362", :screen_name => "sferik"})).to have_been_made @@ -608,12 +608,12 @@ expect(friends.users).to be_an Array expect(friends.users.first).to be_a Twitter::User end - context "with all" do + context "with each" do before do stub_get("/1.1/friends/list.json").with(:query => {:cursor => "1418947360875712729", :screen_name => "sferik"}).to_return(:body => fixture("friends_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.friends("sferik").all + @client.friends("sferik").each{} expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "1418947360875712729", :screen_name => "sferik"})).to have_been_made end @@ -627,12 +627,12 @@ @client.friends(7505382) expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made end - context "with all" do + context "with each" do before do stub_get("/1.1/friends/list.json").with(:query => {:cursor => "1418947360875712729", :user_id => "7505382"}).to_return(:body => fixture("friends_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.friends(7505382).all + @client.friends(7505382).each{} expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "1418947360875712729", :user_id => "7505382"})).to have_been_made end @@ -654,12 +654,12 @@ expect(friends.users).to be_an Array expect(friends.users.first).to be_a Twitter::User end - context "with all" do + context "with each" do before do stub_get("/1.1/friends/list.json").with(:query => {:cursor => "1418947360875712729", :screen_name => "sferik"}).to_return(:body => fixture("friends_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.friends.all + @client.friends.each{} expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "1418947360875712729", :screen_name => "sferik"})).to have_been_made diff --git a/spec/twitter/api/lists_spec.rb b/spec/twitter/api/lists_spec.rb index a2c2aa779..a98561612 100644 --- a/spec/twitter/api/lists_spec.rb +++ b/spec/twitter/api/lists_spec.rb @@ -120,12 +120,12 @@ expect(memberships.lists.first).to be_a Twitter::List expect(memberships.lists.first.name).to eq "developer" end - context "with all" do + context "with each" do before do stub_get("/1.1/lists/memberships.json").with(:query => {:screen_name => "sferik", :cursor => "1401037770457540712"}).to_return(:body => fixture("memberships2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.memberships("sferik").all + @client.memberships("sferik").each{} expect(a_get("/1.1/lists/memberships.json").with(:query => {:screen_name => "sferik", :cursor => "-1"})).to have_been_made expect(a_get("/1.1/lists/memberships.json").with(:query => {:screen_name => "sferik", :cursor => "1401037770457540712"})).to have_been_made end @@ -139,12 +139,12 @@ @client.memberships(7505382) expect(a_get("/1.1/lists/memberships.json").with(:query => {:user_id => "7505382", :cursor => "-1"})).to have_been_made end - context "with all" do + context "with each" do before do stub_get("/1.1/lists/memberships.json").with(:query => {:user_id => "7505382", :cursor => "1401037770457540712"}).to_return(:body => fixture("memberships2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.memberships(7505382).all + @client.memberships(7505382).each{} expect(a_get("/1.1/lists/memberships.json").with(:query => {:user_id => "7505382", :cursor => "-1"})).to have_been_made expect(a_get("/1.1/lists/memberships.json").with(:query => {:user_id => "7505382", :cursor => "1401037770457540712"})).to have_been_made end @@ -159,12 +159,12 @@ @client.memberships expect(a_get("/1.1/lists/memberships.json").with(:query => {:screen_name => "sferik", :cursor => "-1"})).to have_been_made end - context "with all" do + context "with each" do before do stub_get("/1.1/lists/memberships.json").with(:query => {:screen_name => "sferik", :cursor => "1401037770457540712"}).to_return(:body => fixture("memberships2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.memberships.all + @client.memberships.each{} expect(a_get("/1.1/lists/memberships.json").with(:query => {:screen_name => "sferik", :cursor => "-1"})).to have_been_made expect(a_get("/1.1/lists/memberships.json").with(:query => {:screen_name => "sferik", :cursor => "1401037770457540712"})).to have_been_made end @@ -188,12 +188,12 @@ expect(list_subscribers.users.first).to be_a Twitter::User expect(list_subscribers.users.first.id).to eq 7505382 end - context "with all" do + context "with each" do before do stub_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "1322801608223717003"}).to_return(:body => fixture("users_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.list_subscribers("sferik", "presidents").all + @client.list_subscribers("sferik", "presidents").each{} expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "-1"})).to have_been_made expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "1322801608223717003"})).to have_been_made end @@ -207,12 +207,12 @@ @client.list_subscribers(7505382, "presidents") expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_id => "7505382", :slug => "presidents", :cursor => "-1"})).to have_been_made end - context "with all" do + context "with each" do before do stub_get("/1.1/lists/subscribers.json").with(:query => {:owner_id => "7505382", :slug => "presidents", :cursor => "1322801608223717003"}).to_return(:body => fixture("users_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.list_subscribers(7505382, "presidents").all + @client.list_subscribers(7505382, "presidents").each{} expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_id => "7505382", :slug => "presidents", :cursor => "-1"})).to have_been_made expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_id => "7505382", :slug => "presidents", :cursor => "1322801608223717003"})).to have_been_made end @@ -227,12 +227,12 @@ @client.list_subscribers("presidents") expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "-1"})).to have_been_made end - context "with all" do + context "with each" do before do stub_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "1322801608223717003"}).to_return(:body => fixture("users_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.list_subscribers("presidents").all + @client.list_subscribers("presidents").each{} expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "-1"})).to have_been_made expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "1322801608223717003"})).to have_been_made end @@ -492,12 +492,12 @@ expect(list_members.users.first).to be_a Twitter::User expect(list_members.users.first.id).to eq 7505382 end - context "with all" do + context "with each" do before do stub_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "1322801608223717003"}).to_return(:body => fixture("users_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.list_members("sferik", "presidents").all + @client.list_members("sferik", "presidents").each{} expect(a_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "-1"})).to have_been_made expect(a_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "1322801608223717003"})).to have_been_made end @@ -511,12 +511,12 @@ @client.list_members(7505382, "presidents") expect(a_get("/1.1/lists/members.json").with(:query => {:owner_id => "7505382", :slug => "presidents", :cursor => "-1"})).to have_been_made end - context "with all" do + context "with each" do before do stub_get("/1.1/lists/members.json").with(:query => {:owner_id => "7505382", :slug => "presidents", :cursor => "1322801608223717003"}).to_return(:body => fixture("users_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.list_members(7505382, "presidents").all + @client.list_members(7505382, "presidents").each{} expect(a_get("/1.1/lists/members.json").with(:query => {:owner_id => "7505382", :slug => "presidents", :cursor => "-1"})).to have_been_made expect(a_get("/1.1/lists/members.json").with(:query => {:owner_id => "7505382", :slug => "presidents", :cursor => "1322801608223717003"})).to have_been_made end @@ -531,12 +531,12 @@ @client.list_members("presidents") expect(a_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "-1"})).to have_been_made end - context "with all" do + context "with each" do before do stub_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "1322801608223717003"}).to_return(:body => fixture("users_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.list_members("presidents").all + @client.list_members("presidents").each{} expect(a_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "-1"})).to have_been_made expect(a_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "1322801608223717003"})).to have_been_made end @@ -759,12 +759,12 @@ expect(subscriptions.lists.first).to be_a Twitter::List expect(subscriptions.lists.first.name).to eq "Rubyists" end - context "with all" do + context "with each" do before do stub_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name => "sferik", :cursor => "1401037770457540712"}).to_return(:body => fixture("subscriptions2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.subscriptions("sferik").all + @client.subscriptions("sferik").each{} expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name => "sferik", :cursor => "-1"})).to have_been_made expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name => "sferik", :cursor => "1401037770457540712"})).to have_been_made end @@ -778,12 +778,12 @@ @client.subscriptions(7505382) expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:user_id => "7505382", :cursor => "-1"})).to have_been_made end - context "with all" do + context "with each" do before do stub_get("/1.1/lists/subscriptions.json").with(:query => {:user_id => "7505382", :cursor => "1401037770457540712"}).to_return(:body => fixture("subscriptions2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.subscriptions(7505382).all + @client.subscriptions(7505382).each{} expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:user_id => "7505382", :cursor => "-1"})).to have_been_made expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:user_id => "7505382", :cursor => "1401037770457540712"})).to have_been_made end @@ -798,12 +798,12 @@ @client.subscriptions expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name => "sferik", :cursor => "-1"})).to have_been_made end - context "with all" do + context "with each" do before do stub_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name => "sferik", :cursor => "1401037770457540712"}).to_return(:body => fixture("subscriptions2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.subscriptions.all + @client.subscriptions.each{} expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name => "sferik", :cursor => "-1"})).to have_been_made expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name => "sferik", :cursor => "1401037770457540712"})).to have_been_made end diff --git a/spec/twitter/api/tweets_spec.rb b/spec/twitter/api/tweets_spec.rb index 4cfaae889..7701b6a60 100644 --- a/spec/twitter/api/tweets_spec.rb +++ b/spec/twitter/api/tweets_spec.rb @@ -453,12 +453,12 @@ expect(retweeters_ids.ids).to be_an Array expect(retweeters_ids.ids.first).to eq 14100886 end - context "with all" do + context "with each" do before do stub_get("/1.1/statuses/retweeters/ids.json").with(:query => {:id => "25938088801", :cursor => "1305102810874389703"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.retweeters_ids(25938088801).all + @client.retweeters_ids(25938088801).each{} expect(a_get("/1.1/statuses/retweeters/ids.json").with(:query => {:id => "25938088801", :cursor => "-1"})).to have_been_made expect(a_get("/1.1/statuses/retweeters/ids.json").with(:query => {:id => "25938088801", :cursor => "1305102810874389703"})).to have_been_made end diff --git a/spec/twitter/api/undocumented_spec.rb b/spec/twitter/api/undocumented_spec.rb index 3990cb961..6f55de1d4 100644 --- a/spec/twitter/api/undocumented_spec.rb +++ b/spec/twitter/api/undocumented_spec.rb @@ -21,12 +21,12 @@ expect(following_followers_of.users).to be_an Array expect(following_followers_of.users.first).to be_a Twitter::User end - context "with all" do + context "with each" do before do stub_get("/users/following_followers_of.json").with(:query => {:cursor => "1322801608223717003", :screen_name => "sferik"}).to_return(:body => fixture("users_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.following_followers_of("sferik").all + @client.following_followers_of("sferik").each{} expect(a_get("/users/following_followers_of.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made expect(a_get("/users/following_followers_of.json").with(:query => {:cursor => "1322801608223717003", :screen_name => "sferik"})).to have_been_made end @@ -40,12 +40,12 @@ @client.following_followers_of(7505382) expect(a_get("/users/following_followers_of.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made end - context "with all" do + context "with each" do before do stub_get("/users/following_followers_of.json").with(:query => {:cursor => "1322801608223717003", :user_id => "7505382"}).to_return(:body => fixture("users_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.following_followers_of(7505382).all + @client.following_followers_of(7505382).each{} expect(a_get("/users/following_followers_of.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made expect(a_get("/users/following_followers_of.json").with(:query => {:cursor => "1322801608223717003", :user_id => "7505382"})).to have_been_made end @@ -67,12 +67,12 @@ expect(following_followers_of.users).to be_an Array expect(following_followers_of.users.first).to be_a Twitter::User end - context "with all" do + context "with each" do before do stub_get("/users/following_followers_of.json").with(:query => {:cursor => "1322801608223717003", :screen_name => "sferik"}).to_return(:body => fixture("users_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.following_followers_of.all + @client.following_followers_of.each{} expect(a_get("/users/following_followers_of.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made expect(a_get("/users/following_followers_of.json").with(:query => {:cursor => "1322801608223717003", :screen_name => "sferik"})).to have_been_made end diff --git a/spec/twitter/api/users_spec.rb b/spec/twitter/api/users_spec.rb index 32c481bd4..9dd5fe0ba 100644 --- a/spec/twitter/api/users_spec.rb +++ b/spec/twitter/api/users_spec.rb @@ -186,12 +186,12 @@ expect(blocking.users.first).to be_a Twitter::User expect(blocking.users.first.id).to eq 7505382 end - context "with all" do + context "with each" do before do stub_get("/1.1/blocks/list.json").with(:query => {:cursor => "1322801608223717003"}).to_return(:body => fixture("users_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.blocking.all + @client.blocking.each{} expect(a_get("/1.1/blocks/list.json").with(:query => {:cursor => "-1"})).to have_been_made expect(a_get("/1.1/blocks/list.json").with(:query => {:cursor => "1322801608223717003"})).to have_been_made end @@ -212,12 +212,12 @@ expect(blocked_ids.ids).to be_an Array expect(blocked_ids.ids.first).to eq 14100886 end - context "with all" do + context "with each" do before do stub_get("/1.1/blocks/ids.json").with(:query => {:cursor => "1305102810874389703"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "requests the correct resource" do - @client.blocked_ids.all + @client.blocked_ids.each{} expect(a_get("/1.1/blocks/ids.json").with(:query => {:cursor => "-1"})).to have_been_made expect(a_get("/1.1/blocks/ids.json").with(:query => {:cursor => "1305102810874389703"})).to have_been_made end diff --git a/spec/twitter/cursor_spec.rb b/spec/twitter/cursor_spec.rb index dc1279593..7208433d7 100644 --- a/spec/twitter/cursor_spec.rb +++ b/spec/twitter/cursor_spec.rb @@ -10,23 +10,6 @@ end end - describe "#all" do - before do - @client = Twitter::Client.new - stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"}) - stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) - end - it "requests the correct resources" do - @client.follower_ids("sferik").all - expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made - expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"})).to have_been_made - end - it "fetches all" do - follower_ids = @client.follower_ids("sferik").all - expect(follower_ids.size).to eq 6 - end - end - describe "#each" do before do @client = Twitter::Client.new