twitter 5.11.0 → 5.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -1
  3. data/README.md +7 -5
  4. data/lib/twitter/arguments.rb +1 -0
  5. data/lib/twitter/base.rb +4 -5
  6. data/lib/twitter/basic_user.rb +1 -0
  7. data/lib/twitter/client.rb +10 -9
  8. data/lib/twitter/configuration.rb +4 -2
  9. data/lib/twitter/cursor.rb +3 -2
  10. data/lib/twitter/direct_message.rb +1 -0
  11. data/lib/twitter/entity.rb +1 -0
  12. data/lib/twitter/entity/hashtag.rb +1 -0
  13. data/lib/twitter/entity/symbol.rb +1 -0
  14. data/lib/twitter/entity/user_mention.rb +4 -1
  15. data/lib/twitter/error.rb +22 -19
  16. data/lib/twitter/geo.rb +1 -0
  17. data/lib/twitter/geo_results.rb +3 -2
  18. data/lib/twitter/identity.rb +1 -0
  19. data/lib/twitter/language.rb +1 -0
  20. data/lib/twitter/list.rb +12 -5
  21. data/lib/twitter/media/photo.rb +1 -0
  22. data/lib/twitter/metadata.rb +1 -0
  23. data/lib/twitter/null_object.rb +22 -0
  24. data/lib/twitter/oembed.rb +5 -2
  25. data/lib/twitter/place.rb +4 -1
  26. data/lib/twitter/profile.rb +1 -1
  27. data/lib/twitter/rest/client.rb +4 -4
  28. data/lib/twitter/rest/favorites.rb +4 -3
  29. data/lib/twitter/rest/lists.rb +18 -3
  30. data/lib/twitter/rest/request/multipart_with_file.rb +1 -1
  31. data/lib/twitter/rest/response/parse_json.rb +1 -1
  32. data/lib/twitter/rest/response/raise_error.rb +4 -5
  33. data/lib/twitter/rest/tweets.rb +2 -1
  34. data/lib/twitter/rest/users.rb +10 -7
  35. data/lib/twitter/saved_search.rb +1 -0
  36. data/lib/twitter/search_results.rb +3 -2
  37. data/lib/twitter/settings.rb +7 -3
  38. data/lib/twitter/size.rb +4 -1
  39. data/lib/twitter/streaming/deleted_tweet.rb +1 -0
  40. data/lib/twitter/streaming/event.rb +2 -2
  41. data/lib/twitter/streaming/message_parser.rb +1 -1
  42. data/lib/twitter/suggestion.rb +4 -1
  43. data/lib/twitter/token.rb +1 -0
  44. data/lib/twitter/trend.rb +1 -0
  45. data/lib/twitter/trend_results.rb +3 -2
  46. data/lib/twitter/tweet.rb +9 -6
  47. data/lib/twitter/user.rb +15 -13
  48. data/lib/twitter/utils.rb +2 -6
  49. data/lib/twitter/version.rb +1 -1
  50. data/twitter.gemspec +6 -9
  51. metadata +6 -259
  52. data/Rakefile +0 -37
  53. data/spec/fixtures/already_favorited.json +0 -1
  54. data/spec/fixtures/already_posted.json +0 -1
  55. data/spec/fixtures/already_retweeted.json +0 -1
  56. data/spec/fixtures/bearer_token.json +0 -1
  57. data/spec/fixtures/category.json +0 -1
  58. data/spec/fixtures/configuration.json +0 -1
  59. data/spec/fixtures/contributees.json +0 -1
  60. data/spec/fixtures/count.json +0 -1
  61. data/spec/fixtures/direct_message.json +0 -1
  62. data/spec/fixtures/direct_messages.json +0 -1
  63. data/spec/fixtures/empty.json +0 -0
  64. data/spec/fixtures/followers_list.json +0 -1
  65. data/spec/fixtures/followers_list2.json +0 -1
  66. data/spec/fixtures/following.json +0 -1
  67. data/spec/fixtures/forbidden.json +0 -1
  68. data/spec/fixtures/friends_list.json +0 -1
  69. data/spec/fixtures/friends_list2.json +0 -1
  70. data/spec/fixtures/friendships.json +0 -1
  71. data/spec/fixtures/ids.json +0 -1
  72. data/spec/fixtures/ids_list.json +0 -1
  73. data/spec/fixtures/ids_list2.json +0 -1
  74. data/spec/fixtures/languages.json +0 -1
  75. data/spec/fixtures/list.json +0 -1
  76. data/spec/fixtures/lists.json +0 -1
  77. data/spec/fixtures/locations.json +0 -1
  78. data/spec/fixtures/matching_trends.json +0 -1
  79. data/spec/fixtures/me.jpeg +0 -0
  80. data/spec/fixtures/members.json +0 -1
  81. data/spec/fixtures/memberships.json +0 -1
  82. data/spec/fixtures/memberships2.json +0 -1
  83. data/spec/fixtures/not_following.json +0 -1
  84. data/spec/fixtures/not_found.json +0 -1
  85. data/spec/fixtures/oembed.json +0 -1
  86. data/spec/fixtures/ownerships.json +0 -1
  87. data/spec/fixtures/pbjt.gif +0 -0
  88. data/spec/fixtures/pengwynn.json +0 -1
  89. data/spec/fixtures/place.json +0 -1
  90. data/spec/fixtures/places.json +0 -1
  91. data/spec/fixtures/privacy.json +0 -1
  92. data/spec/fixtures/profile_banner.json +0 -1
  93. data/spec/fixtures/request_token.txt +0 -6
  94. data/spec/fixtures/retweet.json +0 -1
  95. data/spec/fixtures/retweets.json +0 -1
  96. data/spec/fixtures/saved_search.json +0 -1
  97. data/spec/fixtures/saved_searches.json +0 -1
  98. data/spec/fixtures/search.json +0 -1
  99. data/spec/fixtures/search2.json +0 -1
  100. data/spec/fixtures/search_malformed.json +0 -1
  101. data/spec/fixtures/settings.json +0 -1
  102. data/spec/fixtures/sferik.json +0 -1
  103. data/spec/fixtures/status.json +0 -1
  104. data/spec/fixtures/statuses.json +0 -1
  105. data/spec/fixtures/subscriptions.json +0 -1
  106. data/spec/fixtures/subscriptions2.json +0 -1
  107. data/spec/fixtures/suggestions.json +0 -1
  108. data/spec/fixtures/tos.json +0 -1
  109. data/spec/fixtures/track_streaming.json +0 -3
  110. data/spec/fixtures/track_streaming_user.json +0 -6
  111. data/spec/fixtures/upload.json +0 -1
  112. data/spec/fixtures/user_search.json +0 -1
  113. data/spec/fixtures/user_timeline.json +0 -1
  114. data/spec/fixtures/users.json +0 -1
  115. data/spec/fixtures/users_list.json +0 -1
  116. data/spec/fixtures/users_list2.json +0 -1
  117. data/spec/fixtures/we_concept_bg2.png +0 -0
  118. data/spec/fixtures/wildcomet2.jpe +0 -0
  119. data/spec/helper.rb +0 -68
  120. data/spec/twitter/base_spec.rb +0 -39
  121. data/spec/twitter/basic_user_spec.rb +0 -23
  122. data/spec/twitter/configuration_spec.rb +0 -17
  123. data/spec/twitter/cursor_spec.rb +0 -30
  124. data/spec/twitter/direct_message_spec.rb +0 -232
  125. data/spec/twitter/entity/uri_spec.rb +0 -75
  126. data/spec/twitter/error_spec.rb +0 -52
  127. data/spec/twitter/geo/point_spec.rb +0 -41
  128. data/spec/twitter/geo/polygon_spec.rb +0 -29
  129. data/spec/twitter/geo_factory_spec.rb +0 -19
  130. data/spec/twitter/geo_results_spec.rb +0 -35
  131. data/spec/twitter/geo_spec.rb +0 -29
  132. data/spec/twitter/identifiable_spec.rb +0 -29
  133. data/spec/twitter/list_spec.rb +0 -88
  134. data/spec/twitter/media/photo_spec.rb +0 -151
  135. data/spec/twitter/media_factory_spec.rb +0 -15
  136. data/spec/twitter/oembed_spec.rb +0 -170
  137. data/spec/twitter/place_spec.rb +0 -168
  138. data/spec/twitter/profile_banner_spec.rb +0 -13
  139. data/spec/twitter/rate_limit_spec.rb +0 -59
  140. data/spec/twitter/relationship_spec.rb +0 -49
  141. data/spec/twitter/rest/client_spec.rb +0 -217
  142. data/spec/twitter/rest/direct_messages_spec.rb +0 -133
  143. data/spec/twitter/rest/favorites_spec.rb +0 -188
  144. data/spec/twitter/rest/friends_and_followers_spec.rb +0 -667
  145. data/spec/twitter/rest/geo_spec.rb +0 -68
  146. data/spec/twitter/rest/help_spec.rb +0 -68
  147. data/spec/twitter/rest/lists_spec.rb +0 -910
  148. data/spec/twitter/rest/media_spec.rb +0 -54
  149. data/spec/twitter/rest/oauth_spec.rb +0 -63
  150. data/spec/twitter/rest/saved_searches_spec.rb +0 -98
  151. data/spec/twitter/rest/search_spec.rb +0 -42
  152. data/spec/twitter/rest/spam_reporting_spec.rb +0 -25
  153. data/spec/twitter/rest/suggested_users_spec.rb +0 -59
  154. data/spec/twitter/rest/timelines_spec.rb +0 -138
  155. data/spec/twitter/rest/trends_spec.rb +0 -68
  156. data/spec/twitter/rest/tweets_spec.rb +0 -614
  157. data/spec/twitter/rest/undocumented_spec.rb +0 -103
  158. data/spec/twitter/rest/users_spec.rb +0 -797
  159. data/spec/twitter/saved_search_spec.rb +0 -45
  160. data/spec/twitter/search_results_spec.rb +0 -30
  161. data/spec/twitter/settings_spec.rb +0 -27
  162. data/spec/twitter/size_spec.rb +0 -28
  163. data/spec/twitter/source_user_spec.rb +0 -23
  164. data/spec/twitter/streaming/client_spec.rb +0 -123
  165. data/spec/twitter/streaming/connection_spec.rb +0 -32
  166. data/spec/twitter/streaming/deleted_tweet_spec.rb +0 -23
  167. data/spec/twitter/streaming/event_spec.rb +0 -43
  168. data/spec/twitter/streaming/friend_list_spec.rb +0 -11
  169. data/spec/twitter/streaming/message_parser_spec.rb +0 -54
  170. data/spec/twitter/streaming/response_spec.rb +0 -21
  171. data/spec/twitter/suggestion_spec.rb +0 -40
  172. data/spec/twitter/target_user_spec.rb +0 -23
  173. data/spec/twitter/token_spec.rb +0 -16
  174. data/spec/twitter/trend_results_spec.rb +0 -89
  175. data/spec/twitter/trend_spec.rb +0 -51
  176. data/spec/twitter/tweet_spec.rb +0 -456
  177. data/spec/twitter/user_spec.rb +0 -447
  178. data/spec/twitter/utils_spec.rb +0 -34
@@ -1,667 +0,0 @@
1
- require 'helper'
2
-
3
- describe Twitter::REST::FriendsAndFollowers do
4
-
5
- before do
6
- @client = Twitter::REST::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :access_token => 'AT', :access_token_secret => 'AS')
7
- end
8
-
9
- describe '#friend_ids' do
10
- context 'with a screen name passed' do
11
- before do
12
- stub_get('/1.1/friends/ids.json').with(:query => {:screen_name => 'sferik', :cursor => '-1'}).to_return(:body => fixture('ids_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
13
- end
14
- it 'requests the correct resource' do
15
- @client.friend_ids('sferik')
16
- expect(a_get('/1.1/friends/ids.json').with(:query => {:screen_name => 'sferik', :cursor => '-1'})).to have_been_made
17
- end
18
- it 'returns an array of numeric IDs for every user the specified user is following' do
19
- friend_ids = @client.friend_ids('sferik')
20
- expect(friend_ids).to be_a Twitter::Cursor
21
- expect(friend_ids.first).to eq(20_009_713)
22
- end
23
- context 'with each' do
24
- before do
25
- stub_get('/1.1/friends/ids.json').with(:query => {:screen_name => 'sferik', :cursor => '1305102810874389703'}).to_return(:body => fixture('ids_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
26
- end
27
- it 'requests the correct resource' do
28
- @client.friend_ids('sferik').each {}
29
- expect(a_get('/1.1/friends/ids.json').with(:query => {:screen_name => 'sferik', :cursor => '-1'})).to have_been_made
30
- expect(a_get('/1.1/friends/ids.json').with(:query => {:screen_name => 'sferik', :cursor => '1305102810874389703'})).to have_been_made
31
- end
32
- end
33
- end
34
- context 'with a user ID passed' do
35
- before do
36
- stub_get('/1.1/friends/ids.json').with(:query => {:user_id => '7505382', :cursor => '-1'}).to_return(:body => fixture('ids_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
37
- end
38
- it 'requests the correct resource' do
39
- @client.friend_ids(7_505_382)
40
- expect(a_get('/1.1/friends/ids.json').with(:query => {:user_id => '7505382', :cursor => '-1'})).to have_been_made
41
- end
42
- context 'with each' do
43
- before do
44
- stub_get('/1.1/friends/ids.json').with(:query => {:user_id => '7505382', :cursor => '1305102810874389703'}).to_return(:body => fixture('ids_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
45
- end
46
- it 'requests the correct resource' do
47
- @client.friend_ids(7_505_382).each {}
48
- expect(a_get('/1.1/friends/ids.json').with(:query => {:user_id => '7505382', :cursor => '-1'})).to have_been_made
49
- expect(a_get('/1.1/friends/ids.json').with(:query => {:user_id => '7505382', :cursor => '1305102810874389703'})).to have_been_made
50
- end
51
- end
52
- end
53
- context 'without arguments passed' do
54
- before do
55
- stub_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
56
- stub_get('/1.1/friends/ids.json').with(:query => {:user_id => '7505382', :cursor => '-1'}).to_return(:body => fixture('ids_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
57
- end
58
- it 'requests the correct resource' do
59
- @client.friend_ids
60
- expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
61
- expect(a_get('/1.1/friends/ids.json').with(:query => {:user_id => '7505382', :cursor => '-1'})).to have_been_made
62
- end
63
- it 'returns an array of numeric IDs for every user the specified user is following' do
64
- friend_ids = @client.friend_ids
65
- expect(friend_ids).to be_a Twitter::Cursor
66
- expect(friend_ids.first).to eq(20_009_713)
67
- end
68
- context 'with each' do
69
- before do
70
- stub_get('/1.1/friends/ids.json').with(:query => {:user_id => '7505382', :cursor => '1305102810874389703'}).to_return(:body => fixture('ids_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
71
- end
72
- it 'requests the correct resource' do
73
- @client.friend_ids.each {}
74
- expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
75
- expect(a_get('/1.1/friends/ids.json').with(:query => {:user_id => '7505382', :cursor => '-1'})).to have_been_made
76
- expect(a_get('/1.1/friends/ids.json').with(:query => {:user_id => '7505382', :cursor => '1305102810874389703'})).to have_been_made
77
- end
78
- end
79
- end
80
- end
81
-
82
- describe '#follower_ids' do
83
- context 'with a screen name passed' do
84
- before do
85
- stub_get('/1.1/followers/ids.json').with(:query => {:screen_name => 'sferik', :cursor => '-1'}).to_return(:body => fixture('ids_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
86
- end
87
- it 'requests the correct resource' do
88
- @client.follower_ids('sferik')
89
- expect(a_get('/1.1/followers/ids.json').with(:query => {:screen_name => 'sferik', :cursor => '-1'})).to have_been_made
90
- end
91
- it 'returns an array of numeric IDs for every user following the specified user' do
92
- follower_ids = @client.follower_ids('sferik')
93
- expect(follower_ids).to be_a Twitter::Cursor
94
- expect(follower_ids.first).to eq(20_009_713)
95
- end
96
- context 'with each' do
97
- before do
98
- stub_get('/1.1/followers/ids.json').with(:query => {:screen_name => 'sferik', :cursor => '1305102810874389703'}).to_return(:body => fixture('ids_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
99
- end
100
- it 'requests the correct resource' do
101
- @client.follower_ids('sferik').each {}
102
- expect(a_get('/1.1/followers/ids.json').with(:query => {:screen_name => 'sferik', :cursor => '-1'})).to have_been_made
103
- expect(a_get('/1.1/followers/ids.json').with(:query => {:screen_name => 'sferik', :cursor => '1305102810874389703'})).to have_been_made
104
- end
105
- end
106
- end
107
- context 'with a user ID passed' do
108
- before do
109
- stub_get('/1.1/followers/ids.json').with(:query => {:user_id => '7505382', :cursor => '-1'}).to_return(:body => fixture('ids_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
110
- end
111
- it 'requests the correct resource' do
112
- @client.follower_ids(7_505_382)
113
- expect(a_get('/1.1/followers/ids.json').with(:query => {:user_id => '7505382', :cursor => '-1'})).to have_been_made
114
- end
115
- context 'with each' do
116
- before do
117
- stub_get('/1.1/followers/ids.json').with(:query => {:user_id => '7505382', :cursor => '1305102810874389703'}).to_return(:body => fixture('ids_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
118
- end
119
- it 'requests the correct resource' do
120
- @client.follower_ids(7_505_382).each {}
121
- expect(a_get('/1.1/followers/ids.json').with(:query => {:user_id => '7505382', :cursor => '-1'})).to have_been_made
122
- expect(a_get('/1.1/followers/ids.json').with(:query => {:user_id => '7505382', :cursor => '1305102810874389703'})).to have_been_made
123
- end
124
- end
125
- end
126
- context 'without arguments passed' do
127
- before do
128
- stub_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
129
- stub_get('/1.1/followers/ids.json').with(:query => {:user_id => '7505382', :cursor => '-1'}).to_return(:body => fixture('ids_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
130
- end
131
- it 'requests the correct resource' do
132
- @client.follower_ids
133
- expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
134
- expect(a_get('/1.1/followers/ids.json').with(:query => {:user_id => '7505382', :cursor => '-1'})).to have_been_made
135
- end
136
- it 'returns an array of numeric IDs for every user following the specified user' do
137
- follower_ids = @client.follower_ids
138
- expect(follower_ids).to be_a Twitter::Cursor
139
- expect(follower_ids.first).to eq(20_009_713)
140
- end
141
- context 'with each' do
142
- before do
143
- stub_get('/1.1/followers/ids.json').with(:query => {:user_id => '7505382', :cursor => '1305102810874389703'}).to_return(:body => fixture('ids_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
144
- end
145
- it 'requests the correct resource' do
146
- @client.follower_ids.each {}
147
- expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
148
- expect(a_get('/1.1/followers/ids.json').with(:query => {:user_id => '7505382', :cursor => '-1'})).to have_been_made
149
- expect(a_get('/1.1/followers/ids.json').with(:query => {:user_id => '7505382', :cursor => '1305102810874389703'})).to have_been_made
150
- end
151
- end
152
- end
153
- end
154
-
155
- describe '#friendships' do
156
- context 'with screen names passed' do
157
- before do
158
- stub_get('/1.1/friendships/lookup.json').with(:query => {:screen_name => 'sferik,pengwynn'}).to_return(:body => fixture('friendships.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
159
- end
160
- it 'requests the correct resource' do
161
- @client.friendships('sferik', 'pengwynn')
162
- expect(a_get('/1.1/friendships/lookup.json').with(:query => {:screen_name => 'sferik,pengwynn'})).to have_been_made
163
- end
164
- it 'returns up to 100 users worth of extended information' do
165
- friendships = @client.friendships('sferik', 'pengwynn')
166
- expect(friendships).to be_an Array
167
- expect(friendships.first).to be_a Twitter::User
168
- expect(friendships.first.id).to eq(7_505_382)
169
- expect(friendships.first.connections).to eq(['none'])
170
- end
171
- end
172
- context 'with numeric screen names passed' do
173
- before do
174
- stub_get('/1.1/friendships/lookup.json').with(:query => {:screen_name => '0,311'}).to_return(:body => fixture('friendships.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
175
- end
176
- it 'requests the correct resource' do
177
- @client.friendships('0', '311')
178
- expect(a_get('/1.1/friendships/lookup.json').with(:query => {:screen_name => '0,311'})).to have_been_made
179
- end
180
- end
181
- context 'with user IDs passed' do
182
- before do
183
- stub_get('/1.1/friendships/lookup.json').with(:query => {:user_id => '7505382,14100886'}).to_return(:body => fixture('friendships.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
184
- end
185
- it 'requests the correct resource' do
186
- @client.friendships(7_505_382, 14_100_886)
187
- expect(a_get('/1.1/friendships/lookup.json').with(:query => {:user_id => '7505382,14100886'})).to have_been_made
188
- end
189
- end
190
- context 'with both screen names and user IDs passed' do
191
- before do
192
- stub_get('/1.1/friendships/lookup.json').with(:query => {:screen_name => 'sferik', :user_id => '14100886'}).to_return(:body => fixture('friendships.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
193
- end
194
- it 'requests the correct resource' do
195
- @client.friendships('sferik', 14_100_886)
196
- expect(a_get('/1.1/friendships/lookup.json').with(:query => {:screen_name => 'sferik', :user_id => '14100886'})).to have_been_made
197
- end
198
- end
199
- end
200
-
201
- describe '#friendships' do
202
- context 'with screen names passed' do
203
- before do
204
- stub_get('/1.1/friendships/lookup.json').with(:query => {:screen_name => 'sferik,pengwynn'}).to_return(:body => fixture('friendships.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
205
- end
206
- it 'requests the correct resource' do
207
- @client.friendships('sferik', 'pengwynn')
208
- expect(a_get('/1.1/friendships/lookup.json').with(:query => {:screen_name => 'sferik,pengwynn'})).to have_been_made
209
- end
210
- it 'returns up to 100 users worth of extended information' do
211
- friendships = @client.friendships('sferik', 'pengwynn')
212
- expect(friendships).to be_an Array
213
- expect(friendships.first).to be_a Twitter::User
214
- expect(friendships.first.id).to eq(7_505_382)
215
- expect(friendships.first.connections).to eq(['none'])
216
- end
217
- end
218
- context 'with numeric screen names passed' do
219
- before do
220
- stub_get('/1.1/friendships/lookup.json').with(:query => {:screen_name => '0,311'}).to_return(:body => fixture('friendships.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
221
- end
222
- it 'requests the correct resource' do
223
- @client.friendships('0', '311')
224
- expect(a_get('/1.1/friendships/lookup.json').with(:query => {:screen_name => '0,311'})).to have_been_made
225
- end
226
- end
227
- context 'with user IDs passed' do
228
- before do
229
- stub_get('/1.1/friendships/lookup.json').with(:query => {:user_id => '7505382,14100886'}).to_return(:body => fixture('friendships.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
230
- end
231
- it 'requests the correct resource' do
232
- @client.friendships(7_505_382, 14_100_886)
233
- expect(a_get('/1.1/friendships/lookup.json').with(:query => {:user_id => '7505382,14100886'})).to have_been_made
234
- end
235
- end
236
- context 'with both screen names and user IDs passed' do
237
- before do
238
- stub_get('/1.1/friendships/lookup.json').with(:query => {:screen_name => 'sferik', :user_id => '14100886'}).to_return(:body => fixture('friendships.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
239
- end
240
- it 'requests the correct resource' do
241
- @client.friendships('sferik', 14_100_886)
242
- expect(a_get('/1.1/friendships/lookup.json').with(:query => {:screen_name => 'sferik', :user_id => '14100886'})).to have_been_made
243
- end
244
- end
245
- end
246
-
247
- describe '#friendships_incoming' do
248
- before do
249
- stub_get('/1.1/friendships/incoming.json').with(:query => {:cursor => '-1'}).to_return(:body => fixture('ids_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
250
- end
251
- it 'requests the correct resource' do
252
- @client.friendships_incoming
253
- expect(a_get('/1.1/friendships/incoming.json').with(:query => {:cursor => '-1'})).to have_been_made
254
- end
255
- it 'returns an array of numeric IDs for every user who has a pending request to follow the authenticating user' do
256
- friendships_incoming = @client.friendships_incoming
257
- expect(friendships_incoming).to be_a Twitter::Cursor
258
- expect(friendships_incoming.first).to eq(20_009_713)
259
- end
260
- context 'with each' do
261
- before do
262
- 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'})
263
- end
264
- it 'requests the correct resource' do
265
- @client.friendships_incoming.each {}
266
- expect(a_get('/1.1/friendships/incoming.json').with(:query => {:cursor => '1305102810874389703'})).to have_been_made
267
- end
268
- end
269
- end
270
-
271
- describe '#friendships_outgoing' do
272
- before do
273
- stub_get('/1.1/friendships/outgoing.json').with(:query => {:cursor => '-1'}).to_return(:body => fixture('ids_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
274
- end
275
- it 'requests the correct resource' do
276
- @client.friendships_outgoing
277
- expect(a_get('/1.1/friendships/outgoing.json').with(:query => {:cursor => '-1'})).to have_been_made
278
- end
279
- it 'returns an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request' do
280
- friendships_outgoing = @client.friendships_outgoing
281
- expect(friendships_outgoing).to be_a Twitter::Cursor
282
- expect(friendships_outgoing.first).to eq(20_009_713)
283
- end
284
- context 'with each' do
285
- before do
286
- 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'})
287
- end
288
- it 'requests the correct resource' do
289
- @client.friendships_outgoing.each {}
290
- expect(a_get('/1.1/friendships/outgoing.json').with(:query => {:cursor => '1305102810874389703'})).to have_been_made
291
- end
292
- end
293
- end
294
-
295
- describe '#follow' do
296
- before do
297
- stub_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
298
- stub_get('/1.1/friends/ids.json').with(:query => {:user_id => '7505382', :cursor => '-1'}).to_return(:body => fixture('ids_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
299
- stub_post('/1.1/users/lookup.json').with(:body => {:screen_name => 'sferik,pengwynn'}).to_return(:body => fixture('friendships.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
300
- stub_post('/1.1/friendships/create.json').with(:body => {:user_id => '7505382'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
301
- end
302
- it 'requests the correct resource' do
303
- @client.follow('sferik', 'pengwynn')
304
- expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
305
- expect(a_get('/1.1/friends/ids.json').with(:query => {:user_id => '7505382', :cursor => '-1'})).to have_been_made
306
- expect(a_post('/1.1/users/lookup.json').with(:body => {:screen_name => 'sferik,pengwynn'})).to have_been_made
307
- expect(a_post('/1.1/friendships/create.json').with(:body => {:user_id => '7505382'})).to have_been_made
308
- end
309
- end
310
-
311
- describe '#follow!' do
312
- before do
313
- stub_post('/1.1/friendships/create.json').with(:body => {:screen_name => 'sferik'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
314
- end
315
- it 'requests the correct resource' do
316
- @client.follow!('sferik')
317
- expect(a_post('/1.1/friendships/create.json').with(:body => {:screen_name => 'sferik'})).to have_been_made
318
- end
319
- it 'returns an array of befriended users' do
320
- users = @client.follow!('sferik')
321
- expect(users).to be_an Array
322
- expect(users.first).to be_a Twitter::User
323
- expect(users.first.id).to eq(7_505_382)
324
- end
325
- end
326
- context 'with a user object passed' do
327
- before do
328
- stub_post('/1.1/friendships/create.json').with(:body => {:user_id => '7505382'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
329
- end
330
- it 'requests the correct resources' do
331
- user = Twitter::User.new(:id => '7505382')
332
- @client.follow!(user)
333
- expect(a_post('/1.1/friendships/create.json').with(:body => {:user_id => '7505382'})).to have_been_made
334
- end
335
- end
336
- context 'with a URI object passed' do
337
- before do
338
- stub_post('/1.1/friendships/create.json').with(:body => {:screen_name => 'sferik'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
339
- end
340
- it 'requests the correct resource' do
341
- user = URI.parse('https://twitter.com/sferik')
342
- @client.follow!(user)
343
- expect(a_post('/1.1/friendships/create.json').with(:body => {:screen_name => 'sferik'})).to have_been_made
344
- end
345
- end
346
- context 'with a URI string passed' do
347
- before do
348
- stub_post('/1.1/friendships/create.json').with(:body => {:screen_name => 'sferik'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
349
- end
350
- it 'requests the correct resource' do
351
- @client.follow!('https://twitter.com/sferik')
352
- expect(a_post('/1.1/friendships/create.json').with(:body => {:screen_name => 'sferik'})).to have_been_made
353
- end
354
- end
355
- context 'with a forbidden error' do
356
- before do
357
- stub_post('/1.1/friendships/create.json').with(:body => {:screen_name => 'sferik'}).to_return(:status => 403, :body => fixture('forbidden.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
358
- end
359
- it 'raises an exception' do
360
- expect { @client.follow!('sferik') }.to raise_error(Twitter::Error::Forbidden)
361
- end
362
- end
363
-
364
- describe '#unfollow' do
365
- before do
366
- 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'})
367
- end
368
- it 'requests the correct resource' do
369
- @client.unfollow('sferik')
370
- expect(a_post('/1.1/friendships/destroy.json').with(:body => {:screen_name => 'sferik'})).to have_been_made
371
- end
372
- it 'returns an array of unfollowed users' do
373
- users = @client.unfollow('sferik')
374
- expect(users).to be_an Array
375
- expect(users.first).to be_a Twitter::User
376
- expect(users.first.id).to eq(7_505_382)
377
- end
378
- end
379
-
380
- describe '#friendship_update' do
381
- before do
382
- stub_post('/1.1/friendships/update.json').with(:body => {:screen_name => 'sferik', :retweets => 'true'}).to_return(:body => fixture('following.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
383
- end
384
- it 'requests the correct resource' do
385
- @client.friendship_update('sferik', :retweets => true)
386
- expect(a_post('/1.1/friendships/update.json').with(:body => {:screen_name => 'sferik', :retweets => 'true'})).to have_been_made
387
- end
388
- it 'returns detailed information about the relationship between two users' do
389
- relationship = @client.friendship_update('sferik', :retweets => true)
390
- expect(relationship).to be_a Twitter::Relationship
391
- expect(relationship.source.id).to eq(7_505_382)
392
- end
393
- end
394
-
395
- describe '#friendship' do
396
- context 'with screen names passed' do
397
- before do
398
- stub_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => 'sferik', :target_screen_name => 'pengwynn'}).to_return(:body => fixture('following.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
399
- end
400
- it 'requests the correct resource' do
401
- @client.friendship('sferik', 'pengwynn')
402
- expect(a_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => 'sferik', :target_screen_name => 'pengwynn'})).to have_been_made
403
- end
404
- it 'returns detailed information about the relationship between two users' do
405
- relationship = @client.friendship('sferik', 'pengwynn')
406
- expect(relationship).to be_a Twitter::Relationship
407
- expect(relationship.source.id).to eq(7_505_382)
408
- end
409
- end
410
- context 'with numeric screen names passed' do
411
- before do
412
- stub_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => '0', :target_screen_name => '311'}).to_return(:body => fixture('following.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
413
- end
414
- it 'requests the correct resource' do
415
- @client.friendship('0', '311')
416
- expect(a_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => '0', :target_screen_name => '311'})).to have_been_made
417
- end
418
- end
419
- context 'with user IDs passed' do
420
- before do
421
- stub_get('/1.1/friendships/show.json').with(:query => {:source_id => '7505382', :target_id => '14100886'}).to_return(:body => fixture('following.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
422
- end
423
- it 'requests the correct resource' do
424
- @client.friendship(7_505_382, 14_100_886)
425
- expect(a_get('/1.1/friendships/show.json').with(:query => {:source_id => '7505382', :target_id => '14100886'})).to have_been_made
426
- end
427
- end
428
- context 'with user objects passed' do
429
- before do
430
- stub_get('/1.1/friendships/show.json').with(:query => {:source_id => '7505382', :target_id => '14100886'}).to_return(:body => fixture('following.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
431
- end
432
- it 'requests the correct resource' do
433
- user1 = Twitter::User.new(:id => '7505382')
434
- user2 = Twitter::User.new(:id => '14100886')
435
- @client.friendship(user1, user2)
436
- expect(a_get('/1.1/friendships/show.json').with(:query => {:source_id => '7505382', :target_id => '14100886'})).to have_been_made
437
- end
438
- end
439
- context 'with URI objects passed' do
440
- before do
441
- stub_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => 'sferik', :target_screen_name => 'pengwynn'}).to_return(:body => fixture('following.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
442
- end
443
- it 'requests the correct resource' do
444
- user1 = URI.parse('https://twitter.com/sferik')
445
- user2 = URI.parse('https://twitter.com/pengwynn')
446
- @client.friendship(user1, user2)
447
- expect(a_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => 'sferik', :target_screen_name => 'pengwynn'})).to have_been_made
448
- end
449
- end
450
- context 'with URI strings passed' do
451
- before do
452
- stub_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => 'sferik', :target_screen_name => 'pengwynn'}).to_return(:body => fixture('following.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
453
- end
454
- it 'requests the correct resource' do
455
- @client.friendship('https://twitter.com/sferik', 'https://twitter.com/pengwynn')
456
- expect(a_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => 'sferik', :target_screen_name => 'pengwynn'})).to have_been_made
457
- end
458
- end
459
- end
460
-
461
- describe '#friendship?' do
462
- context 'with screen names passed' do
463
- before do
464
- stub_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => 'sferik', :target_screen_name => 'pengwynn'}).to_return(:body => fixture('following.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
465
- stub_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => 'pengwynn', :target_screen_name => 'sferik'}).to_return(:body => fixture('not_following.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
466
- end
467
- it 'requests the correct resource' do
468
- @client.friendship?('sferik', 'pengwynn')
469
- expect(a_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => 'sferik', :target_screen_name => 'pengwynn'})).to have_been_made
470
- end
471
- it 'returns true if user A follows user B' do
472
- friendship = @client.friendship?('sferik', 'pengwynn')
473
- expect(friendship).to be true
474
- end
475
- it 'returns false if user A does not follow user B' do
476
- friendship = @client.friendship?('pengwynn', 'sferik')
477
- expect(friendship).to be false
478
- end
479
- end
480
- context 'with user IDs passed' do
481
- before do
482
- stub_get('/1.1/friendships/show.json').with(:query => {:source_id => '7505382', :target_id => '14100886'}).to_return(:body => fixture('following.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
483
- end
484
- it 'requests the correct resource' do
485
- @client.friendship?(7_505_382, 14_100_886)
486
- expect(a_get('/1.1/friendships/show.json').with(:query => {:source_id => '7505382', :target_id => '14100886'})).to have_been_made
487
- end
488
- end
489
- context 'with user objects passed' do
490
- before do
491
- stub_get('/1.1/friendships/show.json').with(:query => {:source_id => '7505382', :target_id => '14100886'}).to_return(:body => fixture('following.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
492
- end
493
- it 'requests the correct resource' do
494
- user1 = Twitter::User.new(:id => '7505382')
495
- user2 = Twitter::User.new(:id => '14100886')
496
- @client.friendship?(user1, user2)
497
- expect(a_get('/1.1/friendships/show.json').with(:query => {:source_id => '7505382', :target_id => '14100886'})).to have_been_made
498
- end
499
- end
500
- end
501
-
502
- describe '#followers' do
503
- context 'with a screen_name passed' do
504
- before do
505
- stub_get('/1.1/followers/list.json').with(:query => {:screen_name => 'sferik', :cursor => '-1'}).to_return(:body => fixture('followers_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
506
- end
507
- it 'requests the correct resource' do
508
- @client.followers('sferik')
509
- expect(a_get('/1.1/followers/list.json').with(:query => {:screen_name => 'sferik', :cursor => '-1'})).to have_been_made
510
- end
511
- it 'returns a cursor of followers with details for every user the specified user is followed by' do
512
- followers = @client.followers('sferik')
513
- expect(followers).to be_a Twitter::Cursor
514
- expect(followers.first).to be_a Twitter::User
515
- end
516
- context 'with each' do
517
- before do
518
- stub_get('/1.1/followers/list.json').with(:query => {:screen_name => 'sferik', :cursor => '1419103567112105362'}).to_return(:body => fixture('followers_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
519
- end
520
- it 'requests the correct resource' do
521
- @client.followers('sferik').each {}
522
- expect(a_get('/1.1/followers/list.json').with(:query => {:screen_name => 'sferik', :cursor => '-1'})).to have_been_made
523
- expect(a_get('/1.1/followers/list.json').with(:query => {:screen_name => 'sferik', :cursor => '1419103567112105362'})).to have_been_made
524
- end
525
- end
526
- end
527
- context 'with a user ID passed' do
528
- before do
529
- stub_get('/1.1/followers/list.json').with(:query => {:user_id => '7505382', :cursor => '-1'}).to_return(:body => fixture('followers_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
530
- end
531
- it 'requests the correct resource' do
532
- @client.followers(7_505_382)
533
- expect(a_get('/1.1/followers/list.json').with(:query => {:user_id => '7505382', :cursor => '-1'})).to have_been_made
534
- end
535
- context 'with each' do
536
- before do
537
- stub_get('/1.1/followers/list.json').with(:query => {:user_id => '7505382', :cursor => '1419103567112105362'}).to_return(:body => fixture('followers_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
538
- end
539
- it 'requests the correct resource' do
540
- @client.followers(7_505_382).each {}
541
- expect(a_get('/1.1/followers/list.json').with(:query => {:user_id => '7505382', :cursor => '-1'})).to have_been_made
542
- expect(a_get('/1.1/followers/list.json').with(:query => {:user_id => '7505382', :cursor => '1419103567112105362'})).to have_been_made
543
- end
544
- end
545
- end
546
- context 'without arguments passed' do
547
- before do
548
- stub_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
549
- stub_get('/1.1/followers/list.json').with(:query => {:user_id => '7505382', :cursor => '-1'}).to_return(:body => fixture('followers_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
550
- end
551
- it 'requests the correct resource' do
552
- @client.followers
553
- expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
554
- expect(a_get('/1.1/followers/list.json').with(:query => {:user_id => '7505382', :cursor => '-1'})).to have_been_made
555
- end
556
- it 'returns a cursor of followers with details for every user the specified user is followed by' do
557
- followers = @client.followers
558
- expect(followers).to be_a Twitter::Cursor
559
- expect(followers.first).to be_a Twitter::User
560
- end
561
- context 'with each' do
562
- before do
563
- stub_get('/1.1/followers/list.json').with(:query => {:user_id => '7505382', :cursor => '1419103567112105362'}).to_return(:body => fixture('followers_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
564
- end
565
- it 'requests the correct resource' do
566
- @client.followers.each {}
567
- expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
568
- expect(a_get('/1.1/followers/list.json').with(:query => {:user_id => '7505382', :cursor => '-1'})).to have_been_made
569
- expect(a_get('/1.1/followers/list.json').with(:query => {:user_id => '7505382', :cursor => '1419103567112105362'})).to have_been_made
570
- end
571
- end
572
- end
573
- end
574
-
575
- describe '#friends' do
576
- context 'with a screen_name passed' do
577
- before do
578
- stub_get('/1.1/friends/list.json').with(:query => {:screen_name => 'sferik', :cursor => '-1'}).to_return(:body => fixture('friends_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
579
- end
580
- it 'requests the correct resource' do
581
- @client.friends('sferik')
582
- expect(a_get('/1.1/friends/list.json').with(:query => {:screen_name => 'sferik', :cursor => '-1'})).to have_been_made
583
- end
584
- it 'returns a cursor of friends with details for every user the specified user is following' do
585
- friends = @client.friends('sferik')
586
- expect(friends).to be_a Twitter::Cursor
587
- expect(friends.first).to be_a Twitter::User
588
- end
589
- context 'with each' do
590
- before do
591
- stub_get('/1.1/friends/list.json').with(:query => {:screen_name => 'sferik', :cursor => '1418947360875712729'}).to_return(:body => fixture('friends_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
592
- end
593
- it 'requests the correct resource' do
594
- @client.friends('sferik').each {}
595
- expect(a_get('/1.1/friends/list.json').with(:query => {:screen_name => 'sferik', :cursor => '-1'})).to have_been_made
596
- expect(a_get('/1.1/friends/list.json').with(:query => {:screen_name => 'sferik', :cursor => '1418947360875712729'})).to have_been_made
597
- end
598
- end
599
- end
600
- context 'with a user ID passed' do
601
- before do
602
- stub_get('/1.1/friends/list.json').with(:query => {:user_id => '7505382', :cursor => '-1'}).to_return(:body => fixture('friends_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
603
- end
604
- it 'requests the correct resource' do
605
- @client.friends(7_505_382)
606
- expect(a_get('/1.1/friends/list.json').with(:query => {:user_id => '7505382', :cursor => '-1'})).to have_been_made
607
- end
608
- context 'with each' do
609
- before do
610
- stub_get('/1.1/friends/list.json').with(:query => {:user_id => '7505382', :cursor => '1418947360875712729'}).to_return(:body => fixture('friends_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
611
- end
612
- it 'requests the correct resource' do
613
- @client.friends(7_505_382).each {}
614
- expect(a_get('/1.1/friends/list.json').with(:query => {:user_id => '7505382', :cursor => '-1'})).to have_been_made
615
- expect(a_get('/1.1/friends/list.json').with(:query => {:user_id => '7505382', :cursor => '1418947360875712729'})).to have_been_made
616
- end
617
- end
618
- end
619
- context 'without arguments passed' do
620
- before do
621
- stub_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
622
- stub_get('/1.1/friends/list.json').with(:query => {:user_id => '7505382', :cursor => '-1'}).to_return(:body => fixture('friends_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
623
- end
624
- it 'requests the correct resource' do
625
- @client.friends
626
- expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
627
- expect(a_get('/1.1/friends/list.json').with(:query => {:user_id => '7505382', :cursor => '-1'})).to have_been_made
628
- end
629
- it 'returns a cursor of friends with details for every user the specified user is following' do
630
- friends = @client.friends
631
- expect(friends).to be_a Twitter::Cursor
632
- expect(friends.first).to be_a Twitter::User
633
- end
634
- context 'with each' do
635
- before do
636
- stub_get('/1.1/friends/list.json').with(:query => {:user_id => '7505382', :cursor => '1418947360875712729'}).to_return(:body => fixture('friends_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
637
- end
638
- it 'requests the correct resource' do
639
- @client.friends.each {}
640
- expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
641
- expect(a_get('/1.1/friends/list.json').with(:query => {:user_id => '7505382', :cursor => '-1'})).to have_been_made
642
- expect(a_get('/1.1/friends/list.json').with(:query => {:user_id => '7505382', :cursor => '1418947360875712729'})).to have_been_made
643
- end
644
- end
645
- end
646
- end
647
-
648
- describe '#no_retweet_ids' do
649
- before do
650
- stub_get('/1.1/friendships/no_retweets/ids.json').to_return(:body => fixture('ids.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
651
- end
652
- it 'requests the correct resource' do
653
- @client.no_retweet_ids
654
- expect(a_get('/1.1/friendships/no_retweets/ids.json')).to have_been_made
655
- end
656
- it 'requests the correct resource when the alias is called' do
657
- @client.no_retweets_ids
658
- expect(a_get('/1.1/friendships/no_retweets/ids.json')).to have_been_made
659
- end
660
- it 'returns users ids of those that do not wish to be retweeted' do
661
- no_retweet_ids = @client.no_retweet_ids
662
- expect(no_retweet_ids).to be_an Array
663
- expect(no_retweet_ids.first).to be_an Integer
664
- expect(no_retweet_ids.first).to eq(47)
665
- end
666
- end
667
- end