twitter 5.9.0 → 5.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,54 @@
1
+ require 'helper'
2
+
3
+ describe Twitter::REST::Media do
4
+ before do
5
+ @client = Twitter::REST::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :access_token => 'AT', :access_token_secret => 'AS')
6
+ end
7
+
8
+ describe '#upload' do
9
+ before do
10
+ stub_request(:post, 'https://upload.twitter.com/1.1/media/upload.json').to_return(:body => fixture('upload.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
11
+ end
12
+ context 'a gif image' do
13
+ it 'requests the correct resource' do
14
+ @client.upload(fixture('pbjt.gif'))
15
+ expect(a_request(:post, 'https://upload.twitter.com/1.1/media/upload.json')).to have_been_made
16
+ end
17
+ it 'returns an Integer' do
18
+ media_id = @client.upload(fixture('pbjt.gif'))
19
+ expect(a_request(:post, 'https://upload.twitter.com/1.1/media/upload.json')).to have_been_made
20
+ expect(media_id).to be_an Integer
21
+ expect(media_id).to eq(470_030_289_822_314_497)
22
+ end
23
+ end
24
+ context 'a jpe image' do
25
+ it 'requests the correct resource' do
26
+ @client.upload(fixture('wildcomet2.jpe'))
27
+ expect(a_request(:post, 'https://upload.twitter.com/1.1/media/upload.json')).to have_been_made
28
+ end
29
+ end
30
+ context 'a jpeg image' do
31
+ it 'requests the correct resource' do
32
+ @client.upload(fixture('me.jpeg'))
33
+ expect(a_request(:post, 'https://upload.twitter.com/1.1/media/upload.json')).to have_been_made
34
+ end
35
+ end
36
+ context 'a png image' do
37
+ it 'requests the correct resource' do
38
+ @client.upload(fixture('we_concept_bg2.png'))
39
+ expect(a_request(:post, 'https://upload.twitter.com/1.1/media/upload.json')).to have_been_made
40
+ end
41
+ end
42
+ context 'a Tempfile' do
43
+ it 'requests the correct resource' do
44
+ @client.upload(Tempfile.new('tmp'))
45
+ expect(a_request(:post, 'https://upload.twitter.com/1.1/media/upload.json')).to have_been_made
46
+ end
47
+ end
48
+ context 'A non IO object' do
49
+ it 'raises an error' do
50
+ expect { @client.upload('Unacceptable IO') }.to raise_error(Twitter::Error::UnacceptableIO)
51
+ end
52
+ end
53
+ end
54
+ end
@@ -1,3 +1,4 @@
1
+ # coding: utf-8
1
2
  require 'helper'
2
3
 
3
4
  describe Twitter::REST::Tweets do
@@ -109,7 +110,7 @@ describe Twitter::REST::Tweets do
109
110
  it 'returns a Tweet' do
110
111
  tweet = @client.status(25_938_088_801)
111
112
  expect(tweet).to be_a Twitter::Tweet
112
- expect(tweet.text).to eq("The problem with your code is that it's doing exactly what you told it to do.")
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")
113
114
  end
114
115
  context 'with a URI object passed' do
115
116
  it 'requests the correct resource' do
@@ -179,7 +180,7 @@ describe Twitter::REST::Tweets do
179
180
  tweets = @client.destroy_status(25_938_088_801)
180
181
  expect(tweets).to be_an Array
181
182
  expect(tweets.first).to be_a Twitter::Tweet
182
- expect(tweets.first.text).to eq("The problem with your code is that it's doing exactly what you told it to do.")
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")
183
184
  end
184
185
  context 'with a URI object passed' do
185
186
  it 'requests the correct resource' do
@@ -205,16 +206,16 @@ describe Twitter::REST::Tweets do
205
206
 
206
207
  describe '#update' do
207
208
  before do
208
- stub_post('/1.1/statuses/update.json').with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do."}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
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'})
209
210
  end
210
211
  it 'requests the correct resource' do
211
- @client.update("The problem with your code is that it's doing exactly what you told it to do.")
212
- expect(a_post('/1.1/statuses/update.json').with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do."})).to have_been_made
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
213
214
  end
214
215
  it 'returns a Tweet' do
215
- tweet = @client.update("The problem with your code is that it's doing exactly what you told it to 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")
216
217
  expect(tweet).to be_a Twitter::Tweet
217
- expect(tweet.text).to eq("The problem with your code is that it's doing exactly what you told it to do.")
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")
218
219
  end
219
220
  context 'already posted' do
220
221
  before do
@@ -222,12 +223,12 @@ describe Twitter::REST::Tweets do
222
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'})
223
224
  end
224
225
  it 'requests the correct resources' do
225
- @client.update("The problem with your code is that it's doing exactly what you told it to do.")
226
- expect(a_post('/1.1/statuses/update.json').with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do."})).to have_been_made
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
227
228
  expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => 1})).to have_been_made
228
229
  end
229
230
  it 'returns a Tweet' do
230
- tweet = @client.update("The problem with your code is that it's doing exactly what you told it to 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")
231
232
  expect(tweet).to be_a Twitter::Tweet
232
233
  expect(tweet.text).to eq('Happy Birthday @imdane. Watch out for those @rally pranksters!')
233
234
  end
@@ -235,100 +236,100 @@ describe Twitter::REST::Tweets do
235
236
  context 'with an in-reply-to status' do
236
237
  before do
237
238
  @tweet = Twitter::Tweet.new(:id => 1)
238
- stub_post('/1.1/statuses/update.json').with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do.", :in_reply_to_status_id => '1'}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
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'})
239
240
  end
240
241
  it 'requests the correct resource' do
241
- @client.update("The problem with your code is that it's doing exactly what you told it to do.", :in_reply_to_status => @tweet)
242
- expect(a_post('/1.1/statuses/update.json').with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do.", :in_reply_to_status_id => '1'})).to have_been_made
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
243
244
  end
244
245
  end
245
246
  context 'with an in-reply-to status ID' do
246
247
  before do
247
- stub_post('/1.1/statuses/update.json').with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do.", :in_reply_to_status_id => '1'}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
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'})
248
249
  end
249
250
  it 'requests the correct resource' do
250
- @client.update("The problem with your code is that it's doing exactly what you told it to do.", :in_reply_to_status_id => 1)
251
- expect(a_post('/1.1/statuses/update.json').with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do.", :in_reply_to_status_id => '1'})).to have_been_made
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
252
253
  end
253
254
  end
254
255
  context 'with a place' do
255
256
  before do
256
257
  @place = Twitter::Place.new(:woeid => 'df51dec6f4ee2b2c')
257
- stub_post('/1.1/statuses/update.json').with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do.", :place_id => 'df51dec6f4ee2b2c'}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
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'})
258
259
  end
259
260
  it 'requests the correct resource' do
260
- @client.update("The problem with your code is that it's doing exactly what you told it to do.", :place => @place)
261
- expect(a_post('/1.1/statuses/update.json').with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do.", :place_id => 'df51dec6f4ee2b2c'})).to have_been_made
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
262
263
  end
263
264
  end
264
265
  context 'with a place ID' do
265
266
  before do
266
- stub_post('/1.1/statuses/update.json').with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do.", :place_id => 'df51dec6f4ee2b2c'}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
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'})
267
268
  end
268
269
  it 'requests the correct resource' do
269
- @client.update("The problem with your code is that it's doing exactly what you told it to do.", :place_id => 'df51dec6f4ee2b2c')
270
- expect(a_post('/1.1/statuses/update.json').with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do.", :place_id => 'df51dec6f4ee2b2c'})).to have_been_made
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
271
272
  end
272
273
  end
273
274
  end
274
275
 
275
276
  describe '#update!' do
276
277
  before do
277
- stub_post('/1.1/statuses/update.json').with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do."}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
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'})
278
279
  end
279
280
  it 'requests the correct resource' do
280
- @client.update!("The problem with your code is that it's doing exactly what you told it to do.")
281
- expect(a_post('/1.1/statuses/update.json').with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do."})).to have_been_made
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
282
283
  end
283
284
  it 'returns a Tweet' do
284
- tweet = @client.update!("The problem with your code is that it's doing exactly what you told it to 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")
285
286
  expect(tweet).to be_a Twitter::Tweet
286
- expect(tweet.text).to eq("The problem with your code is that it's doing exactly what you told it to do.")
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")
287
288
  end
288
289
  context 'already posted' do
289
290
  before do
290
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'})
291
292
  end
292
293
  it 'raises an DuplicateStatus error' do
293
- expect { @client.update!("The problem with your code is that it's doing exactly what you told it to do.") }.to raise_error(Twitter::Error::DuplicateStatus)
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)
294
295
  end
295
296
  end
296
297
  context 'with an in-reply-to status' do
297
298
  before do
298
299
  @tweet = Twitter::Tweet.new(:id => 1)
299
- stub_post('/1.1/statuses/update.json').with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do.", :in_reply_to_status_id => '1'}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
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'})
300
301
  end
301
302
  it 'requests the correct resource' do
302
- @client.update!("The problem with your code is that it's doing exactly what you told it to do.", :in_reply_to_status => @tweet)
303
- expect(a_post('/1.1/statuses/update.json').with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do.", :in_reply_to_status_id => '1'})).to have_been_made
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
304
305
  end
305
306
  end
306
307
  context 'with an in-reply-to status ID' do
307
308
  before do
308
- stub_post('/1.1/statuses/update.json').with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do.", :in_reply_to_status_id => '1'}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
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'})
309
310
  end
310
311
  it 'requests the correct resource' do
311
- @client.update!("The problem with your code is that it's doing exactly what you told it to do.", :in_reply_to_status_id => 1)
312
- expect(a_post('/1.1/statuses/update.json').with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do.", :in_reply_to_status_id => '1'})).to have_been_made
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
313
314
  end
314
315
  end
315
316
  context 'with a place' do
316
317
  before do
317
318
  @place = Twitter::Place.new(:woeid => 'df51dec6f4ee2b2c')
318
- stub_post('/1.1/statuses/update.json').with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do.", :place_id => 'df51dec6f4ee2b2c'}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
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'})
319
320
  end
320
321
  it 'requests the correct resource' do
321
- @client.update!("The problem with your code is that it's doing exactly what you told it to do.", :place => @place)
322
- expect(a_post('/1.1/statuses/update.json').with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do.", :place_id => 'df51dec6f4ee2b2c'})).to have_been_made
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
323
324
  end
324
325
  end
325
326
  context 'with a place ID' do
326
327
  before do
327
- stub_post('/1.1/statuses/update.json').with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do.", :place_id => 'df51dec6f4ee2b2c'}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
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'})
328
329
  end
329
330
  it 'requests the correct resource' do
330
- @client.update!("The problem with your code is that it's doing exactly what you told it to do.", :place_id => 'df51dec6f4ee2b2c')
331
- expect(a_post('/1.1/statuses/update.json').with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do.", :place_id => 'df51dec6f4ee2b2c'})).to have_been_made
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
332
333
  end
333
334
  end
334
335
  end
@@ -439,13 +440,13 @@ describe Twitter::REST::Tweets do
439
440
  end
440
441
  context 'a gif image' do
441
442
  it 'requests the correct resource' do
442
- @client.update_with_media("The problem with your code is that it's doing exactly what you told it to do.", fixture('pbjt.gif'))
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'))
443
444
  expect(a_post('/1.1/statuses/update_with_media.json')).to have_been_made
444
445
  end
445
446
  it 'returns a Tweet' do
446
- tweet = @client.update_with_media("The problem with your code is that it's doing exactly what you told it to do.", fixture('pbjt.gif'))
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'))
447
448
  expect(tweet).to be_a Twitter::Tweet
448
- expect(tweet.text).to eq("The problem with your code is that it's doing exactly what you told it to do.")
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")
449
450
  end
450
451
  end
451
452
  context 'a jpe image' do
@@ -474,8 +475,7 @@ describe Twitter::REST::Tweets do
474
475
  end
475
476
  context 'A non IO object' do
476
477
  it 'raises an error' do
477
- update = lambda { @client.update_with_media('You always have options', 'Unacceptable IO') }
478
- expect { update.call }.to raise_error(Twitter::Error::UnacceptableIO)
478
+ expect { @client.update_with_media('You always have options', 'Unacceptable IO') }.to raise_error(Twitter::Error::UnacceptableIO)
479
479
  end
480
480
  end
481
481
  context 'already posted' do
@@ -483,7 +483,7 @@ describe Twitter::REST::Tweets do
483
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
484
  end
485
485
  it 'raises an DuplicateStatus error' do
486
- expect { @client.update_with_media("The problem with your code is that it's doing exactly what you told it to do.", fixture('pbjt.gif')) }.to raise_error(Twitter::Error::DuplicateStatus)
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
487
  end
488
488
  end
489
489
  end
@@ -52,12 +52,12 @@ describe Twitter::REST::Undocumented do
52
52
  end
53
53
  context 'without arguments passed' do
54
54
  before do
55
- stub_get('/1.1/account/verify_credentials.json').with(:query => {:include_entities => 'false', :skip_status => 'true'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
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
56
  stub_get('/users/following_followers_of.json').with(:query => {:user_id => '7505382', :cursor => '-1'}).to_return(:body => fixture('users_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
57
57
  end
58
58
  it 'requests the correct resource' do
59
59
  @client.following_followers_of
60
- expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:include_entities => 'false', :skip_status => 'true'})).to have_been_made
60
+ expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
61
61
  expect(a_get('/users/following_followers_of.json').with(:query => {:user_id => '7505382', :cursor => '-1'})).to have_been_made
62
62
  end
63
63
  it 'returns an array of numeric IDs for every user following the specified user' do
@@ -579,12 +579,12 @@ describe Twitter::REST::Users do
579
579
  end
580
580
  context 'without arguments passed' do
581
581
  before do
582
- stub_get('/1.1/account/verify_credentials.json').with(:query => {:include_entities => 'false', :skip_status => 'true'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
582
+ 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'})
583
583
  stub_get('/1.1/users/contributees.json').with(:query => {:user_id => '7505382'}).to_return(:body => fixture('contributees.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
584
584
  end
585
585
  it 'requests the correct resource' do
586
586
  @client.contributees
587
- expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:include_entities => 'false', :skip_status => 'true'})).to have_been_made
587
+ expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
588
588
  expect(a_get('/1.1/users/contributees.json').with(:query => {:user_id => '7505382'})).to have_been_made
589
589
  end
590
590
  it 'returns contributees' do
@@ -623,12 +623,12 @@ describe Twitter::REST::Users do
623
623
  end
624
624
  context 'without arguments passed' do
625
625
  before do
626
- stub_get('/1.1/account/verify_credentials.json').with(:query => {:include_entities => 'false', :skip_status => 'true'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
626
+ 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'})
627
627
  stub_get('/1.1/users/contributors.json').with(:query => {:user_id => '7505382'}).to_return(:body => fixture('members.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
628
628
  end
629
629
  it 'requests the correct resource' do
630
630
  @client.contributors
631
- expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:include_entities => 'false', :skip_status => 'true'})).to have_been_made
631
+ expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
632
632
  expect(a_get('/1.1/users/contributors.json').with(:query => {:user_id => '7505382'})).to have_been_made
633
633
  end
634
634
  it 'returns contributors' do
@@ -695,12 +695,12 @@ describe Twitter::REST::Users do
695
695
  end
696
696
  context 'without arguments passed' do
697
697
  before do
698
- stub_get('/1.1/account/verify_credentials.json').with(:query => {:include_entities => 'false', :skip_status => 'true'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
698
+ 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'})
699
699
  stub_get('/1.1/users/profile_banner.json').with(:query => {:user_id => '7505382'}).to_return(:body => fixture('profile_banner.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
700
700
  end
701
701
  it 'requests the correct resource' do
702
702
  @client.profile_banner
703
- expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:include_entities => 'false', :skip_status => 'true'})).to have_been_made
703
+ expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
704
704
  expect(a_get('/1.1/users/profile_banner.json').with(:query => {:user_id => '7505382'})).to have_been_made
705
705
  end
706
706
  it 'returns an array of numeric IDs for every user following the specified user' do
@@ -165,10 +165,6 @@ describe Twitter::Tweet do
165
165
  it 'is empty' do
166
166
  expect(subject.hashtags).to be_empty
167
167
  end
168
- it 'warns' do
169
- subject.hashtags
170
- expect($stderr.string).to match(/To get hashtags, you must pass `:include_entities => true` when requesting the Twitter::Tweet\./)
171
- end
172
168
  end
173
169
  end
174
170
 
@@ -196,10 +192,6 @@ describe Twitter::Tweet do
196
192
  media = Twitter::Tweet.new(:id => 28_669_546_014).media
197
193
  expect(media).to be_empty
198
194
  end
199
- it 'warns when not set' do
200
- Twitter::Tweet.new(:id => 28_669_546_014).media
201
- expect($stderr.string).to match(/To get media, you must pass `:include_entities => true` when requesting the Twitter::Tweet\./)
202
- end
203
195
  end
204
196
 
205
197
  describe '#media?' do
@@ -322,10 +314,6 @@ describe Twitter::Tweet do
322
314
  symbols = Twitter::Tweet.new(:id => 28_669_546_014).symbols
323
315
  expect(symbols).to be_empty
324
316
  end
325
- it 'warns when not set' do
326
- Twitter::Tweet.new(:id => 28_669_546_014).symbols
327
- expect($stderr.string).to match(/To get symbols, you must pass `:include_entities => true` when requesting the Twitter::Tweet\./)
328
- end
329
317
  end
330
318
 
331
319
  describe '#symbols?' do
@@ -363,10 +351,6 @@ describe Twitter::Tweet do
363
351
  tweet = Twitter::Tweet.new(:id => 28_669_546_014)
364
352
  expect(tweet.uris).to be_empty
365
353
  end
366
- it 'warns when not set' do
367
- Twitter::Tweet.new(:id => 28_669_546_014).urls
368
- expect($stderr.string).to match(/To get urls, you must pass `:include_entities => true` when requesting the Twitter::Tweet\./)
369
- end
370
354
  it 'can handle strange urls' do
371
355
  urls_array = [
372
356
  {
@@ -454,10 +438,6 @@ describe Twitter::Tweet do
454
438
  user_mentions = Twitter::Tweet.new(:id => 28_669_546_014).user_mentions
455
439
  expect(user_mentions).to be_empty
456
440
  end
457
- it 'warns when not set' do
458
- Twitter::Tweet.new(:id => 28_669_546_014).user_mentions
459
- expect($stderr.string).to match(/To get user mentions, you must pass `:include_entities => true` when requesting the Twitter::Tweet\./)
460
- end
461
441
  end
462
442
 
463
443
  describe '#user_mentions?' do
@@ -350,6 +350,10 @@ describe Twitter::User do
350
350
  expect(user.uri).to be_an Addressable::URI
351
351
  expect(user.uri.to_s).to eq('https://twitter.com/sferik')
352
352
  end
353
+ it 'returns nil when the screen name is not set' do
354
+ user = Twitter::User.new(:id => 7_505_382)
355
+ expect(user.uri).to be_nil
356
+ end
353
357
  end
354
358
 
355
359
  describe '#website' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitter
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.9.0
4
+ version: 5.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Michaels-Ober
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-05-14 00:00:00.000000000 Z
15
+ date: 2014-06-10 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: addressable
@@ -225,6 +225,7 @@ files:
225
225
  - lib/twitter/rest/friends_and_followers.rb
226
226
  - lib/twitter/rest/help.rb
227
227
  - lib/twitter/rest/lists.rb
228
+ - lib/twitter/rest/media.rb
228
229
  - lib/twitter/rest/oauth.rb
229
230
  - lib/twitter/rest/places_and_geo.rb
230
231
  - lib/twitter/rest/request/multipart_with_file.rb
@@ -321,6 +322,7 @@ files:
321
322
  - spec/fixtures/tos.json
322
323
  - spec/fixtures/track_streaming.json
323
324
  - spec/fixtures/track_streaming_user.json
325
+ - spec/fixtures/upload.json
324
326
  - spec/fixtures/user_search.json
325
327
  - spec/fixtures/user_timeline.json
326
328
  - spec/fixtures/users.json
@@ -357,6 +359,7 @@ files:
357
359
  - spec/twitter/rest/geo_spec.rb
358
360
  - spec/twitter/rest/help_spec.rb
359
361
  - spec/twitter/rest/lists_spec.rb
362
+ - spec/twitter/rest/media_spec.rb
360
363
  - spec/twitter/rest/oauth_spec.rb
361
364
  - spec/twitter/rest/saved_searches_spec.rb
362
365
  - spec/twitter/rest/search_spec.rb
@@ -470,6 +473,7 @@ test_files:
470
473
  - spec/fixtures/tos.json
471
474
  - spec/fixtures/track_streaming.json
472
475
  - spec/fixtures/track_streaming_user.json
476
+ - spec/fixtures/upload.json
473
477
  - spec/fixtures/user_search.json
474
478
  - spec/fixtures/user_timeline.json
475
479
  - spec/fixtures/users.json
@@ -506,6 +510,7 @@ test_files:
506
510
  - spec/twitter/rest/geo_spec.rb
507
511
  - spec/twitter/rest/help_spec.rb
508
512
  - spec/twitter/rest/lists_spec.rb
513
+ - spec/twitter/rest/media_spec.rb
509
514
  - spec/twitter/rest/oauth_spec.rb
510
515
  - spec/twitter/rest/saved_searches_spec.rb
511
516
  - spec/twitter/rest/search_spec.rb