twitter 5.0.0 → 5.4.1

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