twitter 5.1.1 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.yardopts +2 -0
  3. data/CHANGELOG.md +10 -1
  4. data/CONTRIBUTING.md +2 -2
  5. data/README.md +30 -20
  6. data/Rakefile +26 -5
  7. data/lib/twitter/arguments.rb +0 -1
  8. data/lib/twitter/base.rb +13 -16
  9. data/lib/twitter/basic_user.rb +3 -3
  10. data/lib/twitter/client.rb +7 -8
  11. data/lib/twitter/configuration.rb +5 -5
  12. data/lib/twitter/core_ext/enumerable.rb +0 -2
  13. data/lib/twitter/core_ext/kernel.rb +0 -2
  14. data/lib/twitter/creatable.rb +0 -1
  15. data/lib/twitter/cursor.rb +7 -10
  16. data/lib/twitter/direct_message.rb +1 -1
  17. data/lib/twitter/entity/uri.rb +2 -2
  18. data/lib/twitter/enumerable.rb +1 -2
  19. data/lib/twitter/error.rb +4 -6
  20. data/lib/twitter/error/already_favorited.rb +1 -1
  21. data/lib/twitter/error/already_posted.rb +1 -1
  22. data/lib/twitter/error/already_retweeted.rb +1 -1
  23. data/lib/twitter/error/too_many_requests.rb +2 -2
  24. data/lib/twitter/factory.rb +2 -6
  25. data/lib/twitter/geo.rb +1 -1
  26. data/lib/twitter/geo/point.rb +3 -5
  27. data/lib/twitter/geo_factory.rb +1 -5
  28. data/lib/twitter/geo_results.rb +5 -8
  29. data/lib/twitter/identity.rb +1 -2
  30. data/lib/twitter/list.rb +4 -5
  31. data/lib/twitter/media/photo.rb +1 -2
  32. data/lib/twitter/media_factory.rb +1 -5
  33. data/lib/twitter/null_object.rb +4 -6
  34. data/lib/twitter/oembed.rb +1 -1
  35. data/lib/twitter/place.rb +4 -5
  36. data/lib/twitter/profile_banner.rb +1 -3
  37. data/lib/twitter/rate_limit.rb +1 -3
  38. data/lib/twitter/relationship.rb +1 -2
  39. data/lib/twitter/rest/api/direct_messages.rb +13 -14
  40. data/lib/twitter/rest/api/favorites.rb +10 -11
  41. data/lib/twitter/rest/api/friends_and_followers.rb +36 -36
  42. data/lib/twitter/rest/api/help.rb +8 -9
  43. data/lib/twitter/rest/api/lists.rb +62 -63
  44. data/lib/twitter/rest/api/oauth.rb +3 -4
  45. data/lib/twitter/rest/api/places_and_geo.rb +9 -10
  46. data/lib/twitter/rest/api/saved_searches.rb +5 -6
  47. data/lib/twitter/rest/api/search.rb +2 -3
  48. data/lib/twitter/rest/api/spam_reporting.rb +1 -2
  49. data/lib/twitter/rest/api/suggested_users.rb +4 -5
  50. data/lib/twitter/rest/api/timelines.rb +17 -18
  51. data/lib/twitter/rest/api/trends.rb +10 -11
  52. data/lib/twitter/rest/api/tweets.rb +15 -16
  53. data/lib/twitter/rest/api/undocumented.rb +6 -7
  54. data/lib/twitter/rest/api/users.rb +51 -52
  55. data/lib/twitter/rest/api/utils.rb +23 -30
  56. data/lib/twitter/rest/client.rb +8 -9
  57. data/lib/twitter/rest/request/multipart_with_file.rb +0 -1
  58. data/lib/twitter/rest/response/parse_error_json.rb +0 -2
  59. data/lib/twitter/rest/response/parse_json.rb +0 -2
  60. data/lib/twitter/rest/response/raise_error.rb +1 -3
  61. data/lib/twitter/search_results.rb +12 -15
  62. data/lib/twitter/settings.rb +2 -2
  63. data/lib/twitter/size.rb +2 -2
  64. data/lib/twitter/source_user.rb +1 -1
  65. data/lib/twitter/streaming/client.rb +71 -18
  66. data/lib/twitter/streaming/connection.rb +1 -3
  67. data/lib/twitter/streaming/deleted_tweet.rb +8 -0
  68. data/lib/twitter/streaming/event.rb +8 -8
  69. data/lib/twitter/streaming/friend_list.rb +2 -9
  70. data/lib/twitter/streaming/message_parser.rb +13 -7
  71. data/lib/twitter/streaming/response.rb +0 -2
  72. data/lib/twitter/streaming/stall_warning.rb +7 -0
  73. data/lib/twitter/suggestion.rb +0 -1
  74. data/lib/twitter/token.rb +2 -3
  75. data/lib/twitter/trend_results.rb +5 -8
  76. data/lib/twitter/tweet.rb +16 -24
  77. data/lib/twitter/user.rb +30 -32
  78. data/lib/twitter/version.rb +2 -5
  79. data/spec/fixtures/track_streaming_user.json +2 -1
  80. data/spec/helper.rb +6 -2
  81. data/spec/twitter/base_spec.rb +9 -9
  82. data/spec/twitter/basic_user_spec.rb +6 -6
  83. data/spec/twitter/configuration_spec.rb +4 -4
  84. data/spec/twitter/cursor_spec.rb +27 -27
  85. data/spec/twitter/direct_message_spec.rb +36 -36
  86. data/spec/twitter/entity/uri_spec.rb +27 -27
  87. data/spec/twitter/error_spec.rb +21 -21
  88. data/spec/twitter/geo/point_spec.rb +9 -9
  89. data/spec/twitter/geo/polygon_spec.rb +5 -5
  90. data/spec/twitter/geo_factory_spec.rb +7 -7
  91. data/spec/twitter/geo_results_spec.rb +11 -11
  92. data/spec/twitter/geo_spec.rb +5 -5
  93. data/spec/twitter/identifiable_spec.rb +9 -9
  94. data/spec/twitter/list_spec.rb +38 -38
  95. data/spec/twitter/media/photo_spec.rb +54 -54
  96. data/spec/twitter/media_factory_spec.rb +5 -5
  97. data/spec/twitter/null_object_spec.rb +6 -6
  98. data/spec/twitter/oembed_spec.rb +65 -65
  99. data/spec/twitter/place_spec.rb +89 -60
  100. data/spec/twitter/profile_banner_spec.rb +3 -3
  101. data/spec/twitter/rate_limit_spec.rb +18 -18
  102. data/spec/twitter/relationship_spec.rb +16 -16
  103. data/spec/twitter/rest/api/direct_messages_spec.rb +61 -61
  104. data/spec/twitter/rest/api/favorites_spec.rb +93 -93
  105. data/spec/twitter/rest/api/friends_and_followers_spec.rb +349 -349
  106. data/spec/twitter/rest/api/geo_spec.rb +33 -33
  107. data/spec/twitter/rest/api/help_spec.rb +24 -24
  108. data/spec/twitter/rest/api/lists_spec.rb +487 -487
  109. data/spec/twitter/rest/api/oauth_spec.rb +30 -30
  110. data/spec/twitter/rest/api/saved_searches_spec.rb +40 -40
  111. data/spec/twitter/rest/api/search_spec.rb +16 -16
  112. data/spec/twitter/rest/api/spam_reporting_spec.rb +9 -9
  113. data/spec/twitter/rest/api/suggested_users_spec.rb +23 -23
  114. data/spec/twitter/rest/api/timelines_spec.rb +58 -58
  115. data/spec/twitter/rest/api/trends_spec.rb +26 -26
  116. data/spec/twitter/rest/api/tweets_spec.rb +284 -284
  117. data/spec/twitter/rest/api/undocumented_spec.rb +51 -51
  118. data/spec/twitter/rest/api/users_spec.rb +360 -360
  119. data/spec/twitter/rest/client_spec.rb +99 -103
  120. data/spec/twitter/saved_search_spec.rb +16 -16
  121. data/spec/twitter/search_results_spec.rb +44 -44
  122. data/spec/twitter/settings_spec.rb +8 -8
  123. data/spec/twitter/size_spec.rb +5 -5
  124. data/spec/twitter/source_user_spec.rb +6 -6
  125. data/spec/twitter/streaming/client_spec.rb +53 -49
  126. data/spec/twitter/streaming/deleted_tweet_spec.rb +23 -0
  127. data/spec/twitter/streaming/event_spec.rb +20 -22
  128. data/spec/twitter/streaming/friend_list_spec.rb +11 -0
  129. data/spec/twitter/streaming/message_parser_spec.rb +54 -0
  130. data/spec/twitter/suggestion_spec.rb +11 -11
  131. data/spec/twitter/target_user_spec.rb +6 -6
  132. data/spec/twitter/token_spec.rb +4 -4
  133. data/spec/twitter/trend_results_spec.rb +30 -30
  134. data/spec/twitter/trend_spec.rb +20 -20
  135. data/spec/twitter/tweet_spec.rb +170 -173
  136. data/spec/twitter/user_spec.rb +179 -179
  137. data/twitter.gemspec +2 -2
  138. metadata +21 -4
  139. metadata.gz.sig +2 -1
@@ -3,65 +3,65 @@ require 'helper'
3
3
  describe Twitter::REST::API::Trends do
4
4
 
5
5
  before do
6
- @client = Twitter::REST::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
6
+ @client = Twitter::REST::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :access_token => 'AT', :access_token_secret => 'AS')
7
7
  end
8
8
 
9
- describe "#trends" do
10
- context "with woeid passed" do
9
+ describe '#trends' do
10
+ context 'with woeid passed' do
11
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"})
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
13
  end
14
- it "requests the correct resource" do
15
- @client.trends(2487956)
16
- expect(a_get("/1.1/trends/place.json").with(:query => {:id => "2487956"})).to have_been_made
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
17
  end
18
- it "returns the top 10 trending topics for a specific WOEID" do
19
- matching_trends = @client.trends(2487956)
18
+ it 'returns the top 10 trending topics for a specific WOEID' do
19
+ matching_trends = @client.trends(2_487_956)
20
20
  expect(matching_trends).to be_a Twitter::TrendResults
21
21
  expect(matching_trends.first).to be_a Twitter::Trend
22
- expect(matching_trends.first.name).to eq("#sevenwordsaftersex")
22
+ expect(matching_trends.first.name).to eq('#sevenwordsaftersex')
23
23
  end
24
24
  end
25
- context "without arguments passed" do
25
+ context 'without arguments passed' do
26
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"})
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
28
  end
29
- it "requests the correct resource" do
29
+ it 'requests the correct resource' do
30
30
  @client.trends
31
- expect(a_get("/1.1/trends/place.json").with(:query => {:id => "1"})).to have_been_made
31
+ expect(a_get('/1.1/trends/place.json').with(:query => {:id => '1'})).to have_been_made
32
32
  end
33
33
  end
34
34
  end
35
35
 
36
- describe "#trends_available" do
36
+ describe '#trends_available' do
37
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"})
38
+ stub_get('/1.1/trends/available.json').to_return(:body => fixture('locations.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
39
39
  end
40
- it "requests the correct resource" do
40
+ it 'requests the correct resource' do
41
41
  @client.trends_available
42
- expect(a_get("/1.1/trends/available.json")).to have_been_made
42
+ expect(a_get('/1.1/trends/available.json')).to have_been_made
43
43
  end
44
- it "returns the locations that Twitter has trending topic information for" do
44
+ it 'returns the locations that Twitter has trending topic information for' do
45
45
  locations = @client.trends_available
46
46
  expect(locations).to be_an Array
47
47
  expect(locations.first).to be_a Twitter::Place
48
- expect(locations.first.name).to eq("Ireland")
48
+ expect(locations.first.name).to eq('Ireland')
49
49
  end
50
50
  end
51
51
 
52
- describe "#trends_closest" do
52
+ describe '#trends_closest' do
53
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"})
54
+ stub_get('/1.1/trends/closest.json').to_return(:body => fixture('locations.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
55
55
  end
56
- it "requests the correct resource" do
56
+ it 'requests the correct resource' do
57
57
  @client.trends_closest
58
- expect(a_get("/1.1/trends/closest.json")).to have_been_made
58
+ expect(a_get('/1.1/trends/closest.json')).to have_been_made
59
59
  end
60
- it "returns the locations that Twitter has trending topic information for" do
60
+ it 'returns the locations that Twitter has trending topic information for' do
61
61
  locations = @client.trends_closest
62
62
  expect(locations).to be_an Array
63
63
  expect(locations.first).to be_a Twitter::Place
64
- expect(locations.first.name).to eq("Ireland")
64
+ expect(locations.first.name).to eq('Ireland')
65
65
  end
66
66
  end
67
67
 
@@ -3,537 +3,537 @@ require 'helper'
3
3
  describe Twitter::REST::API::Tweets do
4
4
 
5
5
  before do
6
- @client = Twitter::REST::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
6
+ @client = Twitter::REST::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :access_token => 'AT', :access_token_secret => 'AS')
7
7
  end
8
8
 
9
- describe "#retweets" do
9
+ describe '#retweets' do
10
10
  before do
11
- stub_get("/1.1/statuses/retweets/25938088801.json").to_return(:body => fixture("retweets.json"), :headers => {:content_type => "application/json; charset=utf-8"})
11
+ stub_get('/1.1/statuses/retweets/25938088801.json').to_return(:body => fixture('retweets.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
12
12
  end
13
- context "with a tweet ID passed" do
14
- it "requests the correct resource" do
15
- @client.retweets(25938088801)
16
- expect(a_get("/1.1/statuses/retweets/25938088801.json")).to have_been_made
13
+ context 'with a tweet ID passed' do
14
+ it 'requests the correct resource' do
15
+ @client.retweets(25_938_088_801)
16
+ expect(a_get('/1.1/statuses/retweets/25938088801.json')).to have_been_made
17
17
  end
18
- it "returns up to 100 of the first retweets of a given tweet" do
19
- tweets = @client.retweets(25938088801)
18
+ it 'returns up to 100 of the first retweets of a given tweet' do
19
+ tweets = @client.retweets(25_938_088_801)
20
20
  expect(tweets).to be_an Array
21
21
  expect(tweets.first).to be_a Twitter::Tweet
22
22
  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.")
23
23
  end
24
24
  end
25
- context "with a URI object passed" do
26
- it "requests the correct resource" do
27
- tweet = URI.parse("https://twitter.com/sferik/status/25938088801")
25
+ context 'with a URI object passed' do
26
+ it 'requests the correct resource' do
27
+ tweet = URI.parse('https://twitter.com/sferik/status/25938088801')
28
28
  @client.retweets(tweet)
29
- expect(a_get("/1.1/statuses/retweets/25938088801.json")).to have_been_made
29
+ expect(a_get('/1.1/statuses/retweets/25938088801.json')).to have_been_made
30
30
  end
31
31
  end
32
- context "with a URI string passed" do
33
- it "requests the correct resource" do
34
- @client.retweets("https://twitter.com/sferik/status/25938088801")
35
- expect(a_get("/1.1/statuses/retweets/25938088801.json")).to have_been_made
32
+ context 'with a URI string passed' do
33
+ it 'requests the correct resource' do
34
+ @client.retweets('https://twitter.com/sferik/status/25938088801')
35
+ expect(a_get('/1.1/statuses/retweets/25938088801.json')).to have_been_made
36
36
  end
37
37
  end
38
- context "with a Tweet passed" do
39
- it "requests the correct resource" do
40
- tweet = Twitter::Tweet.new(:id => 25938088801)
38
+ context 'with a Tweet passed' do
39
+ it 'requests the correct resource' do
40
+ tweet = Twitter::Tweet.new(:id => 25_938_088_801)
41
41
  @client.retweets(tweet)
42
- expect(a_get("/1.1/statuses/retweets/25938088801.json")).to have_been_made
42
+ expect(a_get('/1.1/statuses/retweets/25938088801.json')).to have_been_made
43
43
  end
44
44
  end
45
45
  end
46
46
 
47
- describe "#retweeters_of" do
48
- context "with ids_only passed" do
49
- context "with a tweet ID passed" do
47
+ describe '#retweeters_of' do
48
+ context 'with ids_only passed' do
49
+ context 'with a tweet ID passed' do
50
50
  before do
51
- stub_get("/1.1/statuses/retweets/25938088801.json").to_return(:body => fixture("retweets.json"), :headers => {:content_type => "application/json; charset=utf-8"})
51
+ stub_get('/1.1/statuses/retweets/25938088801.json').to_return(:body => fixture('retweets.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
52
52
  end
53
- it "requests the correct resource" do
54
- @client.retweeters_of(25938088801, :ids_only => true)
55
- expect(a_get("/1.1/statuses/retweets/25938088801.json")).to have_been_made
53
+ it 'requests the correct resource' do
54
+ @client.retweeters_of(25_938_088_801, :ids_only => true)
55
+ expect(a_get('/1.1/statuses/retweets/25938088801.json')).to have_been_made
56
56
  end
57
- it "returns an array of numeric user IDs of retweeters of a Tweet" do
58
- ids = @client.retweeters_of(25938088801, :ids_only => true)
57
+ it 'returns an array of numeric user IDs of retweeters of a Tweet' do
58
+ ids = @client.retweeters_of(25_938_088_801, :ids_only => true)
59
59
  expect(ids).to be_an Array
60
- expect(ids.first).to eq(7505382)
60
+ expect(ids.first).to eq(7_505_382)
61
61
  end
62
62
  end
63
63
  end
64
- context "without ids_only passed" do
64
+ context 'without ids_only passed' do
65
65
  before do
66
- stub_get("/1.1/statuses/retweets/25938088801.json").to_return(:body => fixture("retweets.json"), :headers => {:content_type => "application/json; charset=utf-8"})
66
+ stub_get('/1.1/statuses/retweets/25938088801.json').to_return(:body => fixture('retweets.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
67
67
  end
68
- it "requests the correct resource" do
69
- @client.retweeters_of(25938088801)
70
- expect(a_get("/1.1/statuses/retweets/25938088801.json")).to have_been_made
68
+ it 'requests the correct resource' do
69
+ @client.retweeters_of(25_938_088_801)
70
+ expect(a_get('/1.1/statuses/retweets/25938088801.json')).to have_been_made
71
71
  end
72
- it "returns an array of user of retweeters of a Tweet" do
73
- users = @client.retweeters_of(25938088801)
72
+ it 'returns an array of user of retweeters of a Tweet' do
73
+ users = @client.retweeters_of(25_938_088_801)
74
74
  expect(users).to be_an Array
75
75
  expect(users.first).to be_a Twitter::User
76
- expect(users.first.id).to eq(7505382)
76
+ expect(users.first.id).to eq(7_505_382)
77
77
  end
78
- context "with a URI object passed" do
79
- it "requests the correct resource" do
80
- tweet = URI.parse("https://twitter.com/sferik/status/25938088801")
78
+ context 'with a URI object passed' do
79
+ it 'requests the correct resource' do
80
+ tweet = URI.parse('https://twitter.com/sferik/status/25938088801')
81
81
  @client.retweeters_of(tweet)
82
- expect(a_get("/1.1/statuses/retweets/25938088801.json")).to have_been_made
82
+ expect(a_get('/1.1/statuses/retweets/25938088801.json')).to have_been_made
83
83
  end
84
84
  end
85
- context "with a URI string passed" do
86
- it "requests the correct resource" do
87
- @client.retweeters_of("https://twitter.com/sferik/status/25938088801")
88
- expect(a_get("/1.1/statuses/retweets/25938088801.json")).to have_been_made
85
+ context 'with a URI string passed' do
86
+ it 'requests the correct resource' do
87
+ @client.retweeters_of('https://twitter.com/sferik/status/25938088801')
88
+ expect(a_get('/1.1/statuses/retweets/25938088801.json')).to have_been_made
89
89
  end
90
90
  end
91
- context "with a Tweet passed" do
92
- it "requests the correct resource" do
93
- tweet = Twitter::Tweet.new(:id => 25938088801)
91
+ context 'with a Tweet passed' do
92
+ it 'requests the correct resource' do
93
+ tweet = Twitter::Tweet.new(:id => 25_938_088_801)
94
94
  @client.retweeters_of(tweet)
95
- expect(a_get("/1.1/statuses/retweets/25938088801.json")).to have_been_made
95
+ expect(a_get('/1.1/statuses/retweets/25938088801.json')).to have_been_made
96
96
  end
97
97
  end
98
98
  end
99
99
  end
100
100
 
101
- describe "#status" do
101
+ describe '#status' do
102
102
  before do
103
- stub_get("/1.1/statuses/show/25938088801.json").to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
103
+ stub_get('/1.1/statuses/show/25938088801.json').to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
104
104
  end
105
- it "requests the correct resource" do
106
- @client.status(25938088801)
107
- expect(a_get("/1.1/statuses/show/25938088801.json")).to have_been_made
105
+ it 'requests the correct resource' do
106
+ @client.status(25_938_088_801)
107
+ expect(a_get('/1.1/statuses/show/25938088801.json')).to have_been_made
108
108
  end
109
- it "returns a Tweet" do
110
- tweet = @client.status(25938088801)
109
+ it 'returns a Tweet' do
110
+ tweet = @client.status(25_938_088_801)
111
111
  expect(tweet).to be_a Twitter::Tweet
112
112
  expect(tweet.text).to eq("The problem with your code is that it's doing exactly what you told it to do.")
113
113
  end
114
- context "with a URI object passed" do
115
- it "requests the correct resource" do
116
- tweet = URI.parse("https://twitter.com/sferik/status/25938088801")
114
+ context 'with a URI object passed' do
115
+ it 'requests the correct resource' do
116
+ tweet = URI.parse('https://twitter.com/sferik/status/25938088801')
117
117
  @client.status(tweet)
118
- expect(a_get("/1.1/statuses/show/25938088801.json")).to have_been_made
118
+ expect(a_get('/1.1/statuses/show/25938088801.json')).to have_been_made
119
119
  end
120
120
  end
121
- context "with a URI string passed" do
122
- it "requests the correct resource" do
123
- @client.status("https://twitter.com/sferik/status/25938088801")
124
- expect(a_get("/1.1/statuses/show/25938088801.json")).to have_been_made
121
+ context 'with a URI string passed' do
122
+ it 'requests the correct resource' do
123
+ @client.status('https://twitter.com/sferik/status/25938088801')
124
+ expect(a_get('/1.1/statuses/show/25938088801.json')).to have_been_made
125
125
  end
126
126
  end
127
- context "with a Tweet passed" do
128
- it "requests the correct resource" do
129
- tweet = Twitter::Tweet.new(:id => 25938088801)
127
+ context 'with a Tweet passed' do
128
+ it 'requests the correct resource' do
129
+ tweet = Twitter::Tweet.new(:id => 25_938_088_801)
130
130
  @client.status(tweet)
131
- expect(a_get("/1.1/statuses/show/25938088801.json")).to have_been_made
131
+ expect(a_get('/1.1/statuses/show/25938088801.json')).to have_been_made
132
132
  end
133
133
  end
134
134
  end
135
135
 
136
- describe "#statuses" do
136
+ describe '#statuses' do
137
137
  before do
138
- stub_get("/1.1/statuses/show/25938088801.json").to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
138
+ stub_get('/1.1/statuses/show/25938088801.json').to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
139
139
  end
140
- it "requests the correct resource" do
141
- @client.statuses(25938088801)
142
- expect(a_get("/1.1/statuses/show/25938088801.json")).to have_been_made
140
+ it 'requests the correct resource' do
141
+ @client.statuses(25_938_088_801)
142
+ expect(a_get('/1.1/statuses/show/25938088801.json')).to have_been_made
143
143
  end
144
- it "returns an array of Tweets" do
145
- tweets = @client.statuses(25938088801)
144
+ it 'returns an array of Tweets' do
145
+ tweets = @client.statuses(25_938_088_801)
146
146
  expect(tweets).to be_an Array
147
147
  expect(tweets.first).to be_a Twitter::Tweet
148
148
  expect(tweets.first.text).to eq("The problem with your code is that it's doing exactly what you told it to do.")
149
149
  end
150
- context "with a URI object passed" do
151
- it "requests the correct resource" do
152
- tweet = URI.parse("https://twitter.com/sferik/status/25938088801")
150
+ context 'with a URI object passed' do
151
+ it 'requests the correct resource' do
152
+ tweet = URI.parse('https://twitter.com/sferik/status/25938088801')
153
153
  @client.statuses(tweet)
154
- expect(a_get("/1.1/statuses/show/25938088801.json")).to have_been_made
154
+ expect(a_get('/1.1/statuses/show/25938088801.json')).to have_been_made
155
155
  end
156
156
  end
157
- context "with a URI string passed" do
158
- it "requests the correct resource" do
159
- @client.statuses("https://twitter.com/sferik/status/25938088801")
160
- expect(a_get("/1.1/statuses/show/25938088801.json")).to have_been_made
157
+ context 'with a URI string passed' do
158
+ it 'requests the correct resource' do
159
+ @client.statuses('https://twitter.com/sferik/status/25938088801')
160
+ expect(a_get('/1.1/statuses/show/25938088801.json')).to have_been_made
161
161
  end
162
162
  end
163
- context "with a Tweet passed" do
164
- it "requests the correct resource" do
165
- tweet = Twitter::Tweet.new(:id => 25938088801)
163
+ context 'with a Tweet passed' do
164
+ it 'requests the correct resource' do
165
+ tweet = Twitter::Tweet.new(:id => 25_938_088_801)
166
166
  @client.statuses(tweet)
167
- expect(a_get("/1.1/statuses/show/25938088801.json")).to have_been_made
167
+ expect(a_get('/1.1/statuses/show/25938088801.json')).to have_been_made
168
168
  end
169
169
  end
170
170
  end
171
171
 
172
- describe "#destroy_status" do
172
+ describe '#destroy_status' do
173
173
  before do
174
- stub_post("/1.1/statuses/destroy/25938088801.json").to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
174
+ stub_post('/1.1/statuses/destroy/25938088801.json').to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
175
175
  end
176
- it "requests the correct resource" do
177
- @client.destroy_status(25938088801)
178
- expect(a_post("/1.1/statuses/destroy/25938088801.json")).to have_been_made
176
+ it 'requests the correct resource' do
177
+ @client.destroy_status(25_938_088_801)
178
+ expect(a_post('/1.1/statuses/destroy/25938088801.json')).to have_been_made
179
179
  end
180
- it "returns an array of Tweets" do
181
- tweets = @client.destroy_status(25938088801)
180
+ it 'returns an array of Tweets' do
181
+ tweets = @client.destroy_status(25_938_088_801)
182
182
  expect(tweets).to be_an Array
183
183
  expect(tweets.first).to be_a Twitter::Tweet
184
184
  expect(tweets.first.text).to eq("The problem with your code is that it's doing exactly what you told it to do.")
185
185
  end
186
- context "with a URI object passed" do
187
- it "requests the correct resource" do
188
- tweet = URI.parse("https://twitter.com/sferik/status/25938088801")
186
+ context 'with a URI object passed' do
187
+ it 'requests the correct resource' do
188
+ tweet = URI.parse('https://twitter.com/sferik/status/25938088801')
189
189
  @client.destroy_status(tweet)
190
- expect(a_post("/1.1/statuses/destroy/25938088801.json")).to have_been_made
190
+ expect(a_post('/1.1/statuses/destroy/25938088801.json')).to have_been_made
191
191
  end
192
192
  end
193
- context "with a URI string passed" do
194
- it "requests the correct resource" do
195
- @client.destroy_status("https://twitter.com/sferik/status/25938088801")
196
- expect(a_post("/1.1/statuses/destroy/25938088801.json")).to have_been_made
193
+ context 'with a URI string passed' do
194
+ it 'requests the correct resource' do
195
+ @client.destroy_status('https://twitter.com/sferik/status/25938088801')
196
+ expect(a_post('/1.1/statuses/destroy/25938088801.json')).to have_been_made
197
197
  end
198
198
  end
199
- context "with a Tweet passed" do
200
- it "requests the correct resource" do
201
- tweet = Twitter::Tweet.new(:id => 25938088801)
199
+ context 'with a Tweet passed' do
200
+ it 'requests the correct resource' do
201
+ tweet = Twitter::Tweet.new(:id => 25_938_088_801)
202
202
  @client.destroy_status(tweet)
203
- expect(a_post("/1.1/statuses/destroy/25938088801.json")).to have_been_made
203
+ expect(a_post('/1.1/statuses/destroy/25938088801.json')).to have_been_made
204
204
  end
205
205
  end
206
206
  end
207
207
 
208
- describe "#update" do
208
+ describe '#update' do
209
209
  before do
210
- 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"})
210
+ 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'})
211
211
  end
212
- it "requests the correct resource" do
212
+ it 'requests the correct resource' do
213
213
  @client.update("The problem with your code is that it's doing exactly what you told it to do.")
214
- 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
214
+ 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
215
215
  end
216
- it "returns a Tweet" do
216
+ it 'returns a Tweet' do
217
217
  tweet = @client.update("The problem with your code is that it's doing exactly what you told it to do.")
218
218
  expect(tweet).to be_a Twitter::Tweet
219
219
  expect(tweet.text).to eq("The problem with your code is that it's doing exactly what you told it to do.")
220
220
  end
221
- context "already posted" do
221
+ context 'already posted' do
222
222
  before do
223
- 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_post('/1.1/statuses/update.json').to_return(:status => 403, :body => fixture('already_posted.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
224
224
  end
225
- it "raises an AlreadyPosted error" do
226
- 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::AlreadyPosted
225
+ it 'raises an AlreadyPosted error' do
226
+ 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::AlreadyPosted
227
227
  end
228
228
  end
229
- context "with an in-reply-to status" do
229
+ context 'with an in-reply-to status' do
230
230
  before do
231
231
  @tweet = Twitter::Tweet.new(:id => 1)
232
- 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"})
232
+ 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'})
233
233
  end
234
- it "requests the correct resource" do
234
+ it 'requests the correct resource' do
235
235
  @client.update("The problem with your code is that it's doing exactly what you told it to do.", :in_reply_to_status => @tweet)
236
- 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
236
+ 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
237
237
  end
238
238
  end
239
- context "with an in-reply-to status ID" do
239
+ context 'with an in-reply-to status ID' do
240
240
  before do
241
- 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"})
241
+ 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'})
242
242
  end
243
- it "requests the correct resource" do
243
+ it 'requests the correct resource' do
244
244
  @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)
245
- 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
245
+ 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
246
246
  end
247
247
  end
248
- context "with a place" do
248
+ context 'with a place' do
249
249
  before do
250
- @place = Twitter::Place.new(:woeid => "df51dec6f4ee2b2c")
251
- 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"})
250
+ @place = Twitter::Place.new(:woeid => 'df51dec6f4ee2b2c')
251
+ 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'})
252
252
  end
253
- it "requests the correct resource" do
253
+ it 'requests the correct resource' do
254
254
  @client.update("The problem with your code is that it's doing exactly what you told it to do.", :place => @place)
255
- 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
255
+ 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
256
256
  end
257
257
  end
258
- context "with a place ID" do
258
+ context 'with a place ID' do
259
259
  before do
260
- 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"})
260
+ 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'})
261
261
  end
262
- it "requests the correct resource" do
263
- @client.update("The problem with your code is that it's doing exactly what you told it to do.", :place_id => "df51dec6f4ee2b2c")
264
- 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
262
+ it 'requests the correct resource' do
263
+ @client.update("The problem with your code is that it's doing exactly what you told it to do.", :place_id => 'df51dec6f4ee2b2c')
264
+ 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
265
265
  end
266
266
  end
267
267
  end
268
268
 
269
- describe "#retweet" do
269
+ describe '#retweet' do
270
270
  before do
271
- stub_post("/1.1/statuses/retweet/25938088801.json").to_return(:body => fixture("retweet.json"), :headers => {:content_type => "application/json; charset=utf-8"})
271
+ stub_post('/1.1/statuses/retweet/25938088801.json').to_return(:body => fixture('retweet.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
272
272
  end
273
- it "requests the correct resource" do
274
- @client.retweet(25938088801)
275
- expect(a_post("/1.1/statuses/retweet/25938088801.json")).to have_been_made
273
+ it 'requests the correct resource' do
274
+ @client.retweet(25_938_088_801)
275
+ expect(a_post('/1.1/statuses/retweet/25938088801.json')).to have_been_made
276
276
  end
277
- it "returns an array of Tweets with retweet details embedded" do
278
- tweets = @client.retweet(25938088801)
277
+ it 'returns an array of Tweets with retweet details embedded' do
278
+ tweets = @client.retweet(25_938_088_801)
279
279
  expect(tweets).to be_an Array
280
280
  expect(tweets.first).to be_a Twitter::Tweet
281
281
  expect(tweets.first.text).to eq("As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush.")
282
282
  expect(tweets.first.retweeted_tweet.text).to eq("RT @gruber: As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush.")
283
283
  expect(tweets.first.retweeted_tweet.id).not_to eq(tweets.first.id)
284
284
  end
285
- context "already retweeted" do
285
+ context 'already retweeted' do
286
286
  before do
287
- 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"})
287
+ 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'})
288
288
  end
289
- it "does not raise an error" do
290
- expect{@client.retweet(25938088801)}.not_to raise_error
289
+ it 'does not raise an error' do
290
+ expect { @client.retweet(25_938_088_801) }.not_to raise_error
291
291
  end
292
292
  end
293
- context "with a URI object passed" do
294
- it "requests the correct resource" do
295
- tweet = URI.parse("https://twitter.com/sferik/status/25938088801")
293
+ context 'with a URI object passed' do
294
+ it 'requests the correct resource' do
295
+ tweet = URI.parse('https://twitter.com/sferik/status/25938088801')
296
296
  @client.retweet(tweet)
297
- expect(a_post("/1.1/statuses/retweet/25938088801.json")).to have_been_made
297
+ expect(a_post('/1.1/statuses/retweet/25938088801.json')).to have_been_made
298
298
  end
299
299
  end
300
- context "with a URI string passed" do
301
- it "requests the correct resource" do
302
- @client.retweet("https://twitter.com/sferik/status/25938088801")
303
- expect(a_post("/1.1/statuses/retweet/25938088801.json")).to have_been_made
300
+ context 'with a URI string passed' do
301
+ it 'requests the correct resource' do
302
+ @client.retweet('https://twitter.com/sferik/status/25938088801')
303
+ expect(a_post('/1.1/statuses/retweet/25938088801.json')).to have_been_made
304
304
  end
305
305
  end
306
- context "with a Tweet passed" do
307
- it "requests the correct resource" do
308
- tweet = Twitter::Tweet.new(:id => 25938088801)
306
+ context 'with a Tweet passed' do
307
+ it 'requests the correct resource' do
308
+ tweet = Twitter::Tweet.new(:id => 25_938_088_801)
309
309
  @client.retweet(tweet)
310
- expect(a_post("/1.1/statuses/retweet/25938088801.json")).to have_been_made
310
+ expect(a_post('/1.1/statuses/retweet/25938088801.json')).to have_been_made
311
311
  end
312
312
  end
313
313
  end
314
314
 
315
- describe "#retweet!" do
315
+ describe '#retweet!' do
316
316
  before do
317
- stub_post("/1.1/statuses/retweet/25938088801.json").to_return(:body => fixture("retweet.json"), :headers => {:content_type => "application/json; charset=utf-8"})
317
+ stub_post('/1.1/statuses/retweet/25938088801.json').to_return(:body => fixture('retweet.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
318
318
  end
319
- it "requests the correct resource" do
320
- @client.retweet!(25938088801)
321
- expect(a_post("/1.1/statuses/retweet/25938088801.json")).to have_been_made
319
+ it 'requests the correct resource' do
320
+ @client.retweet!(25_938_088_801)
321
+ expect(a_post('/1.1/statuses/retweet/25938088801.json')).to have_been_made
322
322
  end
323
- it "returns an array of Tweets with retweet details embedded" do
324
- tweets = @client.retweet!(25938088801)
323
+ it 'returns an array of Tweets with retweet details embedded' do
324
+ tweets = @client.retweet!(25_938_088_801)
325
325
  expect(tweets).to be_an Array
326
326
  expect(tweets.first).to be_a Twitter::Tweet
327
327
  expect(tweets.first.text).to eq("As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush.")
328
328
  expect(tweets.first.retweeted_tweet.text).to eq("RT @gruber: As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush.")
329
329
  expect(tweets.first.retweeted_tweet.id).not_to eq(tweets.first.id)
330
330
  end
331
- context "forbidden" do
331
+ context 'forbidden' do
332
332
  before do
333
- stub_post("/1.1/statuses/retweet/25938088801.json").to_return(:status => 403, :headers => {:content_type => "application/json; charset=utf-8"})
333
+ stub_post('/1.1/statuses/retweet/25938088801.json').to_return(:status => 403, :headers => {:content_type => 'application/json; charset=utf-8'})
334
334
  end
335
- it "raises a Forbidden error" do
336
- expect{@client.retweet!(25938088801)}.to raise_error Twitter::Error::Forbidden
335
+ it 'raises a Forbidden error' do
336
+ expect { @client.retweet!(25_938_088_801) }.to raise_error Twitter::Error::Forbidden
337
337
  end
338
338
  end
339
- context "already retweeted" do
339
+ context 'already retweeted' do
340
340
  before do
341
- 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"})
341
+ 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'})
342
342
  end
343
- it "raises an AlreadyRetweeted error" do
344
- expect{@client.retweet!(25938088801)}.to raise_error Twitter::Error::AlreadyRetweeted
343
+ it 'raises an AlreadyRetweeted error' do
344
+ expect { @client.retweet!(25_938_088_801) }.to raise_error Twitter::Error::AlreadyRetweeted
345
345
  end
346
346
  end
347
- context "with a URI object passed" do
348
- it "requests the correct resource" do
349
- tweet = URI.parse("https://twitter.com/sferik/status/25938088801")
347
+ context 'with a URI object passed' do
348
+ it 'requests the correct resource' do
349
+ tweet = URI.parse('https://twitter.com/sferik/status/25938088801')
350
350
  @client.retweet!(tweet)
351
- expect(a_post("/1.1/statuses/retweet/25938088801.json")).to have_been_made
351
+ expect(a_post('/1.1/statuses/retweet/25938088801.json')).to have_been_made
352
352
  end
353
353
  end
354
- context "with a URI string passed" do
355
- it "requests the correct resource" do
356
- @client.retweet!("https://twitter.com/sferik/status/25938088801")
357
- expect(a_post("/1.1/statuses/retweet/25938088801.json")).to have_been_made
354
+ context 'with a URI string passed' do
355
+ it 'requests the correct resource' do
356
+ @client.retweet!('https://twitter.com/sferik/status/25938088801')
357
+ expect(a_post('/1.1/statuses/retweet/25938088801.json')).to have_been_made
358
358
  end
359
359
  end
360
- context "with a Tweet passed" do
361
- it "requests the correct resource" do
362
- tweet = Twitter::Tweet.new(:id => 25938088801)
360
+ context 'with a Tweet passed' do
361
+ it 'requests the correct resource' do
362
+ tweet = Twitter::Tweet.new(:id => 25_938_088_801)
363
363
  @client.retweet!(tweet)
364
- expect(a_post("/1.1/statuses/retweet/25938088801.json")).to have_been_made
364
+ expect(a_post('/1.1/statuses/retweet/25938088801.json')).to have_been_made
365
365
  end
366
366
  end
367
367
  end
368
368
 
369
- describe "#update_with_media" do
369
+ describe '#update_with_media' do
370
370
  before do
371
- stub_post("/1.1/statuses/update_with_media.json").to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
371
+ stub_post('/1.1/statuses/update_with_media.json').to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
372
372
  end
373
- context "a gif image" do
374
- it "requests the correct resource" do
375
- @client.update_with_media("The problem with your code is that it's doing exactly what you told it to do.", fixture("pbjt.gif"))
376
- expect(a_post("/1.1/statuses/update_with_media.json")).to have_been_made
373
+ context 'a gif image' do
374
+ it 'requests the correct resource' do
375
+ @client.update_with_media("The problem with your code is that it's doing exactly what you told it to do.", fixture('pbjt.gif'))
376
+ expect(a_post('/1.1/statuses/update_with_media.json')).to have_been_made
377
377
  end
378
- it "returns a Tweet" do
379
- 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"))
378
+ it 'returns a Tweet' do
379
+ 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'))
380
380
  expect(tweet).to be_a Twitter::Tweet
381
381
  expect(tweet.text).to eq("The problem with your code is that it's doing exactly what you told it to do.")
382
382
  end
383
383
  end
384
- context "a jpe image" do
385
- it "requests the correct resource" do
386
- @client.update_with_media("You always have options", fixture("wildcomet2.jpe"))
387
- expect(a_post("/1.1/statuses/update_with_media.json")).to have_been_made
384
+ context 'a jpe image' do
385
+ it 'requests the correct resource' do
386
+ @client.update_with_media('You always have options', fixture('wildcomet2.jpe'))
387
+ expect(a_post('/1.1/statuses/update_with_media.json')).to have_been_made
388
388
  end
389
389
  end
390
- context "a jpeg image" do
391
- it "requests the correct resource" do
392
- @client.update_with_media("You always have options", fixture("me.jpeg"))
393
- expect(a_post("/1.1/statuses/update_with_media.json")).to have_been_made
390
+ context 'a jpeg image' do
391
+ it 'requests the correct resource' do
392
+ @client.update_with_media('You always have options', fixture('me.jpeg'))
393
+ expect(a_post('/1.1/statuses/update_with_media.json')).to have_been_made
394
394
  end
395
395
  end
396
- context "a png image" do
397
- it "requests the correct resource" do
398
- @client.update_with_media("You always have options", fixture("we_concept_bg2.png"))
399
- expect(a_post("/1.1/statuses/update_with_media.json")).to have_been_made
396
+ context 'a png image' do
397
+ it 'requests the correct resource' do
398
+ @client.update_with_media('You always have options', fixture('we_concept_bg2.png'))
399
+ expect(a_post('/1.1/statuses/update_with_media.json')).to have_been_made
400
400
  end
401
401
  end
402
- context "a Tempfile" do
403
- it "requests the correct resource" do
404
- @client.update_with_media("You always have options", Tempfile.new("tmp"))
405
- expect(a_post("/1.1/statuses/update_with_media.json")).to have_been_made
402
+ context 'a Tempfile' do
403
+ it 'requests the correct resource' do
404
+ @client.update_with_media('You always have options', Tempfile.new('tmp'))
405
+ expect(a_post('/1.1/statuses/update_with_media.json')).to have_been_made
406
406
  end
407
407
  end
408
- context "already posted" do
408
+ context 'already posted' do
409
409
  before do
410
- 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"})
410
+ 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'})
411
411
  end
412
- it "raises an AlreadyPosted error" do
413
- 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::AlreadyPosted
412
+ it 'raises an AlreadyPosted error' do
413
+ 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::AlreadyPosted
414
414
  end
415
415
  end
416
416
  end
417
417
 
418
- describe "#oembed" do
418
+ describe '#oembed' do
419
419
  before do
420
- 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"})
421
- 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"})
420
+ 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'})
421
+ 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'})
422
422
  end
423
- it "requests the correct resource" do
424
- @client.oembed(25938088801)
425
- expect(a_get("/1.1/statuses/oembed.json").with(:query => {:id => "25938088801"})).to have_been_made
423
+ it 'requests the correct resource' do
424
+ @client.oembed(25_938_088_801)
425
+ expect(a_get('/1.1/statuses/oembed.json').with(:query => {:id => '25938088801'})).to have_been_made
426
426
  end
427
- it "requests the correct resource when a URL is given" do
428
- @client.oembed("https://twitter.com/sferik/status/25938088801")
429
- expect(a_get("/1.1/statuses/oembed.json").with(:query => {:url => "https://twitter.com/sferik/status/25938088801"}))
427
+ it 'requests the correct resource when a URL is given' do
428
+ @client.oembed('https://twitter.com/sferik/status/25938088801')
429
+ expect(a_get('/1.1/statuses/oembed.json').with(:query => {:url => 'https://twitter.com/sferik/status/25938088801'}))
430
430
  end
431
- it "returns an array of OEmbed instances" do
432
- oembed = @client.oembed(25938088801)
431
+ it 'returns an array of OEmbed instances' do
432
+ oembed = @client.oembed(25_938_088_801)
433
433
  expect(oembed).to be_a Twitter::OEmbed
434
434
  end
435
- context "with a URI object passed" do
436
- it "requests the correct resource" do
437
- tweet = URI.parse("https://twitter.com/sferik/status/25938088801")
435
+ context 'with a URI object passed' do
436
+ it 'requests the correct resource' do
437
+ tweet = URI.parse('https://twitter.com/sferik/status/25938088801')
438
438
  @client.oembed(tweet)
439
- expect(a_get("/1.1/statuses/oembed.json").with(:query => {:id => "25938088801"})).to have_been_made
439
+ expect(a_get('/1.1/statuses/oembed.json').with(:query => {:id => '25938088801'})).to have_been_made
440
440
  end
441
441
  end
442
- context "with a URI string passed" do
443
- it "requests the correct resource" do
444
- @client.oembed("https://twitter.com/sferik/status/25938088801")
445
- expect(a_get("/1.1/statuses/oembed.json").with(:query => {:id => "25938088801"})).to have_been_made
442
+ context 'with a URI string passed' do
443
+ it 'requests the correct resource' do
444
+ @client.oembed('https://twitter.com/sferik/status/25938088801')
445
+ expect(a_get('/1.1/statuses/oembed.json').with(:query => {:id => '25938088801'})).to have_been_made
446
446
  end
447
447
  end
448
- context "with a Tweet passed" do
449
- it "requests the correct resource" do
450
- tweet = Twitter::Tweet.new(:id => 25938088801)
448
+ context 'with a Tweet passed' do
449
+ it 'requests the correct resource' do
450
+ tweet = Twitter::Tweet.new(:id => 25_938_088_801)
451
451
  @client.oembed(tweet)
452
- expect(a_get("/1.1/statuses/oembed.json").with(:query => {:id => "25938088801"})).to have_been_made
452
+ expect(a_get('/1.1/statuses/oembed.json').with(:query => {:id => '25938088801'})).to have_been_made
453
453
  end
454
454
  end
455
455
  end
456
456
 
457
- describe "#oembeds" do
457
+ describe '#oembeds' do
458
458
  before do
459
- 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"})
459
+ 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'})
460
460
  end
461
- it "requests the correct resource" do
462
- @client.oembeds(25938088801)
463
- expect(a_get("/1.1/statuses/oembed.json").with(:query => {:id => "25938088801"})).to have_been_made
461
+ it 'requests the correct resource' do
462
+ @client.oembeds(25_938_088_801)
463
+ expect(a_get('/1.1/statuses/oembed.json').with(:query => {:id => '25938088801'})).to have_been_made
464
464
  end
465
- it "requests the correct resource when a URL is given" do
466
- @client.oembeds("https://twitter.com/sferik/status/25938088801")
467
- expect(a_get("/1.1/statuses/oembed.json").with(:query => {:id => "25938088801"})).to have_been_made
465
+ it 'requests the correct resource when a URL is given' do
466
+ @client.oembeds('https://twitter.com/sferik/status/25938088801')
467
+ expect(a_get('/1.1/statuses/oembed.json').with(:query => {:id => '25938088801'})).to have_been_made
468
468
  end
469
- it "returns an array of OEmbed instances" do
470
- oembeds = @client.oembeds(25938088801)
469
+ it 'returns an array of OEmbed instances' do
470
+ oembeds = @client.oembeds(25_938_088_801)
471
471
  expect(oembeds).to be_an Array
472
472
  expect(oembeds.first).to be_a Twitter::OEmbed
473
473
  end
474
- context "with a URI object passed" do
475
- it "requests the correct resource" do
476
- tweet = URI.parse("https://twitter.com/sferik/status/25938088801")
474
+ context 'with a URI object passed' do
475
+ it 'requests the correct resource' do
476
+ tweet = URI.parse('https://twitter.com/sferik/status/25938088801')
477
477
  @client.oembeds(tweet)
478
- expect(a_get("/1.1/statuses/oembed.json").with(:query => {:id => "25938088801"})).to have_been_made
478
+ expect(a_get('/1.1/statuses/oembed.json').with(:query => {:id => '25938088801'})).to have_been_made
479
479
  end
480
480
  end
481
- context "with a URI string passed" do
482
- it "requests the correct resource" do
483
- @client.oembeds("https://twitter.com/sferik/status/25938088801")
484
- expect(a_get("/1.1/statuses/oembed.json").with(:query => {:id => "25938088801"})).to have_been_made
481
+ context 'with a URI string passed' do
482
+ it 'requests the correct resource' do
483
+ @client.oembeds('https://twitter.com/sferik/status/25938088801')
484
+ expect(a_get('/1.1/statuses/oembed.json').with(:query => {:id => '25938088801'})).to have_been_made
485
485
  end
486
486
  end
487
- context "with a Tweet passed" do
488
- it "requests the correct resource" do
489
- tweet = Twitter::Tweet.new(:id => 25938088801)
487
+ context 'with a Tweet passed' do
488
+ it 'requests the correct resource' do
489
+ tweet = Twitter::Tweet.new(:id => 25_938_088_801)
490
490
  @client.oembeds(tweet)
491
- expect(a_get("/1.1/statuses/oembed.json").with(:query => {:id => "25938088801"})).to have_been_made
491
+ expect(a_get('/1.1/statuses/oembed.json').with(:query => {:id => '25938088801'})).to have_been_made
492
492
  end
493
493
  end
494
494
  end
495
495
 
496
- describe "#retweeters_ids" do
496
+ describe '#retweeters_ids' do
497
497
  before do
498
- 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"})
498
+ 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'})
499
499
  end
500
- it "requests the correct resource" do
501
- @client.retweeters_ids(25938088801)
502
- expect(a_get("/1.1/statuses/retweeters/ids.json").with(:query => {:id => "25938088801", :cursor => "-1"})).to have_been_made
500
+ it 'requests the correct resource' do
501
+ @client.retweeters_ids(25_938_088_801)
502
+ expect(a_get('/1.1/statuses/retweeters/ids.json').with(:query => {:id => '25938088801', :cursor => '-1'})).to have_been_made
503
503
  end
504
- it "returns a collection of up to 100 user IDs belonging to users who have retweeted the tweet specified by the id parameter" do
505
- retweeters_ids = @client.retweeters_ids(25938088801)
504
+ it 'returns a collection of up to 100 user IDs belonging to users who have retweeted the tweet specified by the id parameter' do
505
+ retweeters_ids = @client.retweeters_ids(25_938_088_801)
506
506
  expect(retweeters_ids).to be_a Twitter::Cursor
507
- expect(retweeters_ids.first).to eq(20009713)
507
+ expect(retweeters_ids.first).to eq(20_009_713)
508
508
  end
509
- context "with each" do
509
+ context 'with each' do
510
510
  before do
511
- 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"})
511
+ 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'})
512
512
  end
513
- it "requests the correct resource" do
514
- @client.retweeters_ids(25938088801).each{}
515
- expect(a_get("/1.1/statuses/retweeters/ids.json").with(:query => {:id => "25938088801", :cursor => "-1"})).to have_been_made
516
- expect(a_get("/1.1/statuses/retweeters/ids.json").with(:query => {:id => "25938088801", :cursor => "1305102810874389703"})).to have_been_made
513
+ it 'requests the correct resource' do
514
+ @client.retweeters_ids(25_938_088_801).each {}
515
+ expect(a_get('/1.1/statuses/retweeters/ids.json').with(:query => {:id => '25938088801', :cursor => '-1'})).to have_been_made
516
+ expect(a_get('/1.1/statuses/retweeters/ids.json').with(:query => {:id => '25938088801', :cursor => '1305102810874389703'})).to have_been_made
517
517
  end
518
518
  end
519
- context "with a URI object passed" do
520
- it "requests the correct resource" do
521
- tweet = URI.parse("https://twitter.com/sferik/status/25938088801")
519
+ context 'with a URI object passed' do
520
+ it 'requests the correct resource' do
521
+ tweet = URI.parse('https://twitter.com/sferik/status/25938088801')
522
522
  @client.retweeters_ids(tweet)
523
- expect(a_get("/1.1/statuses/retweeters/ids.json").with(:query => {:id => "25938088801", :cursor => "-1"})).to have_been_made
523
+ expect(a_get('/1.1/statuses/retweeters/ids.json').with(:query => {:id => '25938088801', :cursor => '-1'})).to have_been_made
524
524
  end
525
525
  end
526
- context "with a URI string passed" do
527
- it "requests the correct resource" do
528
- @client.retweeters_ids("https://twitter.com/sferik/status/25938088801")
529
- expect(a_get("/1.1/statuses/retweeters/ids.json").with(:query => {:id => "25938088801", :cursor => "-1"})).to have_been_made
526
+ context 'with a URI string passed' do
527
+ it 'requests the correct resource' do
528
+ @client.retweeters_ids('https://twitter.com/sferik/status/25938088801')
529
+ expect(a_get('/1.1/statuses/retweeters/ids.json').with(:query => {:id => '25938088801', :cursor => '-1'})).to have_been_made
530
530
  end
531
531
  end
532
- context "with a Tweet passed" do
533
- it "requests the correct resource" do
534
- tweet = Twitter::Tweet.new(:id => 25938088801)
532
+ context 'with a Tweet passed' do
533
+ it 'requests the correct resource' do
534
+ tweet = Twitter::Tweet.new(:id => 25_938_088_801)
535
535
  @client.retweeters_ids(tweet)
536
- expect(a_get("/1.1/statuses/retweeters/ids.json").with(:query => {:id => "25938088801", :cursor => "-1"})).to have_been_made
536
+ expect(a_get('/1.1/statuses/retweeters/ids.json').with(:query => {:id => '25938088801', :cursor => '-1'})).to have_been_made
537
537
  end
538
538
  end
539
539
  end