twitter 4.1.0 → 4.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/CHANGELOG.md +5 -0
  2. data/README.md +11 -9
  3. data/lib/twitter/api.rb +3 -5
  4. data/lib/twitter/base.rb +1 -4
  5. data/lib/twitter/geo/point.rb +2 -2
  6. data/lib/twitter/request/multipart_with_file.rb +1 -1
  7. data/lib/twitter/tweet.rb +9 -1
  8. data/lib/twitter/user.rb +2 -0
  9. data/lib/twitter/version.rb +1 -1
  10. data/spec/fixtures/status.json +1 -1
  11. data/spec/helper.rb +6 -0
  12. data/spec/twitter/action/favorite_spec.rb +6 -6
  13. data/spec/twitter/action/follow_spec.rb +6 -6
  14. data/spec/twitter/action/list_member_added_spec.rb +9 -9
  15. data/spec/twitter/action/mention_spec.rb +11 -11
  16. data/spec/twitter/action/reply_spec.rb +9 -9
  17. data/spec/twitter/action/retweet_spec.rb +9 -9
  18. data/spec/twitter/action_factory_spec.rb +7 -9
  19. data/spec/twitter/action_spec.rb +2 -2
  20. data/spec/twitter/api/account_spec.rb +38 -66
  21. data/spec/twitter/api/activity_spec.rb +6 -10
  22. data/spec/twitter/api/blocks_spec.rb +38 -83
  23. data/spec/twitter/api/direct_messages_spec.rb +33 -55
  24. data/spec/twitter/api/friendships_spec.rb +124 -266
  25. data/spec/twitter/api/geo_spec.rb +18 -36
  26. data/spec/twitter/api/help_spec.rb +15 -23
  27. data/spec/twitter/api/lists_spec.rb +172 -402
  28. data/spec/twitter/api/report_spam_spec.rb +5 -9
  29. data/spec/twitter/api/saved_searches_spec.rb +23 -35
  30. data/spec/twitter/api/search_spec.rb +15 -25
  31. data/spec/twitter/api/statuses_spec.rb +137 -235
  32. data/spec/twitter/api/trends_spec.rb +17 -29
  33. data/spec/twitter/api/users_spec.rb +90 -181
  34. data/spec/twitter/base_spec.rb +38 -40
  35. data/spec/twitter/basic_user_spec.rb +3 -3
  36. data/spec/twitter/client_spec.rb +28 -46
  37. data/spec/twitter/configuration_spec.rb +3 -3
  38. data/spec/twitter/cursor_spec.rb +16 -32
  39. data/spec/twitter/direct_message_spec.rb +9 -9
  40. data/spec/twitter/error/client_error_spec.rb +4 -12
  41. data/spec/twitter/error/server_error_spec.rb +2 -6
  42. data/spec/twitter/error_spec.rb +2 -2
  43. data/spec/twitter/geo/point_spec.rb +6 -6
  44. data/spec/twitter/geo/polygon_spec.rb +4 -4
  45. data/spec/twitter/geo_factory_spec.rb +3 -5
  46. data/spec/twitter/geo_spec.rb +4 -4
  47. data/spec/twitter/identifiable_spec.rb +9 -13
  48. data/spec/twitter/list_spec.rb +7 -7
  49. data/spec/twitter/media/photo_spec.rb +6 -6
  50. data/spec/twitter/media_factory_spec.rb +2 -4
  51. data/spec/twitter/oembed_spec.rb +24 -24
  52. data/spec/twitter/place_spec.rb +13 -13
  53. data/spec/twitter/rate_limit_spec.rb +16 -16
  54. data/spec/twitter/relationship_spec.rb +5 -5
  55. data/spec/twitter/saved_search_spec.rb +5 -5
  56. data/spec/twitter/search_results_spec.rb +21 -21
  57. data/spec/twitter/settings_spec.rb +2 -2
  58. data/spec/twitter/size_spec.rb +6 -6
  59. data/spec/twitter/source_user_spec.rb +3 -3
  60. data/spec/twitter/suggestion_spec.rb +9 -9
  61. data/spec/twitter/target_user_spec.rb +3 -3
  62. data/spec/twitter/trend_spec.rb +6 -6
  63. data/spec/twitter/tweet_spec.rb +69 -69
  64. data/spec/twitter/user_spec.rb +43 -43
  65. data/spec/twitter_spec.rb +12 -16
  66. metadata +2 -2
@@ -9,71 +9,59 @@ describe Twitter::API do
9
9
  describe "#trends" do
10
10
  context "with woeid passed" do
11
11
  before do
12
- stub_get("/1.1/trends/place.json").
13
- with(:query => {:id => "2487956"}).
14
- 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"})
15
13
  end
16
14
  it "requests the correct resource" do
17
15
  @client.trends(2487956)
18
- a_get("/1.1/trends/place.json").
19
- with(:query => {:id => "2487956"}).
20
- should have_been_made
16
+ expect(a_get("/1.1/trends/place.json").with(:query => {:id => "2487956"})).to have_been_made
21
17
  end
22
18
  it "returns the top 10 trending topics for a specific WOEID" do
23
19
  matching_trends = @client.trends(2487956)
24
- matching_trends.should be_an Array
25
- matching_trends.first.should be_a Twitter::Trend
26
- matching_trends.first.name.should eq "#sevenwordsaftersex"
20
+ expect(matching_trends).to be_an Array
21
+ expect(matching_trends.first).to be_a Twitter::Trend
22
+ expect(matching_trends.first.name).to eq "#sevenwordsaftersex"
27
23
  end
28
24
  end
29
25
  context "without arguments passed" do
30
26
  before do
31
- stub_get("/1.1/trends/place.json").
32
- with(:query => {:id => "1"}).
33
- 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"})
34
28
  end
35
29
  it "requests the correct resource" do
36
30
  @client.trends
37
- a_get("/1.1/trends/place.json").
38
- with(:query => {:id => "1"}).
39
- should have_been_made
31
+ expect(a_get("/1.1/trends/place.json").with(:query => {:id => "1"})).to have_been_made
40
32
  end
41
33
  end
42
34
  end
43
35
 
44
36
  describe "#trends_available" do
45
37
  before do
46
- stub_get("/1.1/trends/available.json").
47
- 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"})
48
39
  end
49
40
  it "requests the correct resource" do
50
41
  @client.trends_available
51
- a_get("/1.1/trends/available.json").
52
- should have_been_made
42
+ expect(a_get("/1.1/trends/available.json")).to have_been_made
53
43
  end
54
44
  it "returns the locations that Twitter has trending topic information for" do
55
45
  locations = @client.trends_available
56
- locations.should be_an Array
57
- locations.first.should be_a Twitter::Place
58
- locations.first.name.should eq "Ireland"
46
+ expect(locations).to be_an Array
47
+ expect(locations.first).to be_a Twitter::Place
48
+ expect(locations.first.name).to eq "Ireland"
59
49
  end
60
50
  end
61
51
 
62
52
  describe "#trends_closest" do
63
53
  before do
64
- stub_get("/1.1/trends/closest.json").
65
- 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"})
66
55
  end
67
56
  it "requests the correct resource" do
68
57
  @client.trends_closest
69
- a_get("/1.1/trends/closest.json").
70
- should have_been_made
58
+ expect(a_get("/1.1/trends/closest.json")).to have_been_made
71
59
  end
72
60
  it "returns the locations that Twitter has trending topic information for" do
73
61
  locations = @client.trends_closest
74
- locations.should be_an Array
75
- locations.first.should be_a Twitter::Place
76
- locations.first.name.should eq "Ireland"
62
+ expect(locations).to be_an Array
63
+ expect(locations.first).to be_a Twitter::Place
64
+ expect(locations.first.name).to eq "Ireland"
77
65
  end
78
66
  end
79
67
 
@@ -9,319 +9,248 @@ describe Twitter::API do
9
9
  describe "#suggestions" do
10
10
  context "with a category slug passed" do
11
11
  before do
12
- stub_get("/1.1/users/suggestions/art-design.json").
13
- to_return(:body => fixture("category.json"), :headers => {:content_type => "application/json; charset=utf-8"})
12
+ stub_get("/1.1/users/suggestions/art-design.json").to_return(:body => fixture("category.json"), :headers => {:content_type => "application/json; charset=utf-8"})
14
13
  end
15
14
  it "requests the correct resource" do
16
15
  @client.suggestions("art-design")
17
- a_get("/1.1/users/suggestions/art-design.json").
18
- should have_been_made
16
+ expect(a_get("/1.1/users/suggestions/art-design.json")).to have_been_made
19
17
  end
20
18
  it "returns the users in a given category of the Twitter suggested user list" do
21
19
  suggestion = @client.suggestions("art-design")
22
- suggestion.should be_a Twitter::Suggestion
23
- suggestion.name.should eq "Art & Design"
24
- suggestion.users.should be_an Array
25
- suggestion.users.first.should be_a Twitter::User
20
+ expect(suggestion).to be_a Twitter::Suggestion
21
+ expect(suggestion.name).to eq "Art & Design"
22
+ expect(suggestion.users).to be_an Array
23
+ expect(suggestion.users.first).to be_a Twitter::User
26
24
  end
27
25
  end
28
26
  context "without arguments passed" do
29
27
  before do
30
- stub_get("/1.1/users/suggestions.json").
31
- to_return(:body => fixture("suggestions.json"), :headers => {:content_type => "application/json; charset=utf-8"})
28
+ stub_get("/1.1/users/suggestions.json").to_return(:body => fixture("suggestions.json"), :headers => {:content_type => "application/json; charset=utf-8"})
32
29
  end
33
30
  it "requests the correct resource" do
34
31
  @client.suggestions
35
- a_get("/1.1/users/suggestions.json").
36
- should have_been_made
32
+ expect(a_get("/1.1/users/suggestions.json")).to have_been_made
37
33
  end
38
34
  it "returns the list of suggested user categories" do
39
35
  suggestions = @client.suggestions
40
- suggestions.should be_an Array
41
- suggestions.first.should be_a Twitter::Suggestion
42
- suggestions.first.name.should eq "Art & Design"
36
+ expect(suggestions).to be_an Array
37
+ expect(suggestions.first).to be_a Twitter::Suggestion
38
+ expect(suggestions.first.name).to eq "Art & Design"
43
39
  end
44
40
  end
45
41
  end
46
42
 
47
43
  describe "#suggest_users" do
48
44
  before do
49
- stub_get("/1.1/users/suggestions/art-design/members.json").
50
- to_return(:body => fixture("members.json"), :headers => {:content_type => "application/json; charset=utf-8"})
45
+ stub_get("/1.1/users/suggestions/art-design/members.json").to_return(:body => fixture("members.json"), :headers => {:content_type => "application/json; charset=utf-8"})
51
46
  end
52
47
  it "requests the correct resource" do
53
48
  @client.suggest_users("art-design")
54
- a_get("/1.1/users/suggestions/art-design/members.json").
55
- should have_been_made
49
+ expect(a_get("/1.1/users/suggestions/art-design/members.json")).to have_been_made
56
50
  end
57
51
  it "returns users in a given category of the Twitter suggested user list and return their most recent status if they are not a protected user" do
58
52
  suggest_users = @client.suggest_users("art-design")
59
- suggest_users.should be_an Array
60
- suggest_users.first.should be_a Twitter::User
61
- suggest_users.first.name.should eq "OMGFacts"
53
+ expect(suggest_users).to be_an Array
54
+ expect(suggest_users.first).to be_a Twitter::User
55
+ expect(suggest_users.first.name).to eq "OMGFacts"
62
56
  end
63
57
  end
64
58
 
65
59
  describe "#users" do
66
60
  context "with screen names passed" do
67
61
  before do
68
- stub_post("/1.1/users/lookup.json").
69
- with(:body => {:screen_name => "sferik,pengwynn"}).
70
- to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
62
+ stub_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
71
63
  end
72
64
  it "requests the correct resource" do
73
65
  @client.users("sferik", "pengwynn")
74
- a_post("/1.1/users/lookup.json").
75
- with(:body => {:screen_name => "sferik,pengwynn"}).
76
- should have_been_made
66
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"})).to have_been_made
77
67
  end
78
68
  it "returns up to 100 users worth of extended information" do
79
69
  users = @client.users("sferik", "pengwynn")
80
- users.should be_an Array
81
- users.first.should be_a Twitter::User
82
- users.first.id.should eq 7505382
70
+ expect(users).to be_an Array
71
+ expect(users.first).to be_a Twitter::User
72
+ expect(users.first.id).to eq 7505382
83
73
  end
84
74
  end
85
75
  context "with numeric screen names passed" do
86
76
  before do
87
- stub_post("/1.1/users/lookup.json").
88
- with(:body => {:screen_name => "0,311"}).
89
- to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
77
+ stub_post("/1.1/users/lookup.json").with(:body => {:screen_name => "0,311"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
90
78
  end
91
79
  it "requests the correct resource" do
92
80
  @client.users("0", "311")
93
- a_post("/1.1/users/lookup.json").
94
- with(:body => {:screen_name => "0,311"}).
95
- should have_been_made
81
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:screen_name => "0,311"})).to have_been_made
96
82
  end
97
83
  end
98
84
  context "with user IDs passed" do
99
85
  before do
100
- stub_post("/1.1/users/lookup.json").
101
- with(:body => {:user_id => "7505382,14100886"}).
102
- to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
86
+ stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382,14100886"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
103
87
  end
104
88
  it "requests the correct resource" do
105
89
  @client.users(7505382, 14100886)
106
- a_post("/1.1/users/lookup.json").
107
- with(:body => {:user_id => "7505382,14100886"}).
108
- should have_been_made
90
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382,14100886"})).to have_been_made
109
91
  end
110
92
  end
111
93
  context "with both screen names and user IDs passed" do
112
94
  before do
113
- stub_post("/1.1/users/lookup.json").
114
- with(:body => {:screen_name => "sferik", :user_id => "14100886"}).
115
- to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
95
+ stub_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik", :user_id => "14100886"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
116
96
  end
117
97
  it "requests the correct resource" do
118
98
  @client.users("sferik", 14100886)
119
- a_post("/1.1/users/lookup.json").
120
- with(:body => {:screen_name => "sferik", :user_id => "14100886"}).
121
- should have_been_made
99
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik", :user_id => "14100886"})).to have_been_made
122
100
  end
123
101
  end
124
102
  context "with user objects passed" do
125
103
  before do
126
- stub_post("/1.1/users/lookup.json").
127
- with(:body => {:user_id => "7505382,14100886"}).
128
- to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
104
+ stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382,14100886"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
129
105
  end
130
106
  it "requests the correct resource" do
131
107
  user1 = Twitter::User.new(:id => '7505382')
132
108
  user2 = Twitter::User.new(:id => '14100886')
133
109
  @client.users(user1, user2)
134
- a_post("/1.1/users/lookup.json").
135
- with(:body => {:user_id => "7505382,14100886"}).
136
- should have_been_made
110
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382,14100886"})).to have_been_made
137
111
  end
138
112
  end
139
113
  end
140
114
 
141
115
  describe "#user_search" do
142
116
  before do
143
- stub_get("/1.1/users/search.json").
144
- with(:query => {:q => "Erik Michaels-Ober"}).
145
- to_return(:body => fixture("user_search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
117
+ stub_get("/1.1/users/search.json").with(:query => {:q => "Erik Michaels-Ober"}).to_return(:body => fixture("user_search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
146
118
  end
147
119
  it "requests the correct resource" do
148
120
  @client.user_search("Erik Michaels-Ober")
149
- a_get("/1.1/users/search.json").
150
- with(:query => {:q => "Erik Michaels-Ober"}).
151
- should have_been_made
121
+ expect(a_get("/1.1/users/search.json").with(:query => {:q => "Erik Michaels-Ober"})).to have_been_made
152
122
  end
153
123
  it "returns an array of user search results" do
154
124
  user_search = @client.user_search("Erik Michaels-Ober")
155
- user_search.should be_an Array
156
- user_search.first.should be_a Twitter::User
157
- user_search.first.id.should eq 7505382
125
+ expect(user_search).to be_an Array
126
+ expect(user_search.first).to be_a Twitter::User
127
+ expect(user_search.first.id).to eq 7505382
158
128
  end
159
129
  end
160
130
 
161
131
  describe "#user" do
162
132
  context "with a screen name passed" do
163
133
  before do
164
- stub_get("/1.1/users/show.json").
165
- with(:query => {:screen_name => "sferik"}).
166
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
134
+ stub_get("/1.1/users/show.json").with(:query => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
167
135
  end
168
136
  it "requests the correct resource" do
169
137
  @client.user("sferik")
170
- a_get("/1.1/users/show.json").
171
- with(:query => {:screen_name => "sferik"}).
172
- should have_been_made
138
+ expect(a_get("/1.1/users/show.json").with(:query => {:screen_name => "sferik"})).to have_been_made
173
139
  end
174
140
  it "returns extended information of a given user" do
175
141
  user = @client.user("sferik")
176
- user.should be_a Twitter::User
177
- user.id.should eq 7505382
142
+ expect(user).to be_a Twitter::User
143
+ expect(user.id).to eq 7505382
178
144
  end
179
145
  end
180
146
  context "with a screen name including '@' passed" do
181
147
  before do
182
- stub_get("/1.1/users/show.json").
183
- with(:query => {:screen_name => "@sferik"}).
184
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
148
+ stub_get("/1.1/users/show.json").with(:query => {:screen_name => "@sferik"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
185
149
  end
186
150
  it "requests the correct resource" do
187
151
  @client.user("@sferik")
188
- a_get("/1.1/users/show.json").
189
- with(:query => {:screen_name => "@sferik"}).
190
- should have_been_made
152
+ expect(a_get("/1.1/users/show.json").with(:query => {:screen_name => "@sferik"})).to have_been_made
191
153
  end
192
154
  end
193
155
  context "with a numeric screen name passed" do
194
156
  before do
195
- stub_get("/1.1/users/show.json").
196
- with(:query => {:screen_name => "0"}).
197
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
157
+ stub_get("/1.1/users/show.json").with(:query => {:screen_name => "0"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
198
158
  end
199
159
  it "requests the correct resource" do
200
160
  @client.user("0")
201
- a_get("/1.1/users/show.json").
202
- with(:query => {:screen_name => "0"}).
203
- should have_been_made
161
+ expect(a_get("/1.1/users/show.json").with(:query => {:screen_name => "0"})).to have_been_made
204
162
  end
205
163
  end
206
164
  context "with a user ID passed" do
207
165
  before do
208
- stub_get("/1.1/users/show.json").
209
- with(:query => {:user_id => "7505382"}).
210
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
166
+ stub_get("/1.1/users/show.json").with(:query => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
211
167
  end
212
168
  it "requests the correct resource" do
213
169
  @client.user(7505382)
214
- a_get("/1.1/users/show.json").
215
- with(:query => {:user_id => "7505382"}).
216
- should have_been_made
170
+ expect(a_get("/1.1/users/show.json").with(:query => {:user_id => "7505382"})).to have_been_made
217
171
  end
218
172
  end
219
173
  context "with a user object passed" do
220
174
  before do
221
- stub_get("/1.1/users/show.json").
222
- with(:query => {:user_id => "7505382"}).
223
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
175
+ stub_get("/1.1/users/show.json").with(:query => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
224
176
  end
225
177
  it "requests the correct resource" do
226
178
  user = Twitter::User.new(:id => 7505382)
227
179
  @client.user(user)
228
- a_get("/1.1/users/show.json").
229
- with(:query => {:user_id => "7505382"}).
230
- should have_been_made
180
+ expect(a_get("/1.1/users/show.json").with(:query => {:user_id => "7505382"})).to have_been_made
231
181
  end
232
182
  end
233
183
  end
234
184
  context "without a screen name or user ID passed" do
235
185
  context "without options passed" do
236
186
  before do
237
- stub_get("/1.1/account/verify_credentials.json").
238
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
187
+ stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
239
188
  end
240
189
  it "requests the correct resource" do
241
190
  @client.user
242
- a_get("/1.1/account/verify_credentials.json").
243
- should have_been_made
191
+ expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made
244
192
  end
245
193
  end
246
194
  context "with options passed" do
247
195
  before do
248
- stub_get("/1.1/account/verify_credentials.json").
249
- with(:query => {:skip_status => "true"}).
250
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
196
+ stub_get("/1.1/account/verify_credentials.json").with(:query => {:skip_status => "true"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
251
197
  end
252
198
  it "requests the correct resource" do
253
199
  @client.user(:skip_status => true)
254
- a_get("/1.1/account/verify_credentials.json").
255
- with(:query => {:skip_status => "true"}).
256
- should have_been_made
200
+ expect(a_get("/1.1/account/verify_credentials.json").with(:query => {:skip_status => "true"})).to have_been_made
257
201
  end
258
202
  end
259
203
  end
260
204
 
261
205
  describe "#user?" do
262
206
  before do
263
- stub_get("/1.1/users/show.json").
264
- with(:query => {:screen_name => "sferik"}).
265
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
266
- stub_get("/1.1/users/show.json").
267
- with(:query => {:screen_name => "pengwynn"}).
268
- to_return(:body => fixture("not_found.json"), :status => 404, :headers => {:content_type => "application/json; charset=utf-8"})
207
+ stub_get("/1.1/users/show.json").with(:query => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
208
+ stub_get("/1.1/users/show.json").with(:query => {:screen_name => "pengwynn"}).to_return(:body => fixture("not_found.json"), :status => 404, :headers => {:content_type => "application/json; charset=utf-8"})
269
209
  end
270
210
  it "requests the correct resource" do
271
211
  @client.user?("sferik")
272
- a_get("/1.1/users/show.json").
273
- with(:query => {:screen_name => "sferik"}).
274
- should have_been_made
212
+ expect(a_get("/1.1/users/show.json").with(:query => {:screen_name => "sferik"})).to have_been_made
275
213
  end
276
214
  it "returns true if user exists" do
277
215
  user = @client.user?("sferik")
278
- user.should be_true
216
+ expect(user).to be_true
279
217
  end
280
218
  it "returns false if user does not exist" do
281
219
  user = @client.user?("pengwynn")
282
- user.should be_false
220
+ expect(user).to be_false
283
221
  end
284
222
  end
285
223
 
286
224
  describe "#contributees" do
287
225
  context "with a screen name passed" do
288
226
  before do
289
- stub_get("/1.1/users/contributees.json").
290
- with(:query => {:screen_name => "sferik"}).
291
- to_return(:body => fixture("contributees.json"), :headers => {:content_type => "application/json; charset=utf-8"})
227
+ stub_get("/1.1/users/contributees.json").with(:query => {:screen_name => "sferik"}).to_return(:body => fixture("contributees.json"), :headers => {:content_type => "application/json; charset=utf-8"})
292
228
  end
293
229
  it "requests the correct resource" do
294
230
  @client.contributees("sferik")
295
- a_get("/1.1/users/contributees.json").
296
- with(:query => {:screen_name => "sferik"}).
297
- should have_been_made
231
+ expect(a_get("/1.1/users/contributees.json").with(:query => {:screen_name => "sferik"})).to have_been_made
298
232
  end
299
233
  it "returns a user's contributees" do
300
234
  contributees = @client.contributees("sferik")
301
- contributees.should be_an Array
302
- contributees.first.should be_a Twitter::User
303
- contributees.first.name.should eq "Twitter API"
235
+ expect(contributees).to be_an Array
236
+ expect(contributees.first).to be_a Twitter::User
237
+ expect(contributees.first.name).to eq "Twitter API"
304
238
  end
305
239
  end
306
240
  context "without arguments passed" do
307
241
  before do
308
- stub_get("/1.1/account/verify_credentials.json").
309
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
310
- stub_get("/1.1/users/contributees.json").
311
- with(:query => {:screen_name => "sferik"}).
312
- to_return(:body => fixture("contributees.json"), :headers => {:content_type => "application/json; charset=utf-8"})
242
+ stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
243
+ stub_get("/1.1/users/contributees.json").with(:query => {:screen_name => "sferik"}).to_return(:body => fixture("contributees.json"), :headers => {:content_type => "application/json; charset=utf-8"})
313
244
  end
314
245
  it "requests the correct resource" do
315
246
  @client.contributees
316
- a_get("/1.1/users/contributees.json").
317
- with(:query => {:screen_name => "sferik"}).
318
- should have_been_made
247
+ expect(a_get("/1.1/users/contributees.json").with(:query => {:screen_name => "sferik"})).to have_been_made
319
248
  end
320
249
  it "returns a user's contributees" do
321
250
  contributees = @client.contributees
322
- contributees.should be_an Array
323
- contributees.first.should be_a Twitter::User
324
- contributees.first.name.should eq "Twitter API"
251
+ expect(contributees).to be_an Array
252
+ expect(contributees.first).to be_a Twitter::User
253
+ expect(contributees.first.name).to eq "Twitter API"
325
254
  end
326
255
  end
327
256
  end
@@ -329,44 +258,34 @@ describe Twitter::API do
329
258
  describe "#contributors" do
330
259
  context "with a screen name passed" do
331
260
  before do
332
- stub_get("/1.1/account/verify_credentials.json").
333
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
334
- stub_get("/1.1/users/contributors.json").
335
- with(:query => {:screen_name => "sferik"}).
336
- to_return(:body => fixture("contributors.json"), :headers => {:content_type => "application/json; charset=utf-8"})
261
+ stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
262
+ stub_get("/1.1/users/contributors.json").with(:query => {:screen_name => "sferik"}).to_return(:body => fixture("contributors.json"), :headers => {:content_type => "application/json; charset=utf-8"})
337
263
  end
338
264
  it "requests the correct resource" do
339
265
  @client.contributors("sferik")
340
- a_get("/1.1/users/contributors.json").
341
- with(:query => {:screen_name => "sferik"}).
342
- should have_been_made
266
+ expect(a_get("/1.1/users/contributors.json").with(:query => {:screen_name => "sferik"})).to have_been_made
343
267
  end
344
268
  it "returns a user's contributors" do
345
269
  contributors = @client.contributors("sferik")
346
- contributors.should be_an Array
347
- contributors.first.should be_a Twitter::User
348
- contributors.first.name.should eq "Biz Stone"
270
+ expect(contributors).to be_an Array
271
+ expect(contributors.first).to be_a Twitter::User
272
+ expect(contributors.first.name).to eq "Biz Stone"
349
273
  end
350
274
  end
351
275
  context "without arguments passed" do
352
276
  before do
353
- stub_get("/1.1/account/verify_credentials.json").
354
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
355
- stub_get("/1.1/users/contributors.json").
356
- with(:query => {:screen_name => "sferik"}).
357
- to_return(:body => fixture("contributors.json"), :headers => {:content_type => "application/json; charset=utf-8"})
277
+ stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
278
+ stub_get("/1.1/users/contributors.json").with(:query => {:screen_name => "sferik"}).to_return(:body => fixture("contributors.json"), :headers => {:content_type => "application/json; charset=utf-8"})
358
279
  end
359
280
  it "requests the correct resource" do
360
281
  @client.contributors
361
- a_get("/1.1/users/contributors.json").
362
- with(:query => {:screen_name => "sferik"}).
363
- should have_been_made
282
+ expect(a_get("/1.1/users/contributors.json").with(:query => {:screen_name => "sferik"})).to have_been_made
364
283
  end
365
284
  it "returns a user's contributors" do
366
285
  contributors = @client.contributors
367
- contributors.should be_an Array
368
- contributors.first.should be_a Twitter::User
369
- contributors.first.name.should eq "Biz Stone"
286
+ expect(contributors).to be_an Array
287
+ expect(contributors.first).to be_a Twitter::User
288
+ expect(contributors.first.name).to eq "Biz Stone"
370
289
  end
371
290
  end
372
291
  end
@@ -374,44 +293,34 @@ describe Twitter::API do
374
293
  describe "#following_followers_of" do
375
294
  context "with a screen_name passed" do
376
295
  before do
377
- stub_get("/users/following_followers_of.json").
378
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
379
- to_return(:body => fixture("users_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
296
+ stub_get("/users/following_followers_of.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("users_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
380
297
  end
381
298
  it "requests the correct resource" do
382
299
  @client.following_followers_of("sferik")
383
- a_get("/users/following_followers_of.json").
384
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
385
- should have_been_made
300
+ expect(a_get("/users/following_followers_of.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
386
301
  end
387
302
  it "returns an array of numeric IDs for every user following the specified user" do
388
303
  following_followers_of = @client.following_followers_of("sferik")
389
- following_followers_of.should be_a Twitter::Cursor
390
- following_followers_of.users.should be_an Array
391
- following_followers_of.users.first.should be_a Twitter::User
304
+ expect(following_followers_of).to be_a Twitter::Cursor
305
+ expect(following_followers_of.users).to be_an Array
306
+ expect(following_followers_of.users.first).to be_a Twitter::User
392
307
  end
393
308
  end
394
309
  context "without arguments passed" do
395
310
  before do
396
- stub_get("/1.1/account/verify_credentials.json").
397
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
398
- stub_get("/users/following_followers_of.json").
399
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
400
- to_return(:body => fixture("users_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
311
+ stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
312
+ stub_get("/users/following_followers_of.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("users_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
401
313
  end
402
314
  it "requests the correct resource" do
403
315
  @client.following_followers_of
404
- a_get("/1.1/account/verify_credentials.json").
405
- should have_been_made
406
- a_get("/users/following_followers_of.json").
407
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
408
- should have_been_made
316
+ expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made
317
+ expect(a_get("/users/following_followers_of.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
409
318
  end
410
319
  it "returns an array of numeric IDs for every user following the specified user" do
411
320
  following_followers_of = @client.following_followers_of
412
- following_followers_of.should be_a Twitter::Cursor
413
- following_followers_of.users.should be_an Array
414
- following_followers_of.users.first.should be_a Twitter::User
321
+ expect(following_followers_of).to be_a Twitter::Cursor
322
+ expect(following_followers_of.users).to be_an Array
323
+ expect(following_followers_of.users.first).to be_a Twitter::User
415
324
  end
416
325
  end
417
326
  end