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,68 +0,0 @@
1
- require 'helper'
2
-
3
- describe Twitter::REST::Trends 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 '#trends' do
10
- context 'with woeid passed' do
11
- before do
12
- stub_get('/1.1/trends/place.json').with(:query => {:id => '2487956'}).to_return(:body => fixture('matching_trends.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
13
- end
14
- it 'requests the correct resource' do
15
- @client.trends(2_487_956)
16
- expect(a_get('/1.1/trends/place.json').with(:query => {:id => '2487956'})).to have_been_made
17
- end
18
- it 'returns the top 10 trending topics for a specific WOEID' do
19
- matching_trends = @client.trends(2_487_956)
20
- expect(matching_trends).to be_a Twitter::TrendResults
21
- expect(matching_trends.first).to be_a Twitter::Trend
22
- expect(matching_trends.first.name).to eq('#sevenwordsaftersex')
23
- end
24
- end
25
- context 'without arguments passed' do
26
- before do
27
- stub_get('/1.1/trends/place.json').with(:query => {:id => '1'}).to_return(:body => fixture('matching_trends.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
28
- end
29
- it 'requests the correct resource' do
30
- @client.trends
31
- expect(a_get('/1.1/trends/place.json').with(:query => {:id => '1'})).to have_been_made
32
- end
33
- end
34
- end
35
-
36
- describe '#trends_available' do
37
- before do
38
- stub_get('/1.1/trends/available.json').to_return(:body => fixture('locations.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
39
- end
40
- it 'requests the correct resource' do
41
- @client.trends_available
42
- expect(a_get('/1.1/trends/available.json')).to have_been_made
43
- end
44
- it 'returns the locations that Twitter has trending topic information for' do
45
- locations = @client.trends_available
46
- expect(locations).to be_an Array
47
- expect(locations.first).to be_a Twitter::Place
48
- expect(locations.first.name).to eq('Ireland')
49
- end
50
- end
51
-
52
- describe '#trends_closest' do
53
- before do
54
- stub_get('/1.1/trends/closest.json').to_return(:body => fixture('locations.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
55
- end
56
- it 'requests the correct resource' do
57
- @client.trends_closest
58
- expect(a_get('/1.1/trends/closest.json')).to have_been_made
59
- end
60
- it 'returns the locations that Twitter has trending topic information for' do
61
- locations = @client.trends_closest
62
- expect(locations).to be_an Array
63
- expect(locations.first).to be_a Twitter::Place
64
- expect(locations.first.name).to eq('Ireland')
65
- end
66
- end
67
-
68
- end
@@ -1,614 +0,0 @@
1
- # coding: utf-8
2
- require 'helper'
3
-
4
- describe Twitter::REST::Tweets do
5
-
6
- before do
7
- @client = Twitter::REST::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :access_token => 'AT', :access_token_secret => 'AS')
8
- end
9
-
10
- describe '#retweets' do
11
- before do
12
- stub_get('/1.1/statuses/retweets/25938088801.json').to_return(:body => fixture('retweets.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
13
- end
14
- context 'with a tweet ID passed' do
15
- it 'requests the correct resource' do
16
- @client.retweets(25_938_088_801)
17
- expect(a_get('/1.1/statuses/retweets/25938088801.json')).to have_been_made
18
- end
19
- it 'returns up to 100 of the first retweets of a given tweet' do
20
- tweets = @client.retweets(25_938_088_801)
21
- expect(tweets).to be_an Array
22
- expect(tweets.first).to be_a Twitter::Tweet
23
- expect(tweets.first.text).to eq("RT @gruber: As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush.")
24
- end
25
- end
26
- context 'with a URI object passed' do
27
- it 'requests the correct resource' do
28
- tweet = URI.parse('https://twitter.com/sferik/status/25938088801')
29
- @client.retweets(tweet)
30
- expect(a_get('/1.1/statuses/retweets/25938088801.json')).to have_been_made
31
- end
32
- end
33
- context 'with a URI string passed' do
34
- it 'requests the correct resource' do
35
- @client.retweets('https://twitter.com/sferik/status/25938088801')
36
- expect(a_get('/1.1/statuses/retweets/25938088801.json')).to have_been_made
37
- end
38
- end
39
- context 'with a Tweet passed' do
40
- it 'requests the correct resource' do
41
- tweet = Twitter::Tweet.new(:id => 25_938_088_801)
42
- @client.retweets(tweet)
43
- expect(a_get('/1.1/statuses/retweets/25938088801.json')).to have_been_made
44
- end
45
- end
46
- end
47
-
48
- describe '#retweeters_of' do
49
- context 'with ids_only passed' do
50
- context 'with a tweet ID passed' do
51
- before do
52
- stub_get('/1.1/statuses/retweets/25938088801.json').to_return(:body => fixture('retweets.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
53
- end
54
- it 'requests the correct resource' do
55
- @client.retweeters_of(25_938_088_801, :ids_only => true)
56
- expect(a_get('/1.1/statuses/retweets/25938088801.json')).to have_been_made
57
- end
58
- it 'returns an array of numeric user IDs of retweeters of a Tweet' do
59
- ids = @client.retweeters_of(25_938_088_801, :ids_only => true)
60
- expect(ids).to be_an Array
61
- expect(ids.first).to eq(7_505_382)
62
- end
63
- end
64
- end
65
- context 'without ids_only passed' do
66
- before do
67
- stub_get('/1.1/statuses/retweets/25938088801.json').to_return(:body => fixture('retweets.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
68
- end
69
- it 'requests the correct resource' do
70
- @client.retweeters_of(25_938_088_801)
71
- expect(a_get('/1.1/statuses/retweets/25938088801.json')).to have_been_made
72
- end
73
- it 'returns an array of user of retweeters of a Tweet' do
74
- users = @client.retweeters_of(25_938_088_801)
75
- expect(users).to be_an Array
76
- expect(users.first).to be_a Twitter::User
77
- expect(users.first.id).to eq(7_505_382)
78
- end
79
- context 'with a URI object passed' do
80
- it 'requests the correct resource' do
81
- tweet = URI.parse('https://twitter.com/sferik/status/25938088801')
82
- @client.retweeters_of(tweet)
83
- expect(a_get('/1.1/statuses/retweets/25938088801.json')).to have_been_made
84
- end
85
- end
86
- context 'with a URI string passed' do
87
- it 'requests the correct resource' do
88
- @client.retweeters_of('https://twitter.com/sferik/status/25938088801')
89
- expect(a_get('/1.1/statuses/retweets/25938088801.json')).to have_been_made
90
- end
91
- end
92
- context 'with a Tweet passed' do
93
- it 'requests the correct resource' do
94
- tweet = Twitter::Tweet.new(:id => 25_938_088_801)
95
- @client.retweeters_of(tweet)
96
- expect(a_get('/1.1/statuses/retweets/25938088801.json')).to have_been_made
97
- end
98
- end
99
- end
100
- end
101
-
102
- describe '#status' do
103
- before do
104
- stub_get('/1.1/statuses/show/25938088801.json').to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
105
- end
106
- it 'requests the correct resource' do
107
- @client.status(25_938_088_801)
108
- expect(a_get('/1.1/statuses/show/25938088801.json')).to have_been_made
109
- end
110
- it 'returns a Tweet' do
111
- tweet = @client.status(25_938_088_801)
112
- expect(tweet).to be_a Twitter::Tweet
113
- expect(tweet.text).to eq("\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9")
114
- end
115
- context 'with a URI object passed' do
116
- it 'requests the correct resource' do
117
- tweet = URI.parse('https://twitter.com/sferik/status/25938088801')
118
- @client.status(tweet)
119
- expect(a_get('/1.1/statuses/show/25938088801.json')).to have_been_made
120
- end
121
- end
122
- context 'with a URI string passed' do
123
- it 'requests the correct resource' do
124
- @client.status('https://twitter.com/sferik/status/25938088801')
125
- expect(a_get('/1.1/statuses/show/25938088801.json')).to have_been_made
126
- end
127
- end
128
- context 'with a Tweet passed' do
129
- it 'requests the correct resource' do
130
- tweet = Twitter::Tweet.new(:id => 25_938_088_801)
131
- @client.status(tweet)
132
- expect(a_get('/1.1/statuses/show/25938088801.json')).to have_been_made
133
- end
134
- end
135
- end
136
-
137
- describe '#statuses' do
138
- before do
139
- stub_post('/1.1/statuses/lookup.json').with(:body => {:id => '25938088801,91151181040201728'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
140
- end
141
- it 'requests the correct resource' do
142
- @client.statuses(25_938_088_801, 91_151_181_040_201_728)
143
- expect(a_post('/1.1/statuses/lookup.json').with(:body => {:id => '25938088801,91151181040201728'})).to have_been_made
144
- end
145
- it 'returns an array of Tweets' do
146
- tweets = @client.statuses(25_938_088_801, 91_151_181_040_201_728)
147
- expect(tweets).to be_an Array
148
- expect(tweets.first).to be_a Twitter::Tweet
149
- expect(tweets.first.text).to eq('Happy Birthday @imdane. Watch out for those @rally pranksters!')
150
- end
151
- context 'with URI objects passed' do
152
- it 'requests the correct resource' do
153
- @client.statuses(URI.parse('https://twitter.com/sferik/status/25938088801'), URI.parse('https://twitter.com/sferik/status/91151181040201728'))
154
- expect(a_post('/1.1/statuses/lookup.json').with(:body => {:id => '25938088801,91151181040201728'})).to have_been_made
155
- end
156
- end
157
- context 'with URI strings passed' do
158
- it 'requests the correct resource' do
159
- @client.statuses('https://twitter.com/sferik/status/25938088801', 'https://twitter.com/sferik/status/91151181040201728')
160
- expect(a_post('/1.1/statuses/lookup.json').with(:body => {:id => '25938088801,91151181040201728'})).to have_been_made
161
- end
162
- end
163
- context 'with Tweets passed' do
164
- it 'requests the correct resource' do
165
- @client.statuses(Twitter::Tweet.new(:id => 25_938_088_801), Twitter::Tweet.new(:id => 91_151_181_040_201_728))
166
- expect(a_post('/1.1/statuses/lookup.json').with(:body => {:id => '25938088801,91151181040201728'})).to have_been_made
167
- end
168
- end
169
- end
170
-
171
- describe '#destroy_status' do
172
- before do
173
- stub_post('/1.1/statuses/destroy/25938088801.json').to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
174
- end
175
- it 'requests the correct resource' do
176
- @client.destroy_status(25_938_088_801)
177
- expect(a_post('/1.1/statuses/destroy/25938088801.json')).to have_been_made
178
- end
179
- it 'returns an array of Tweets' do
180
- tweets = @client.destroy_status(25_938_088_801)
181
- expect(tweets).to be_an Array
182
- expect(tweets.first).to be_a Twitter::Tweet
183
- expect(tweets.first.text).to eq("\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9")
184
- end
185
- context 'with a URI object passed' do
186
- it 'requests the correct resource' do
187
- tweet = URI.parse('https://twitter.com/sferik/status/25938088801')
188
- @client.destroy_status(tweet)
189
- expect(a_post('/1.1/statuses/destroy/25938088801.json')).to have_been_made
190
- end
191
- end
192
- context 'with a URI string passed' do
193
- it 'requests the correct resource' do
194
- @client.destroy_status('https://twitter.com/sferik/status/25938088801')
195
- expect(a_post('/1.1/statuses/destroy/25938088801.json')).to have_been_made
196
- end
197
- end
198
- context 'with a Tweet passed' do
199
- it 'requests the correct resource' do
200
- tweet = Twitter::Tweet.new(:id => 25_938_088_801)
201
- @client.destroy_status(tweet)
202
- expect(a_post('/1.1/statuses/destroy/25938088801.json')).to have_been_made
203
- end
204
- end
205
- end
206
-
207
- describe '#update' do
208
- before do
209
- stub_post('/1.1/statuses/update.json').with(:body => {:status => "\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9"}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
210
- end
211
- it 'requests the correct resource' do
212
- @client.update("\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9")
213
- expect(a_post('/1.1/statuses/update.json').with(:body => {:status => "\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9"})).to have_been_made
214
- end
215
- it 'returns a Tweet' do
216
- tweet = @client.update("\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9")
217
- expect(tweet).to be_a Twitter::Tweet
218
- expect(tweet.text).to eq("\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9")
219
- end
220
- context 'already posted' do
221
- before do
222
- stub_post('/1.1/statuses/update.json').to_return(:status => 403, :body => fixture('already_posted.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
223
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => 1}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
224
- end
225
- it 'requests the correct resources' do
226
- @client.update("\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9")
227
- expect(a_post('/1.1/statuses/update.json').with(:body => {:status => "\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9"})).to have_been_made
228
- expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => 1})).to have_been_made
229
- end
230
- it 'returns a Tweet' do
231
- tweet = @client.update("\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9")
232
- expect(tweet).to be_a Twitter::Tweet
233
- expect(tweet.text).to eq('Happy Birthday @imdane. Watch out for those @rally pranksters!')
234
- end
235
- end
236
- context 'with an in-reply-to status' do
237
- before do
238
- @tweet = Twitter::Tweet.new(:id => 1)
239
- stub_post('/1.1/statuses/update.json').with(:body => {:status => "\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", :in_reply_to_status_id => '1'}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
240
- end
241
- it 'requests the correct resource' do
242
- @client.update("\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", :in_reply_to_status => @tweet)
243
- expect(a_post('/1.1/statuses/update.json').with(:body => {:status => "\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", :in_reply_to_status_id => '1'})).to have_been_made
244
- end
245
- end
246
- context 'with an in-reply-to status ID' do
247
- before do
248
- stub_post('/1.1/statuses/update.json').with(:body => {:status => "\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", :in_reply_to_status_id => '1'}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
249
- end
250
- it 'requests the correct resource' do
251
- @client.update("\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", :in_reply_to_status_id => 1)
252
- expect(a_post('/1.1/statuses/update.json').with(:body => {:status => "\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", :in_reply_to_status_id => '1'})).to have_been_made
253
- end
254
- end
255
- context 'with a place' do
256
- before do
257
- @place = Twitter::Place.new(:woeid => 'df51dec6f4ee2b2c')
258
- stub_post('/1.1/statuses/update.json').with(:body => {:status => "\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", :place_id => 'df51dec6f4ee2b2c'}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
259
- end
260
- it 'requests the correct resource' do
261
- @client.update("\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", :place => @place)
262
- expect(a_post('/1.1/statuses/update.json').with(:body => {:status => "\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", :place_id => 'df51dec6f4ee2b2c'})).to have_been_made
263
- end
264
- end
265
- context 'with a place ID' do
266
- before do
267
- stub_post('/1.1/statuses/update.json').with(:body => {:status => "\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", :place_id => 'df51dec6f4ee2b2c'}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
268
- end
269
- it 'requests the correct resource' do
270
- @client.update("\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", :place_id => 'df51dec6f4ee2b2c')
271
- expect(a_post('/1.1/statuses/update.json').with(:body => {:status => "\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", :place_id => 'df51dec6f4ee2b2c'})).to have_been_made
272
- end
273
- end
274
- end
275
-
276
- describe '#update!' do
277
- before do
278
- stub_post('/1.1/statuses/update.json').with(:body => {:status => "\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9"}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
279
- end
280
- it 'requests the correct resource' do
281
- @client.update!("\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9")
282
- expect(a_post('/1.1/statuses/update.json').with(:body => {:status => "\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9"})).to have_been_made
283
- end
284
- it 'returns a Tweet' do
285
- tweet = @client.update!("\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9")
286
- expect(tweet).to be_a Twitter::Tweet
287
- expect(tweet.text).to eq("\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9")
288
- end
289
- context 'already posted' do
290
- before do
291
- stub_post('/1.1/statuses/update.json').to_return(:status => 403, :body => fixture('already_posted.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
292
- end
293
- it 'raises an DuplicateStatus error' do
294
- expect { @client.update!("\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9") }.to raise_error(Twitter::Error::DuplicateStatus)
295
- end
296
- end
297
- context 'with an in-reply-to status' do
298
- before do
299
- @tweet = Twitter::Tweet.new(:id => 1)
300
- stub_post('/1.1/statuses/update.json').with(:body => {:status => "\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", :in_reply_to_status_id => '1'}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
301
- end
302
- it 'requests the correct resource' do
303
- @client.update!("\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", :in_reply_to_status => @tweet)
304
- expect(a_post('/1.1/statuses/update.json').with(:body => {:status => "\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", :in_reply_to_status_id => '1'})).to have_been_made
305
- end
306
- end
307
- context 'with an in-reply-to status ID' do
308
- before do
309
- stub_post('/1.1/statuses/update.json').with(:body => {:status => "\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", :in_reply_to_status_id => '1'}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
310
- end
311
- it 'requests the correct resource' do
312
- @client.update!("\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", :in_reply_to_status_id => 1)
313
- expect(a_post('/1.1/statuses/update.json').with(:body => {:status => "\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", :in_reply_to_status_id => '1'})).to have_been_made
314
- end
315
- end
316
- context 'with a place' do
317
- before do
318
- @place = Twitter::Place.new(:woeid => 'df51dec6f4ee2b2c')
319
- stub_post('/1.1/statuses/update.json').with(:body => {:status => "\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", :place_id => 'df51dec6f4ee2b2c'}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
320
- end
321
- it 'requests the correct resource' do
322
- @client.update!("\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", :place => @place)
323
- expect(a_post('/1.1/statuses/update.json').with(:body => {:status => "\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", :place_id => 'df51dec6f4ee2b2c'})).to have_been_made
324
- end
325
- end
326
- context 'with a place ID' do
327
- before do
328
- stub_post('/1.1/statuses/update.json').with(:body => {:status => "\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", :place_id => 'df51dec6f4ee2b2c'}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
329
- end
330
- it 'requests the correct resource' do
331
- @client.update!("\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", :place_id => 'df51dec6f4ee2b2c')
332
- expect(a_post('/1.1/statuses/update.json').with(:body => {:status => "\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", :place_id => 'df51dec6f4ee2b2c'})).to have_been_made
333
- end
334
- end
335
- end
336
-
337
- describe '#retweet' do
338
- before do
339
- stub_post('/1.1/statuses/retweet/25938088801.json').to_return(:body => fixture('retweet.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
340
- end
341
- it 'requests the correct resource' do
342
- @client.retweet(25_938_088_801)
343
- expect(a_post('/1.1/statuses/retweet/25938088801.json')).to have_been_made
344
- end
345
- it 'returns an array of Tweets with retweet details embedded' do
346
- tweets = @client.retweet(25_938_088_801)
347
- expect(tweets).to be_an Array
348
- expect(tweets.first).to be_a Twitter::Tweet
349
- expect(tweets.first.text).to eq("RT @gruber: As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush.")
350
- expect(tweets.first.retweeted_tweet.text).to eq("As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush.")
351
- expect(tweets.first.retweeted_tweet.id).not_to eq(tweets.first.id)
352
- end
353
- context 'already retweeted' do
354
- before do
355
- stub_post('/1.1/statuses/retweet/25938088801.json').to_return(:status => 403, :body => fixture('already_retweeted.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
356
- end
357
- it 'does not raise an error' do
358
- expect { @client.retweet(25_938_088_801) }.not_to raise_error
359
- end
360
- end
361
- context 'with a URI object passed' do
362
- it 'requests the correct resource' do
363
- tweet = URI.parse('https://twitter.com/sferik/status/25938088801')
364
- @client.retweet(tweet)
365
- expect(a_post('/1.1/statuses/retweet/25938088801.json')).to have_been_made
366
- end
367
- end
368
- context 'with a URI string passed' do
369
- it 'requests the correct resource' do
370
- @client.retweet('https://twitter.com/sferik/status/25938088801')
371
- expect(a_post('/1.1/statuses/retweet/25938088801.json')).to have_been_made
372
- end
373
- end
374
- context 'with a Tweet passed' do
375
- it 'requests the correct resource' do
376
- tweet = Twitter::Tweet.new(:id => 25_938_088_801)
377
- @client.retweet(tweet)
378
- expect(a_post('/1.1/statuses/retweet/25938088801.json')).to have_been_made
379
- end
380
- end
381
- end
382
-
383
- describe '#retweet!' do
384
- before do
385
- stub_post('/1.1/statuses/retweet/25938088801.json').to_return(:body => fixture('retweet.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
386
- end
387
- it 'requests the correct resource' do
388
- @client.retweet!(25_938_088_801)
389
- expect(a_post('/1.1/statuses/retweet/25938088801.json')).to have_been_made
390
- end
391
- it 'returns an array of Tweets with retweet details embedded' do
392
- tweets = @client.retweet!(25_938_088_801)
393
- expect(tweets).to be_an Array
394
- expect(tweets.first).to be_a Twitter::Tweet
395
- expect(tweets.first.text).to eq("RT @gruber: As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush.")
396
- expect(tweets.first.retweeted_tweet.text).to eq("As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush.")
397
- expect(tweets.first.retweeted_tweet.id).not_to eq(tweets.first.id)
398
- end
399
- context 'forbidden' do
400
- before do
401
- stub_post('/1.1/statuses/retweet/25938088801.json').to_return(:status => 403, :headers => {:content_type => 'application/json; charset=utf-8'})
402
- end
403
- it 'raises a Forbidden error' do
404
- expect { @client.retweet!(25_938_088_801) }.to raise_error(Twitter::Error::Forbidden)
405
- end
406
- end
407
- context 'already retweeted' do
408
- before do
409
- stub_post('/1.1/statuses/retweet/25938088801.json').to_return(:status => 403, :body => fixture('already_retweeted.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
410
- end
411
- it 'raises an AlreadyRetweeted error' do
412
- expect { @client.retweet!(25_938_088_801) }.to raise_error(Twitter::Error::AlreadyRetweeted)
413
- end
414
- end
415
- context 'with a URI object passed' do
416
- it 'requests the correct resource' do
417
- tweet = URI.parse('https://twitter.com/sferik/status/25938088801')
418
- @client.retweet!(tweet)
419
- expect(a_post('/1.1/statuses/retweet/25938088801.json')).to have_been_made
420
- end
421
- end
422
- context 'with a URI string passed' do
423
- it 'requests the correct resource' do
424
- @client.retweet!('https://twitter.com/sferik/status/25938088801')
425
- expect(a_post('/1.1/statuses/retweet/25938088801.json')).to have_been_made
426
- end
427
- end
428
- context 'with a Tweet passed' do
429
- it 'requests the correct resource' do
430
- tweet = Twitter::Tweet.new(:id => 25_938_088_801)
431
- @client.retweet!(tweet)
432
- expect(a_post('/1.1/statuses/retweet/25938088801.json')).to have_been_made
433
- end
434
- end
435
- end
436
-
437
- describe '#update_with_media' do
438
- before do
439
- stub_post('/1.1/statuses/update_with_media.json').to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
440
- end
441
- context 'a gif image' do
442
- it 'requests the correct resource' do
443
- @client.update_with_media("\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", fixture('pbjt.gif'))
444
- expect(a_post('/1.1/statuses/update_with_media.json')).to have_been_made
445
- end
446
- it 'returns a Tweet' do
447
- tweet = @client.update_with_media("\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", fixture('pbjt.gif'))
448
- expect(tweet).to be_a Twitter::Tweet
449
- expect(tweet.text).to eq("\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9")
450
- end
451
- end
452
- context 'a jpe image' do
453
- it 'requests the correct resource' do
454
- @client.update_with_media('You always have options', fixture('wildcomet2.jpe'))
455
- expect(a_post('/1.1/statuses/update_with_media.json')).to have_been_made
456
- end
457
- end
458
- context 'a jpeg image' do
459
- it 'requests the correct resource' do
460
- @client.update_with_media('You always have options', fixture('me.jpeg'))
461
- expect(a_post('/1.1/statuses/update_with_media.json')).to have_been_made
462
- end
463
- end
464
- context 'a png image' do
465
- it 'requests the correct resource' do
466
- @client.update_with_media('You always have options', fixture('we_concept_bg2.png'))
467
- expect(a_post('/1.1/statuses/update_with_media.json')).to have_been_made
468
- end
469
- end
470
- context 'a Tempfile' do
471
- it 'requests the correct resource' do
472
- @client.update_with_media('You always have options', Tempfile.new('tmp'))
473
- expect(a_post('/1.1/statuses/update_with_media.json')).to have_been_made
474
- end
475
- end
476
- context 'A non IO object' do
477
- it 'raises an error' do
478
- expect { @client.update_with_media('You always have options', 'Unacceptable IO') }.to raise_error(Twitter::Error::UnacceptableIO)
479
- end
480
- end
481
- context 'already posted' do
482
- before do
483
- stub_post('/1.1/statuses/update_with_media.json').to_return(:status => 403, :body => fixture('already_posted.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
484
- end
485
- it 'raises an DuplicateStatus error' do
486
- expect { @client.update_with_media("\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" —FLOTUS in China, http://t.co/fxmuQN9JL9", fixture('pbjt.gif')) }.to raise_error(Twitter::Error::DuplicateStatus)
487
- end
488
- end
489
- end
490
-
491
- describe '#oembed' do
492
- before do
493
- stub_get('/1.1/statuses/oembed.json').with(:query => {:id => '25938088801'}).to_return(:body => fixture('oembed.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
494
- stub_get('/1.1/statuses/oembed.json').with(:query => {:url => 'https://twitter.com/sferik/status/25938088801'}).to_return(:body => fixture('oembed.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
495
- end
496
- it 'requests the correct resource' do
497
- @client.oembed(25_938_088_801)
498
- expect(a_get('/1.1/statuses/oembed.json').with(:query => {:id => '25938088801'})).to have_been_made
499
- end
500
- it 'requests the correct resource when a URL is given' do
501
- @client.oembed('https://twitter.com/sferik/status/25938088801')
502
- expect(a_get('/1.1/statuses/oembed.json').with(:query => {:url => 'https://twitter.com/sferik/status/25938088801'}))
503
- end
504
- it 'returns an array of OEmbed instances' do
505
- oembed = @client.oembed(25_938_088_801)
506
- expect(oembed).to be_a Twitter::OEmbed
507
- end
508
- context 'with a URI object passed' do
509
- it 'requests the correct resource' do
510
- tweet = URI.parse('https://twitter.com/sferik/status/25938088801')
511
- @client.oembed(tweet)
512
- expect(a_get('/1.1/statuses/oembed.json').with(:query => {:id => '25938088801'})).to have_been_made
513
- end
514
- end
515
- context 'with a URI string passed' do
516
- it 'requests the correct resource' do
517
- @client.oembed('https://twitter.com/sferik/status/25938088801')
518
- expect(a_get('/1.1/statuses/oembed.json').with(:query => {:id => '25938088801'})).to have_been_made
519
- end
520
- end
521
- context 'with a Tweet passed' do
522
- it 'requests the correct resource' do
523
- tweet = Twitter::Tweet.new(:id => 25_938_088_801)
524
- @client.oembed(tweet)
525
- expect(a_get('/1.1/statuses/oembed.json').with(:query => {:id => '25938088801'})).to have_been_made
526
- end
527
- end
528
- end
529
-
530
- describe '#oembeds' do
531
- before do
532
- stub_get('/1.1/statuses/oembed.json').with(:query => {:id => '25938088801'}).to_return(:body => fixture('oembed.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
533
- end
534
- it 'requests the correct resource' do
535
- @client.oembeds(25_938_088_801)
536
- expect(a_get('/1.1/statuses/oembed.json').with(:query => {:id => '25938088801'})).to have_been_made
537
- end
538
- it 'requests the correct resource when a URL is given' do
539
- @client.oembeds('https://twitter.com/sferik/status/25938088801')
540
- expect(a_get('/1.1/statuses/oembed.json').with(:query => {:id => '25938088801'})).to have_been_made
541
- end
542
- it 'returns an array of OEmbed instances' do
543
- oembeds = @client.oembeds(25_938_088_801)
544
- expect(oembeds).to be_an Array
545
- expect(oembeds.first).to be_a Twitter::OEmbed
546
- end
547
- context 'with a URI object passed' do
548
- it 'requests the correct resource' do
549
- tweet = URI.parse('https://twitter.com/sferik/status/25938088801')
550
- @client.oembeds(tweet)
551
- expect(a_get('/1.1/statuses/oembed.json').with(:query => {:id => '25938088801'})).to have_been_made
552
- end
553
- end
554
- context 'with a URI string passed' do
555
- it 'requests the correct resource' do
556
- @client.oembeds('https://twitter.com/sferik/status/25938088801')
557
- expect(a_get('/1.1/statuses/oembed.json').with(:query => {:id => '25938088801'})).to have_been_made
558
- end
559
- end
560
- context 'with a Tweet passed' do
561
- it 'requests the correct resource' do
562
- tweet = Twitter::Tweet.new(:id => 25_938_088_801)
563
- @client.oembeds(tweet)
564
- expect(a_get('/1.1/statuses/oembed.json').with(:query => {:id => '25938088801'})).to have_been_made
565
- end
566
- end
567
- end
568
-
569
- describe '#retweeters_ids' do
570
- before do
571
- stub_get('/1.1/statuses/retweeters/ids.json').with(:query => {:id => '25938088801', :cursor => '-1'}).to_return(:body => fixture('ids_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
572
- end
573
- it 'requests the correct resource' do
574
- @client.retweeters_ids(25_938_088_801)
575
- expect(a_get('/1.1/statuses/retweeters/ids.json').with(:query => {:id => '25938088801', :cursor => '-1'})).to have_been_made
576
- end
577
- it 'returns a collection of up to 100 user IDs belonging to users who have retweeted the tweet specified by the id parameter' do
578
- retweeters_ids = @client.retweeters_ids(25_938_088_801)
579
- expect(retweeters_ids).to be_a Twitter::Cursor
580
- expect(retweeters_ids.first).to eq(20_009_713)
581
- end
582
- context 'with each' do
583
- before do
584
- 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'})
585
- end
586
- it 'requests the correct resource' do
587
- @client.retweeters_ids(25_938_088_801).each {}
588
- expect(a_get('/1.1/statuses/retweeters/ids.json').with(:query => {:id => '25938088801', :cursor => '-1'})).to have_been_made
589
- expect(a_get('/1.1/statuses/retweeters/ids.json').with(:query => {:id => '25938088801', :cursor => '1305102810874389703'})).to have_been_made
590
- end
591
- end
592
- context 'with a URI object passed' do
593
- it 'requests the correct resource' do
594
- tweet = URI.parse('https://twitter.com/sferik/status/25938088801')
595
- @client.retweeters_ids(tweet)
596
- expect(a_get('/1.1/statuses/retweeters/ids.json').with(:query => {:id => '25938088801', :cursor => '-1'})).to have_been_made
597
- end
598
- end
599
- context 'with a URI string passed' do
600
- it 'requests the correct resource' do
601
- @client.retweeters_ids('https://twitter.com/sferik/status/25938088801')
602
- expect(a_get('/1.1/statuses/retweeters/ids.json').with(:query => {:id => '25938088801', :cursor => '-1'})).to have_been_made
603
- end
604
- end
605
- context 'with a Tweet passed' do
606
- it 'requests the correct resource' do
607
- tweet = Twitter::Tweet.new(:id => 25_938_088_801)
608
- @client.retweeters_ids(tweet)
609
- expect(a_get('/1.1/statuses/retweeters/ids.json').with(:query => {:id => '25938088801', :cursor => '-1'})).to have_been_made
610
- end
611
- end
612
- end
613
-
614
- end