twitter 5.0.0.rc.1 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +7 -1
- data/CONTRIBUTING.md +13 -15
- data/README.md +53 -33
- data/Rakefile +6 -0
- data/lib/twitter/arguments.rb +3 -0
- data/lib/twitter/base.rb +88 -89
- data/lib/twitter/client.rb +5 -41
- data/lib/twitter/configuration.rb +4 -5
- data/lib/twitter/core_ext/kernel.rb +5 -1
- data/lib/twitter/creatable.rb +6 -1
- data/lib/twitter/cursor.rb +16 -12
- data/lib/twitter/entity/uri.rb +2 -1
- data/lib/twitter/enumerable.rb +1 -1
- data/lib/twitter/error.rb +42 -39
- data/lib/twitter/factory.rb +12 -5
- data/lib/twitter/geo.rb +2 -7
- data/lib/twitter/geo_factory.rb +11 -7
- data/lib/twitter/geo_results.rb +12 -8
- data/lib/twitter/identity.rb +4 -12
- data/lib/twitter/list.rb +6 -3
- data/lib/twitter/media/photo.rb +5 -3
- data/lib/twitter/media_factory.rb +11 -7
- data/lib/twitter/null_object.rb +4 -3
- data/lib/twitter/place.rb +10 -16
- data/lib/twitter/profile_banner.rb +4 -5
- data/lib/twitter/rate_limit.rb +3 -0
- data/lib/twitter/relationship.rb +0 -9
- data/lib/twitter/rest/api/direct_messages.rb +9 -6
- data/lib/twitter/rest/api/favorites.rb +6 -11
- data/lib/twitter/rest/api/friends_and_followers.rb +6 -9
- data/lib/twitter/rest/api/lists.rb +27 -20
- data/lib/twitter/rest/api/oauth.rb +17 -0
- data/lib/twitter/rest/api/places_and_geo.rb +0 -18
- data/lib/twitter/rest/api/saved_searches.rb +6 -4
- data/lib/twitter/rest/api/suggested_users.rb +2 -2
- data/lib/twitter/rest/api/tweets.rb +7 -9
- data/lib/twitter/rest/api/users.rb +6 -6
- data/lib/twitter/rest/api/utils.rb +44 -17
- data/lib/twitter/rest/client.rb +25 -43
- data/lib/twitter/rest/response/parse_error_json.rb +15 -0
- data/lib/twitter/rest/response/parse_json.rb +5 -1
- data/lib/twitter/search_results.rb +12 -8
- data/lib/twitter/size.rb +2 -15
- data/lib/twitter/streaming/client.rb +23 -11
- data/lib/twitter/streaming/event.rb +35 -0
- data/lib/twitter/streaming/friend_list.rb +13 -0
- data/lib/twitter/streaming/message_parser.rb +18 -0
- data/lib/twitter/streaming/response.rb +4 -0
- data/lib/twitter/suggestion.rb +5 -10
- data/lib/twitter/token.rb +3 -1
- data/lib/twitter/trend.rb +2 -7
- data/lib/twitter/trend_results.rb +20 -14
- data/lib/twitter/tweet.rb +18 -23
- data/lib/twitter/user.rb +34 -19
- data/lib/twitter/version.rb +1 -1
- data/spec/fixtures/request_token.txt +6 -0
- data/spec/fixtures/track_streaming_user.json +5 -0
- data/spec/twitter/base_spec.rb +0 -16
- data/spec/twitter/basic_user_spec.rb +3 -3
- data/spec/twitter/cursor_spec.rb +4 -4
- data/spec/twitter/direct_message_spec.rb +9 -9
- data/spec/twitter/entity/uri_spec.rb +12 -11
- data/spec/twitter/geo/point_spec.rb +5 -5
- data/spec/twitter/geo/polygon_spec.rb +5 -5
- data/spec/twitter/geo_factory_spec.rb +2 -2
- data/spec/twitter/geo_spec.rb +6 -6
- data/spec/twitter/identifiable_spec.rb +5 -5
- data/spec/twitter/list_spec.rb +7 -7
- data/spec/twitter/media/photo_spec.rb +19 -18
- data/spec/twitter/media_factory_spec.rb +2 -2
- data/spec/twitter/null_object_spec.rb +7 -6
- data/spec/twitter/oembed_spec.rb +6 -6
- data/spec/twitter/place_spec.rb +37 -37
- data/spec/twitter/rate_limit_spec.rb +0 -17
- data/spec/twitter/relationship_spec.rb +4 -12
- data/spec/twitter/rest/api/direct_messages_spec.rb +8 -8
- data/spec/twitter/rest/api/friends_and_followers_spec.rb +50 -120
- data/spec/twitter/rest/api/geo_spec.rb +0 -14
- data/spec/twitter/rest/api/lists_spec.rb +39 -39
- data/spec/twitter/rest/api/oauth_spec.rb +15 -4
- data/spec/twitter/rest/api/saved_searches_spec.rb +6 -6
- data/spec/twitter/rest/api/tweets_spec.rb +6 -6
- data/spec/twitter/rest/api/users_spec.rb +4 -4
- data/spec/twitter/rest/client_spec.rb +9 -9
- data/spec/twitter/saved_search_spec.rb +5 -5
- data/spec/twitter/search_results_spec.rb +3 -3
- data/spec/twitter/settings_spec.rb +2 -2
- data/spec/twitter/size_spec.rb +5 -15
- data/spec/twitter/source_user_spec.rb +3 -3
- data/spec/twitter/streaming/client_spec.rb +33 -16
- data/spec/twitter/streaming/event_spec.rb +45 -0
- data/spec/twitter/suggestion_spec.rb +5 -15
- data/spec/twitter/target_user_spec.rb +3 -3
- data/spec/twitter/token_spec.rb +2 -2
- data/spec/twitter/trend_results_spec.rb +6 -6
- data/spec/twitter/trend_spec.rb +7 -17
- data/spec/twitter/tweet_spec.rb +31 -25
- data/spec/twitter/user_spec.rb +16 -16
- data/twitter.gemspec +5 -2
- metadata +67 -15
- metadata.gz.sig +0 -0
@@ -3,35 +3,25 @@ require 'helper'
|
|
3
3
|
describe Twitter::Suggestion do
|
4
4
|
|
5
5
|
describe "#==" do
|
6
|
-
it "returns
|
6
|
+
it "returns true for empty objects" do
|
7
7
|
suggestion = Twitter::Suggestion.new
|
8
8
|
other = Twitter::Suggestion.new
|
9
|
-
expect(suggestion == other).to
|
9
|
+
expect(suggestion == other).to be true
|
10
10
|
end
|
11
11
|
it "returns true when objects slugs are the same" do
|
12
12
|
suggestion = Twitter::Suggestion.new(:slug => 1, :name => "foo")
|
13
13
|
other = Twitter::Suggestion.new(:slug => 1, :name => "bar")
|
14
|
-
expect(suggestion == other).to
|
14
|
+
expect(suggestion == other).to be true
|
15
15
|
end
|
16
16
|
it "returns false when objects slugs are different" do
|
17
17
|
suggestion = Twitter::Suggestion.new(:slug => 1)
|
18
18
|
other = Twitter::Suggestion.new(:slug => 2)
|
19
|
-
expect(suggestion == other).to
|
19
|
+
expect(suggestion == other).to be false
|
20
20
|
end
|
21
21
|
it "returns false when classes are different" do
|
22
22
|
suggestion = Twitter::Suggestion.new(:slug => 1)
|
23
23
|
other = Twitter::Base.new(:slug => 1)
|
24
|
-
expect(suggestion == other).to
|
25
|
-
end
|
26
|
-
it "returns true when objects non-slug attributes are the same" do
|
27
|
-
suggestion = Twitter::Suggestion.new(:name => "foo")
|
28
|
-
other = Twitter::Suggestion.new(:name => "foo")
|
29
|
-
expect(suggestion == other).to be_true
|
30
|
-
end
|
31
|
-
it "returns false when objects non-slug attributes are different" do
|
32
|
-
suggestion = Twitter::Suggestion.new(:name => "foo")
|
33
|
-
other = Twitter::Suggestion.new(:name => "bar")
|
34
|
-
expect(suggestion == other).to be_false
|
24
|
+
expect(suggestion == other).to be false
|
35
25
|
end
|
36
26
|
end
|
37
27
|
|
@@ -6,17 +6,17 @@ describe Twitter::TargetUser do
|
|
6
6
|
it "returns true when objects IDs are the same" do
|
7
7
|
saved_search = Twitter::TargetUser.new(:id => 1, :name => "foo")
|
8
8
|
other = Twitter::TargetUser.new(:id => 1, :name => "bar")
|
9
|
-
expect(saved_search == other).to
|
9
|
+
expect(saved_search == other).to be true
|
10
10
|
end
|
11
11
|
it "returns false when objects IDs are different" do
|
12
12
|
saved_search = Twitter::TargetUser.new(:id => 1)
|
13
13
|
other = Twitter::TargetUser.new(:id => 2)
|
14
|
-
expect(saved_search == other).to
|
14
|
+
expect(saved_search == other).to be false
|
15
15
|
end
|
16
16
|
it "returns false when classes are different" do
|
17
17
|
saved_search = Twitter::TargetUser.new(:id => 1)
|
18
18
|
other = Twitter::Identity.new(:id => 1)
|
19
|
-
expect(saved_search == other).to
|
19
|
+
expect(saved_search == other).to be false
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
data/spec/twitter/token_spec.rb
CHANGED
@@ -5,11 +5,11 @@ describe Twitter::Token do
|
|
5
5
|
describe "#bearer?" do
|
6
6
|
it "returns true when token is a bearer token" do
|
7
7
|
token = Twitter::Token.new(:token_type => "bearer")
|
8
|
-
expect(token.bearer?).to
|
8
|
+
expect(token.bearer?).to be true
|
9
9
|
end
|
10
10
|
it "returns false when token type is nil" do
|
11
11
|
token = Twitter::Token.new
|
12
|
-
expect(token.bearer?).to
|
12
|
+
expect(token.bearer?).to be false
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -16,11 +16,11 @@ describe Twitter::TrendResults do
|
|
16
16
|
describe "#as_of?" do
|
17
17
|
it "returns true when as_of is set" do
|
18
18
|
trend_results = Twitter::TrendResults.new(:id => 1, :as_of => "2012-08-24T23:24:14Z")
|
19
|
-
expect(trend_results.as_of?).to
|
19
|
+
expect(trend_results.as_of?).to be true
|
20
20
|
end
|
21
21
|
it "returns false when as_of is not set" do
|
22
22
|
trend_results = Twitter::TrendResults.new(:id => 1)
|
23
|
-
expect(trend_results.as_of?).to
|
23
|
+
expect(trend_results.as_of?).to be false
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -38,11 +38,11 @@ describe Twitter::TrendResults do
|
|
38
38
|
describe "#created?" do
|
39
39
|
it "returns true when created_at is set" do
|
40
40
|
trend_results = Twitter::TrendResults.new(:id => 1, :created_at => "2012-08-24T23:24:14Z")
|
41
|
-
expect(trend_results.created?).to
|
41
|
+
expect(trend_results.created?).to be true
|
42
42
|
end
|
43
43
|
it "returns false when created_at is not set" do
|
44
44
|
trend_results = Twitter::TrendResults.new(:id => 1)
|
45
|
-
expect(trend_results.created?).to
|
45
|
+
expect(trend_results.created?).to be false
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -78,11 +78,11 @@ describe Twitter::TrendResults do
|
|
78
78
|
describe "#location?" do
|
79
79
|
it "returns true when location is set" do
|
80
80
|
trend_results = Twitter::TrendResults.new(:id => 1, :locations => [{:name => "Worldwide", :woeid => 1}])
|
81
|
-
expect(trend_results.location?).to
|
81
|
+
expect(trend_results.location?).to be true
|
82
82
|
end
|
83
83
|
it "returns false when location is not set" do
|
84
84
|
trend_results = Twitter::TrendResults.new(:id => 1)
|
85
|
-
expect(trend_results.location?).to
|
85
|
+
expect(trend_results.location?).to be false
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
data/spec/twitter/trend_spec.rb
CHANGED
@@ -3,35 +3,25 @@ require 'helper'
|
|
3
3
|
describe Twitter::Trend do
|
4
4
|
|
5
5
|
describe "#==" do
|
6
|
-
it "returns
|
6
|
+
it "returns true for empty objects" do
|
7
7
|
trend = Twitter::Trend.new
|
8
8
|
other = Twitter::Trend.new
|
9
|
-
expect(trend == other).to
|
9
|
+
expect(trend == other).to be true
|
10
10
|
end
|
11
11
|
it "returns true when objects names are the same" do
|
12
12
|
trend = Twitter::Trend.new(:name => "#sevenwordsaftersex", :query => "foo")
|
13
13
|
other = Twitter::Trend.new(:name => "#sevenwordsaftersex", :query => "bar")
|
14
|
-
expect(trend == other).to
|
14
|
+
expect(trend == other).to be true
|
15
15
|
end
|
16
16
|
it "returns false when objects names are different" do
|
17
17
|
trend = Twitter::Trend.new(:name => "#sevenwordsaftersex")
|
18
18
|
other = Twitter::Trend.new(:name => "#sixwordsaftersex")
|
19
|
-
expect(trend == other).to
|
19
|
+
expect(trend == other).to be false
|
20
20
|
end
|
21
21
|
it "returns false when classes are different" do
|
22
22
|
trend = Twitter::Trend.new(:name => "#sevenwordsaftersex")
|
23
23
|
other = Twitter::Base.new(:name => "#sevenwordsaftersex")
|
24
|
-
expect(trend == other).to
|
25
|
-
end
|
26
|
-
it "returns true when objects non-name attributes are the same" do
|
27
|
-
trend = Twitter::Trend.new(:query => "foo")
|
28
|
-
other = Twitter::Trend.new(:query => "foo")
|
29
|
-
expect(trend == other).to be_true
|
30
|
-
end
|
31
|
-
it "returns false when objects non-name attributes are different" do
|
32
|
-
trend = Twitter::Trend.new(:query => "foo")
|
33
|
-
other = Twitter::Trend.new(:query => "bar")
|
34
|
-
expect(trend == other).to be_false
|
24
|
+
expect(trend == other).to be false
|
35
25
|
end
|
36
26
|
end
|
37
27
|
|
@@ -50,11 +40,11 @@ describe Twitter::Trend do
|
|
50
40
|
describe "#uri?" do
|
51
41
|
it "returns true when the url is set" do
|
52
42
|
trend = Twitter::Trend.new(:url => "https://api.twitter.com/1.1/geo/id/247f43d441defc03.json")
|
53
|
-
expect(trend.uri?).to
|
43
|
+
expect(trend.uri?).to be true
|
54
44
|
end
|
55
45
|
it "returns false when the url is not set" do
|
56
46
|
trend = Twitter::Trend.new
|
57
|
-
expect(trend.uri?).to
|
47
|
+
expect(trend.uri?).to be false
|
58
48
|
end
|
59
49
|
end
|
60
50
|
|
data/spec/twitter/tweet_spec.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
require 'helper'
|
2
3
|
|
3
4
|
describe Twitter::Tweet do
|
@@ -15,17 +16,17 @@ describe Twitter::Tweet do
|
|
15
16
|
it "returns true when objects IDs are the same" do
|
16
17
|
tweet = Twitter::Tweet.new(:id => 1, :text => "foo")
|
17
18
|
other = Twitter::Tweet.new(:id => 1, :text => "bar")
|
18
|
-
expect(tweet == other).to
|
19
|
+
expect(tweet == other).to be true
|
19
20
|
end
|
20
21
|
it "returns false when objects IDs are different" do
|
21
22
|
tweet = Twitter::Tweet.new(:id => 1)
|
22
23
|
other = Twitter::Tweet.new(:id => 2)
|
23
|
-
expect(tweet == other).to
|
24
|
+
expect(tweet == other).to be false
|
24
25
|
end
|
25
26
|
it "returns false when classes are different" do
|
26
27
|
tweet = Twitter::Tweet.new(:id => 1)
|
27
28
|
other = Twitter::Identity.new(:id => 1)
|
28
|
-
expect(tweet == other).to
|
29
|
+
expect(tweet == other).to be false
|
29
30
|
end
|
30
31
|
end
|
31
32
|
|
@@ -43,18 +44,23 @@ describe Twitter::Tweet do
|
|
43
44
|
describe "#created?" do
|
44
45
|
it "returns true when created_at is set" do
|
45
46
|
tweet = Twitter::Tweet.new(:id => 28669546014, :created_at => "Mon Jul 16 12:59:01 +0000 2007")
|
46
|
-
expect(tweet.created?).to
|
47
|
+
expect(tweet.created?).to be true
|
47
48
|
end
|
48
49
|
it "returns false when created_at is not set" do
|
49
50
|
tweet = Twitter::Tweet.new(:id => 28669546014)
|
50
|
-
expect(tweet.created?).to
|
51
|
+
expect(tweet.created?).to be false
|
51
52
|
end
|
52
53
|
end
|
53
54
|
|
54
55
|
describe "#entities?" do
|
55
56
|
it "returns false if there are no entities set" do
|
56
57
|
tweet = Twitter::Tweet.new(:id => 28669546014)
|
57
|
-
expect(tweet.entities?).to
|
58
|
+
expect(tweet.entities?).to be false
|
59
|
+
end
|
60
|
+
|
61
|
+
it "returns false if there are blank lists of entities set" do
|
62
|
+
tweet = Twitter::Tweet.new(:id => 28669546014, :entities => {:urls => []})
|
63
|
+
expect(tweet.entities?).to be false
|
58
64
|
end
|
59
65
|
|
60
66
|
it "returns true if there are entities set" do
|
@@ -62,12 +68,12 @@ describe Twitter::Tweet do
|
|
62
68
|
{
|
63
69
|
:url => "http://example.com/t.co",
|
64
70
|
:expanded_url => "http://example.com/expanded",
|
65
|
-
:display_url => "example.com/expanded",
|
71
|
+
:display_url => "example.com/expanded…",
|
66
72
|
:indices => [10, 33],
|
67
73
|
}
|
68
74
|
]
|
69
75
|
tweet = Twitter::Tweet.new(:id => 28669546014, :entities => {:urls => urls_array})
|
70
|
-
expect(tweet.entities?).to
|
76
|
+
expect(tweet.entities?).to be true
|
71
77
|
end
|
72
78
|
end
|
73
79
|
|
@@ -119,11 +125,11 @@ describe Twitter::Tweet do
|
|
119
125
|
describe "#geo?" do
|
120
126
|
it "returns true when geo is set" do
|
121
127
|
tweet = Twitter::Tweet.new(:id => 28669546014, :geo => {:id => 1, :type => "Point"})
|
122
|
-
expect(tweet.geo?).to
|
128
|
+
expect(tweet.geo?).to be true
|
123
129
|
end
|
124
130
|
it "returns false when geo is not set" do
|
125
131
|
tweet = Twitter::Tweet.new(:id => 28669546014)
|
126
|
-
expect(tweet.geo?).to
|
132
|
+
expect(tweet.geo?).to be false
|
127
133
|
end
|
128
134
|
end
|
129
135
|
|
@@ -181,11 +187,11 @@ describe Twitter::Tweet do
|
|
181
187
|
describe "#metadata?" do
|
182
188
|
it "returns true when metadata is set" do
|
183
189
|
tweet = Twitter::Tweet.new(:id => 28669546014, :metadata => {})
|
184
|
-
expect(tweet.metadata?).to
|
190
|
+
expect(tweet.metadata?).to be true
|
185
191
|
end
|
186
192
|
it "returns false when metadata is not set" do
|
187
193
|
tweet = Twitter::Tweet.new(:id => 28669546014)
|
188
|
-
expect(tweet.metadata?).to
|
194
|
+
expect(tweet.metadata?).to be false
|
189
195
|
end
|
190
196
|
end
|
191
197
|
|
@@ -203,33 +209,33 @@ describe Twitter::Tweet do
|
|
203
209
|
describe "#place?" do
|
204
210
|
it "returns true when place is set" do
|
205
211
|
tweet = Twitter::Tweet.new(:id => 28669546014, :place => {:id => "247f43d441defc03"})
|
206
|
-
expect(tweet.place?).to
|
212
|
+
expect(tweet.place?).to be true
|
207
213
|
end
|
208
214
|
it "returns false when place is not set" do
|
209
215
|
tweet = Twitter::Tweet.new(:id => 28669546014)
|
210
|
-
expect(tweet.place?).to
|
216
|
+
expect(tweet.place?).to be false
|
211
217
|
end
|
212
218
|
end
|
213
219
|
|
214
220
|
describe "#reply?" do
|
215
221
|
it "returns true when there is an in-reply-to status" do
|
216
222
|
tweet = Twitter::Tweet.new(:id => 28669546014, :in_reply_to_status_id => 114749583439036416)
|
217
|
-
expect(tweet.reply?).to
|
223
|
+
expect(tweet.reply?).to be true
|
218
224
|
end
|
219
225
|
it "returns false when in_reply_to_status_id is not set" do
|
220
226
|
tweet = Twitter::Tweet.new(:id => 28669546014)
|
221
|
-
expect(tweet.reply?).to
|
227
|
+
expect(tweet.reply?).to be false
|
222
228
|
end
|
223
229
|
end
|
224
230
|
|
225
231
|
describe "#retweet?" do
|
226
232
|
it "returns true when there is a retweeted status" do
|
227
233
|
tweet = Twitter::Tweet.new(:id => 28669546014, :retweeted_status => {:id => 25938088801, :text => "BOOSH"})
|
228
|
-
expect(tweet.retweet?).to
|
234
|
+
expect(tweet.retweet?).to be true
|
229
235
|
end
|
230
236
|
it "returns false when retweeted_status is not set" do
|
231
237
|
tweet = Twitter::Tweet.new(:id => 28669546014)
|
232
|
-
expect(tweet.retweet?).to
|
238
|
+
expect(tweet.retweet?).to be false
|
233
239
|
end
|
234
240
|
end
|
235
241
|
|
@@ -248,11 +254,11 @@ describe Twitter::Tweet do
|
|
248
254
|
describe "#retweeted_status?" do
|
249
255
|
it "returns true when retweeted_status is set" do
|
250
256
|
tweet = Twitter::Tweet.new(:id => 28669546014, :retweeted_status => {:id => 25938088801, :text => "BOOSH"})
|
251
|
-
expect(tweet.retweeted_status?).to
|
257
|
+
expect(tweet.retweeted_status?).to be true
|
252
258
|
end
|
253
259
|
it "returns false when retweeted_status is not set" do
|
254
260
|
tweet = Twitter::Tweet.new(:id => 28669546014)
|
255
|
-
expect(tweet.retweeted_status?).to
|
261
|
+
expect(tweet.retweeted_status?).to be false
|
256
262
|
end
|
257
263
|
end
|
258
264
|
|
@@ -285,7 +291,7 @@ describe Twitter::Tweet do
|
|
285
291
|
{
|
286
292
|
:url => "http://example.com/t.co",
|
287
293
|
:expanded_url => "http://example.com/expanded",
|
288
|
-
:display_url => "example.com/expanded",
|
294
|
+
:display_url => "example.com/expanded…",
|
289
295
|
:indices => [10, 33],
|
290
296
|
}
|
291
297
|
]
|
@@ -293,8 +299,8 @@ describe Twitter::Tweet do
|
|
293
299
|
expect(tweet.uris).to be_an Array
|
294
300
|
expect(tweet.uris.first).to be_a Twitter::Entity::URI
|
295
301
|
expect(tweet.uris.first.indices).to eq([10, 33])
|
296
|
-
expect(tweet.uris.first.display_uri).to be_a
|
297
|
-
expect(tweet.uris.first.display_uri
|
302
|
+
expect(tweet.uris.first.display_uri).to be_a String
|
303
|
+
expect(tweet.uris.first.display_uri).to eq("example.com/expanded…")
|
298
304
|
end
|
299
305
|
it "is empty when not set" do
|
300
306
|
tweet = Twitter::Tweet.new(:id => 28669546014)
|
@@ -333,11 +339,11 @@ describe Twitter::Tweet do
|
|
333
339
|
describe "#user?" do
|
334
340
|
it "returns true when status is set" do
|
335
341
|
tweet = Twitter::Tweet.new(:id => 28669546014, :user => {:id => 7505382})
|
336
|
-
expect(tweet.user?).to
|
342
|
+
expect(tweet.user?).to be true
|
337
343
|
end
|
338
344
|
it "returns false when status is not set" do
|
339
345
|
tweet = Twitter::Tweet.new(:id => 28669546014)
|
340
|
-
expect(tweet.user?).to
|
346
|
+
expect(tweet.user?).to be false
|
341
347
|
end
|
342
348
|
end
|
343
349
|
|
data/spec/twitter/user_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# coding: utf-8
|
2
2
|
require 'helper'
|
3
3
|
|
4
4
|
describe Twitter::User do
|
@@ -7,17 +7,17 @@ describe Twitter::User do
|
|
7
7
|
it "returns true when objects IDs are the same" do
|
8
8
|
user = Twitter::User.new(:id => 1, :screen_name => "foo")
|
9
9
|
other = Twitter::User.new(:id => 1, :screen_name => "bar")
|
10
|
-
expect(user == other).to
|
10
|
+
expect(user == other).to be true
|
11
11
|
end
|
12
12
|
it "returns false when objects IDs are different" do
|
13
13
|
user = Twitter::User.new(:id => 1)
|
14
14
|
other = Twitter::User.new(:id => 2)
|
15
|
-
expect(user == other).to
|
15
|
+
expect(user == other).to be false
|
16
16
|
end
|
17
17
|
it "returns false when classes are different" do
|
18
18
|
user = Twitter::User.new(:id => 1)
|
19
19
|
other = Twitter::Identity.new(:id => 1)
|
20
|
-
expect(user == other).to
|
20
|
+
expect(user == other).to be false
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -35,11 +35,11 @@ describe Twitter::User do
|
|
35
35
|
describe "#created?" do
|
36
36
|
it "returns true when created_at is set" do
|
37
37
|
user = Twitter::User.new(:id => 7505382, :created_at => "Mon Jul 16 12:59:01 +0000 2007")
|
38
|
-
expect(user.created?).to
|
38
|
+
expect(user.created?).to be true
|
39
39
|
end
|
40
40
|
it "returns false when created_at is not set" do
|
41
41
|
user = Twitter::User.new(:id => 7505382)
|
42
|
-
expect(user.created?).to
|
42
|
+
expect(user.created?).to be false
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -49,7 +49,7 @@ describe Twitter::User do
|
|
49
49
|
{
|
50
50
|
:url => "http://example.com/t.co",
|
51
51
|
:expanded_url => "http://example.com/expanded",
|
52
|
-
:display_url => "example.com/expanded",
|
52
|
+
:display_url => "example.com/expanded…",
|
53
53
|
:indices => [10, 33],
|
54
54
|
}
|
55
55
|
]
|
@@ -57,7 +57,7 @@ describe Twitter::User do
|
|
57
57
|
expect(user.description_uris).to be_an Array
|
58
58
|
expect(user.description_uris.first).to be_a Twitter::Entity::URI
|
59
59
|
expect(user.description_uris.first.indices).to eq([10, 33])
|
60
|
-
expect(user.description_uris.first.display_uri
|
60
|
+
expect(user.description_uris.first.display_uri).to eq("example.com/expanded…")
|
61
61
|
end
|
62
62
|
it "is empty when not set" do
|
63
63
|
user = Twitter::User.new(:id => 7505382, :entities => {:description => {:urls => []}})
|
@@ -166,11 +166,11 @@ describe Twitter::User do
|
|
166
166
|
describe "#profile_banner_uri?" do
|
167
167
|
it "returns true when profile_banner_url is set" do
|
168
168
|
user = Twitter::User.new(:id => 7505382, :profile_banner_url => "https://si0.twimg.com/profile_banners/7505382/1348266581")
|
169
|
-
expect(user.profile_banner_uri?).to
|
169
|
+
expect(user.profile_banner_uri?).to be true
|
170
170
|
end
|
171
171
|
it "returns false when status is not set" do
|
172
172
|
user = Twitter::User.new(:id => 7505382)
|
173
|
-
expect(user.profile_banner_uri?).to
|
173
|
+
expect(user.profile_banner_uri?).to be false
|
174
174
|
end
|
175
175
|
end
|
176
176
|
|
@@ -267,11 +267,11 @@ describe Twitter::User do
|
|
267
267
|
describe "#profile_image_uri?" do
|
268
268
|
it "returns true when profile_banner_url is set" do
|
269
269
|
user = Twitter::User.new(:id => 7505382, :profile_image_url_https => "https://si0.twimg.com/profile_banners/7505382/1348266581")
|
270
|
-
expect(user.profile_image_uri?).to
|
270
|
+
expect(user.profile_image_uri?).to be true
|
271
271
|
end
|
272
272
|
it "returns false when status is not set" do
|
273
273
|
user = Twitter::User.new(:id => 7505382)
|
274
|
-
expect(user.profile_image_uri?).to
|
274
|
+
expect(user.profile_image_uri?).to be false
|
275
275
|
end
|
276
276
|
end
|
277
277
|
|
@@ -294,11 +294,11 @@ describe Twitter::User do
|
|
294
294
|
describe "#status?" do
|
295
295
|
it "returns true when status is set" do
|
296
296
|
user = Twitter::User.new(:id => 7505382, :status => {:id => 25938088801})
|
297
|
-
expect(user.status?).to
|
297
|
+
expect(user.status?).to be true
|
298
298
|
end
|
299
299
|
it "returns false when status is not set" do
|
300
300
|
user = Twitter::User.new(:id => 7505382)
|
301
|
-
expect(user.status?).to
|
301
|
+
expect(user.status?).to be false
|
302
302
|
end
|
303
303
|
end
|
304
304
|
|
@@ -325,11 +325,11 @@ describe Twitter::User do
|
|
325
325
|
describe "#website?" do
|
326
326
|
it "returns true when the url is set" do
|
327
327
|
user = Twitter::User.new(:id => 7505382, :url => "https://github.com/sferik")
|
328
|
-
expect(user.website?).to
|
328
|
+
expect(user.website?).to be true
|
329
329
|
end
|
330
330
|
it "returns false when the url is not set" do
|
331
331
|
user = Twitter::User.new(:id => 7505382)
|
332
|
-
expect(user.website?).to
|
332
|
+
expect(user.website?).to be false
|
333
333
|
end
|
334
334
|
end
|
335
335
|
|