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.
- data/.yardopts +4 -0
- data/CHANGELOG.md +47 -0
- data/CONTRIBUTING.md +5 -5
- data/README.md +57 -56
- data/Rakefile +26 -5
- data/lib/twitter/arguments.rb +1 -2
- data/lib/twitter/base.rb +15 -18
- data/lib/twitter/basic_user.rb +3 -3
- data/lib/twitter/client.rb +9 -10
- data/lib/twitter/configuration.rb +5 -5
- data/lib/twitter/creatable.rb +0 -1
- data/lib/twitter/cursor.rb +9 -36
- data/lib/twitter/direct_message.rb +1 -1
- data/lib/twitter/entity/uri.rb +2 -2
- data/lib/twitter/enumerable.rb +10 -1
- data/lib/twitter/error/already_favorited.rb +1 -1
- data/lib/twitter/error/already_posted.rb +1 -1
- data/lib/twitter/error/already_retweeted.rb +1 -1
- data/lib/twitter/error/too_many_requests.rb +2 -2
- data/lib/twitter/error.rb +6 -6
- data/lib/twitter/factory.rb +2 -6
- data/lib/twitter/geo/point.rb +3 -5
- data/lib/twitter/geo.rb +1 -1
- data/lib/twitter/geo_factory.rb +1 -5
- data/lib/twitter/geo_results.rb +5 -8
- data/lib/twitter/identity.rb +1 -2
- data/lib/twitter/list.rb +10 -11
- data/lib/twitter/media/photo.rb +1 -2
- data/lib/twitter/media_factory.rb +1 -5
- data/lib/twitter/null_object.rb +4 -6
- data/lib/twitter/oembed.rb +1 -1
- data/lib/twitter/place.rb +17 -6
- data/lib/twitter/profile_banner.rb +1 -3
- data/lib/twitter/rate_limit.rb +1 -3
- data/lib/twitter/relationship.rb +1 -2
- data/lib/twitter/rest/api/direct_messages.rb +15 -15
- data/lib/twitter/rest/api/favorites.rb +15 -15
- data/lib/twitter/rest/api/friends_and_followers.rb +37 -42
- data/lib/twitter/rest/api/help.rb +8 -9
- data/lib/twitter/rest/api/lists.rb +69 -69
- data/lib/twitter/rest/api/oauth.rb +3 -4
- data/lib/twitter/rest/api/places_and_geo.rb +9 -10
- data/lib/twitter/rest/api/saved_searches.rb +8 -8
- data/lib/twitter/rest/api/search.rb +10 -2
- data/lib/twitter/rest/api/spam_reporting.rb +1 -2
- data/lib/twitter/rest/api/suggested_users.rb +4 -5
- data/lib/twitter/rest/api/timelines.rb +17 -18
- data/lib/twitter/rest/api/trends.rb +10 -11
- data/lib/twitter/rest/api/tweets.rb +31 -20
- data/lib/twitter/rest/api/undocumented.rb +6 -7
- data/lib/twitter/rest/api/users.rb +53 -54
- data/lib/twitter/rest/api/utils.rb +28 -34
- data/lib/twitter/rest/client.rb +8 -9
- data/lib/twitter/rest/request/multipart_with_file.rb +7 -5
- data/lib/twitter/rest/response/parse_error_json.rb +0 -2
- data/lib/twitter/rest/response/parse_json.rb +2 -2
- data/lib/twitter/rest/response/raise_error.rb +1 -3
- data/lib/twitter/search_results.rb +38 -56
- data/lib/twitter/settings.rb +2 -2
- data/lib/twitter/size.rb +2 -2
- data/lib/twitter/source_user.rb +1 -1
- data/lib/twitter/streaming/client.rb +69 -18
- data/lib/twitter/streaming/connection.rb +1 -3
- data/lib/twitter/streaming/deleted_tweet.rb +8 -0
- data/lib/twitter/streaming/event.rb +8 -8
- data/lib/twitter/streaming/friend_list.rb +2 -9
- data/lib/twitter/streaming/message_parser.rb +13 -3
- data/lib/twitter/streaming/response.rb +0 -2
- data/lib/twitter/streaming/stall_warning.rb +7 -0
- data/lib/twitter/suggestion.rb +0 -1
- data/lib/twitter/token.rb +2 -3
- data/lib/twitter/trend_results.rb +5 -8
- data/lib/twitter/tweet.rb +17 -18
- data/lib/twitter/user.rb +33 -35
- data/lib/twitter/utils.rb +14 -0
- data/lib/twitter/version.rb +2 -5
- data/lib/twitter.rb +1 -1
- data/spec/fixtures/forbidden.json +1 -0
- data/spec/fixtures/search.json +1 -1
- data/spec/fixtures/search2.json +1 -0
- data/spec/fixtures/track_streaming_user.json +2 -1
- data/spec/helper.rb +6 -2
- data/spec/twitter/base_spec.rb +9 -9
- data/spec/twitter/basic_user_spec.rb +6 -6
- data/spec/twitter/configuration_spec.rb +4 -4
- data/spec/twitter/cursor_spec.rb +13 -51
- data/spec/twitter/direct_message_spec.rb +36 -36
- data/spec/twitter/entity/uri_spec.rb +29 -29
- data/spec/twitter/error_spec.rb +21 -21
- data/spec/twitter/geo/point_spec.rb +9 -9
- data/spec/twitter/geo/polygon_spec.rb +5 -5
- data/spec/twitter/geo_factory_spec.rb +7 -7
- data/spec/twitter/geo_results_spec.rb +11 -11
- data/spec/twitter/geo_spec.rb +5 -5
- data/spec/twitter/identifiable_spec.rb +9 -9
- data/spec/twitter/list_spec.rb +38 -38
- data/spec/twitter/media/photo_spec.rb +58 -58
- data/spec/twitter/media_factory_spec.rb +5 -5
- data/spec/twitter/null_object_spec.rb +6 -6
- data/spec/twitter/oembed_spec.rb +68 -68
- data/spec/twitter/place_spec.rb +91 -62
- data/spec/twitter/profile_banner_spec.rb +3 -3
- data/spec/twitter/rate_limit_spec.rb +18 -18
- data/spec/twitter/relationship_spec.rb +16 -16
- data/spec/twitter/rest/api/direct_messages_spec.rb +61 -61
- data/spec/twitter/rest/api/favorites_spec.rb +93 -93
- data/spec/twitter/rest/api/friends_and_followers_spec.rb +357 -349
- data/spec/twitter/rest/api/geo_spec.rb +33 -33
- data/spec/twitter/rest/api/help_spec.rb +24 -24
- data/spec/twitter/rest/api/lists_spec.rb +487 -487
- data/spec/twitter/rest/api/oauth_spec.rb +30 -30
- data/spec/twitter/rest/api/saved_searches_spec.rb +50 -40
- data/spec/twitter/rest/api/search_spec.rb +27 -26
- data/spec/twitter/rest/api/spam_reporting_spec.rb +9 -9
- data/spec/twitter/rest/api/suggested_users_spec.rb +23 -23
- data/spec/twitter/rest/api/timelines_spec.rb +58 -58
- data/spec/twitter/rest/api/trends_spec.rb +26 -26
- data/spec/twitter/rest/api/tweets_spec.rb +304 -266
- data/spec/twitter/rest/api/undocumented_spec.rb +51 -51
- data/spec/twitter/rest/api/users_spec.rb +360 -360
- data/spec/twitter/rest/client_spec.rb +99 -103
- data/spec/twitter/saved_search_spec.rb +16 -16
- data/spec/twitter/search_results_spec.rb +14 -110
- data/spec/twitter/settings_spec.rb +8 -8
- data/spec/twitter/size_spec.rb +5 -5
- data/spec/twitter/source_user_spec.rb +6 -6
- data/spec/twitter/streaming/client_spec.rb +85 -54
- data/spec/twitter/streaming/deleted_tweet_spec.rb +23 -0
- data/spec/twitter/streaming/event_spec.rb +20 -22
- data/spec/twitter/streaming/friend_list_spec.rb +11 -0
- data/spec/twitter/streaming/message_parser_spec.rb +54 -0
- data/spec/twitter/suggestion_spec.rb +11 -11
- data/spec/twitter/target_user_spec.rb +6 -6
- data/spec/twitter/token_spec.rb +4 -4
- data/spec/twitter/trend_results_spec.rb +30 -30
- data/spec/twitter/trend_spec.rb +21 -21
- data/spec/twitter/tweet_spec.rb +178 -164
- data/spec/twitter/user_spec.rb +190 -190
- data/twitter.gemspec +6 -6
- data.tar.gz.sig +0 -0
- metadata +44 -16
- metadata.gz.sig +0 -0
- data/lib/twitter/core_ext/enumerable.rb +0 -10
- data/lib/twitter/core_ext/kernel.rb +0 -10
- data/spec/twitter_spec.rb +0 -0
|
@@ -3,146 +3,146 @@ require 'helper'
|
|
|
3
3
|
|
|
4
4
|
describe Twitter::Media::Photo do
|
|
5
5
|
|
|
6
|
-
describe
|
|
7
|
-
it
|
|
6
|
+
describe '#==' do
|
|
7
|
+
it 'returns true when objects IDs are the same' do
|
|
8
8
|
photo = Twitter::Media::Photo.new(:id => 1)
|
|
9
9
|
other = Twitter::Media::Photo.new(:id => 1)
|
|
10
10
|
expect(photo == other).to be true
|
|
11
11
|
end
|
|
12
|
-
it
|
|
12
|
+
it 'returns false when objects IDs are different' do
|
|
13
13
|
photo = Twitter::Media::Photo.new(:id => 1)
|
|
14
14
|
other = Twitter::Media::Photo.new(:id => 2)
|
|
15
15
|
expect(photo == other).to be false
|
|
16
16
|
end
|
|
17
|
-
it
|
|
17
|
+
it 'returns false when classes are different' do
|
|
18
18
|
photo = Twitter::Media::Photo.new(:id => 1)
|
|
19
19
|
other = Twitter::Identity.new(:id => 1)
|
|
20
20
|
expect(photo == other).to be false
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
describe
|
|
25
|
-
it
|
|
26
|
-
sizes = Twitter::Media::Photo.new(:id =>
|
|
24
|
+
describe '#sizes' do
|
|
25
|
+
it 'returns a hash of Sizes when sizes is set' do
|
|
26
|
+
sizes = Twitter::Media::Photo.new(:id => 110_102_452_988_157_952, :sizes => {:small => {:h => 226, :w => 340, :resize => 'fit'}, :large => {:h => 466, :w => 700, :resize => 'fit'}, :medium => {:h => 399, :w => 600, :resize => 'fit'}, :thumb => {:h => 150, :w => 150, :resize => 'crop'}}).sizes
|
|
27
27
|
expect(sizes).to be_a Hash
|
|
28
28
|
expect(sizes[:small]).to be_a Twitter::Size
|
|
29
29
|
end
|
|
30
|
-
it
|
|
31
|
-
sizes = Twitter::Media::Photo.new(:id =>
|
|
30
|
+
it 'is empty when sizes is not set' do
|
|
31
|
+
sizes = Twitter::Media::Photo.new(:id => 110_102_452_988_157_952).sizes
|
|
32
32
|
expect(sizes).to be_empty
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
describe
|
|
37
|
-
it
|
|
38
|
-
photo = Twitter::Media::Photo.new(:id => 1, :display_url =>
|
|
36
|
+
describe '#display_uri' do
|
|
37
|
+
it 'returns a String when the display_url is set' do
|
|
38
|
+
photo = Twitter::Media::Photo.new(:id => 1, :display_url => 'example.com/expanded…')
|
|
39
39
|
expect(photo.display_uri).to be_a String
|
|
40
|
-
expect(photo.display_uri).to eq(
|
|
40
|
+
expect(photo.display_uri).to eq('example.com/expanded…')
|
|
41
41
|
end
|
|
42
|
-
it
|
|
42
|
+
it 'returns nil when the display_url is not set' do
|
|
43
43
|
photo = Twitter::Media::Photo.new(:id => 1)
|
|
44
44
|
expect(photo.display_uri).to be_nil
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
describe
|
|
49
|
-
it
|
|
50
|
-
photo = Twitter::Media::Photo.new(:id => 1, :display_url =>
|
|
48
|
+
describe '#display_uri?' do
|
|
49
|
+
it 'returns true when the display_url is set' do
|
|
50
|
+
photo = Twitter::Media::Photo.new(:id => 1, :display_url => 'example.com/expanded…')
|
|
51
51
|
expect(photo.display_uri?).to be true
|
|
52
52
|
end
|
|
53
|
-
it
|
|
53
|
+
it 'returns false when the display_url is not set' do
|
|
54
54
|
photo = Twitter::Media::Photo.new(:id => 1)
|
|
55
55
|
expect(photo.display_uri?).to be false
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
-
describe
|
|
60
|
-
it
|
|
61
|
-
photo = Twitter::Media::Photo.new(:id => 1, :expanded_url =>
|
|
62
|
-
expect(photo.expanded_uri).to be_a URI
|
|
63
|
-
expect(photo.expanded_uri.to_s).to eq(
|
|
59
|
+
describe '#expanded_uri' do
|
|
60
|
+
it 'returns a URI when the expanded_url is set' do
|
|
61
|
+
photo = Twitter::Media::Photo.new(:id => 1, :expanded_url => 'http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png')
|
|
62
|
+
expect(photo.expanded_uri).to be_a Addressable::URI
|
|
63
|
+
expect(photo.expanded_uri.to_s).to eq('http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png')
|
|
64
64
|
end
|
|
65
|
-
it
|
|
65
|
+
it 'returns nil when the expanded_url is not set' do
|
|
66
66
|
photo = Twitter::Media::Photo.new(:id => 1)
|
|
67
67
|
expect(photo.expanded_uri).to be_nil
|
|
68
68
|
end
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
-
describe
|
|
72
|
-
it
|
|
73
|
-
photo = Twitter::Media::Photo.new(:id => 1, :expanded_url =>
|
|
71
|
+
describe '#expanded_uri?' do
|
|
72
|
+
it 'returns true when the expanded_url is set' do
|
|
73
|
+
photo = Twitter::Media::Photo.new(:id => 1, :expanded_url => 'http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png')
|
|
74
74
|
expect(photo.expanded_uri?).to be true
|
|
75
75
|
end
|
|
76
|
-
it
|
|
76
|
+
it 'returns false when the expanded_url is not set' do
|
|
77
77
|
photo = Twitter::Media::Photo.new(:id => 1)
|
|
78
78
|
expect(photo.expanded_uri?).to be false
|
|
79
79
|
end
|
|
80
80
|
end
|
|
81
81
|
|
|
82
|
-
describe
|
|
83
|
-
it
|
|
84
|
-
photo = Twitter::Media::Photo.new(:id => 1, :media_url =>
|
|
85
|
-
expect(photo.media_uri).to be_a URI
|
|
86
|
-
expect(photo.media_uri.to_s).to eq(
|
|
82
|
+
describe '#media_uri' do
|
|
83
|
+
it 'returns a URI when the media_url is set' do
|
|
84
|
+
photo = Twitter::Media::Photo.new(:id => 1, :media_url => 'http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png')
|
|
85
|
+
expect(photo.media_uri).to be_a Addressable::URI
|
|
86
|
+
expect(photo.media_uri.to_s).to eq('http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png')
|
|
87
87
|
end
|
|
88
|
-
it
|
|
88
|
+
it 'returns nil when the media_url is not set' do
|
|
89
89
|
photo = Twitter::Media::Photo.new(:id => 1)
|
|
90
90
|
expect(photo.media_uri).to be_nil
|
|
91
91
|
end
|
|
92
92
|
end
|
|
93
93
|
|
|
94
|
-
describe
|
|
95
|
-
it
|
|
96
|
-
photo = Twitter::Media::Photo.new(:id => 1, :media_url =>
|
|
94
|
+
describe '#media_uri?' do
|
|
95
|
+
it 'returns true when the media_url is set' do
|
|
96
|
+
photo = Twitter::Media::Photo.new(:id => 1, :media_url => 'http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png')
|
|
97
97
|
expect(photo.media_uri?).to be true
|
|
98
98
|
end
|
|
99
|
-
it
|
|
99
|
+
it 'returns false when the media_url is not set' do
|
|
100
100
|
photo = Twitter::Media::Photo.new(:id => 1)
|
|
101
101
|
expect(photo.media_uri?).to be false
|
|
102
102
|
end
|
|
103
103
|
end
|
|
104
104
|
|
|
105
|
-
describe
|
|
106
|
-
it
|
|
107
|
-
photo = Twitter::Media::Photo.new(:id => 1, :media_url_https =>
|
|
108
|
-
expect(photo.media_uri_https).to be_a URI
|
|
109
|
-
expect(photo.media_uri_https.to_s).to eq(
|
|
105
|
+
describe '#media_uri_https' do
|
|
106
|
+
it 'returns a URI when the media_url_https is set' do
|
|
107
|
+
photo = Twitter::Media::Photo.new(:id => 1, :media_url_https => 'http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png')
|
|
108
|
+
expect(photo.media_uri_https).to be_a Addressable::URI
|
|
109
|
+
expect(photo.media_uri_https.to_s).to eq('http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png')
|
|
110
110
|
end
|
|
111
|
-
it
|
|
111
|
+
it 'returns nil when the media_url_https is not set' do
|
|
112
112
|
photo = Twitter::Media::Photo.new(:id => 1)
|
|
113
113
|
expect(photo.media_uri_https).to be_nil
|
|
114
114
|
end
|
|
115
115
|
end
|
|
116
116
|
|
|
117
|
-
describe
|
|
118
|
-
it
|
|
119
|
-
photo = Twitter::Media::Photo.new(:id => 1, :media_url_https =>
|
|
117
|
+
describe '#media_uri_https?' do
|
|
118
|
+
it 'returns true when the media_url_https is set' do
|
|
119
|
+
photo = Twitter::Media::Photo.new(:id => 1, :media_url_https => 'http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png')
|
|
120
120
|
expect(photo.media_uri_https?).to be true
|
|
121
121
|
end
|
|
122
|
-
it
|
|
122
|
+
it 'returns false when the media_url_https is not set' do
|
|
123
123
|
photo = Twitter::Media::Photo.new(:id => 1)
|
|
124
124
|
expect(photo.media_uri_https?).to be false
|
|
125
125
|
end
|
|
126
126
|
end
|
|
127
127
|
|
|
128
|
-
describe
|
|
129
|
-
it
|
|
130
|
-
photo = Twitter::Media::Photo.new(:id => 1, :url =>
|
|
131
|
-
expect(photo.uri).to be_a URI
|
|
132
|
-
expect(photo.uri.to_s).to eq(
|
|
128
|
+
describe '#uri' do
|
|
129
|
+
it 'returns a URI when the url is set' do
|
|
130
|
+
photo = Twitter::Media::Photo.new(:id => 1, :url => 'http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png')
|
|
131
|
+
expect(photo.uri).to be_a Addressable::URI
|
|
132
|
+
expect(photo.uri.to_s).to eq('http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png')
|
|
133
133
|
end
|
|
134
|
-
it
|
|
134
|
+
it 'returns nil when the url is not set' do
|
|
135
135
|
photo = Twitter::Media::Photo.new(:id => 1)
|
|
136
136
|
expect(photo.uri).to be_nil
|
|
137
137
|
end
|
|
138
138
|
end
|
|
139
139
|
|
|
140
|
-
describe
|
|
141
|
-
it
|
|
142
|
-
photo = Twitter::Media::Photo.new(:id => 1, :url =>
|
|
140
|
+
describe '#uri?' do
|
|
141
|
+
it 'returns true when the url is set' do
|
|
142
|
+
photo = Twitter::Media::Photo.new(:id => 1, :url => 'http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png')
|
|
143
143
|
expect(photo.uri?).to be true
|
|
144
144
|
end
|
|
145
|
-
it
|
|
145
|
+
it 'returns false when the url is not set' do
|
|
146
146
|
photo = Twitter::Media::Photo.new(:id => 1)
|
|
147
147
|
expect(photo.uri?).to be false
|
|
148
148
|
end
|
|
@@ -2,13 +2,13 @@ require 'helper'
|
|
|
2
2
|
|
|
3
3
|
describe Twitter::MediaFactory do
|
|
4
4
|
|
|
5
|
-
describe
|
|
6
|
-
it
|
|
7
|
-
media = Twitter::MediaFactory.new(:id => 1, :type =>
|
|
5
|
+
describe '.new' do
|
|
6
|
+
it 'generates a Photo' do
|
|
7
|
+
media = Twitter::MediaFactory.new(:id => 1, :type => 'photo')
|
|
8
8
|
expect(media).to be_a Twitter::Media::Photo
|
|
9
9
|
end
|
|
10
|
-
it
|
|
11
|
-
expect{Twitter::MediaFactory.new}.to raise_error IndexError
|
|
10
|
+
it 'raises an IndexError when type is not specified' do
|
|
11
|
+
expect { Twitter::MediaFactory.new }.to raise_error IndexError
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
@@ -6,20 +6,20 @@ describe Twitter::NullObject do
|
|
|
6
6
|
@null_object = Twitter::NullObject.new
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe
|
|
10
|
-
it
|
|
9
|
+
describe '#nil?' do
|
|
10
|
+
it 'returns true' do
|
|
11
11
|
expect(@null_object.nil?).to be true
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
describe
|
|
16
|
-
it
|
|
15
|
+
describe 'calling any method' do
|
|
16
|
+
it 'returns self' do
|
|
17
17
|
expect(@null_object.any).to equal @null_object
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
describe
|
|
22
|
-
it
|
|
21
|
+
describe '#respond_to?' do
|
|
22
|
+
it 'returns true' do
|
|
23
23
|
expect(@null_object.respond_to?(:any)).to be true
|
|
24
24
|
end
|
|
25
25
|
end
|
data/spec/twitter/oembed_spec.rb
CHANGED
|
@@ -2,166 +2,166 @@ require 'helper'
|
|
|
2
2
|
|
|
3
3
|
describe Twitter::OEmbed do
|
|
4
4
|
|
|
5
|
-
describe
|
|
6
|
-
it
|
|
7
|
-
oembed = Twitter::OEmbed.new(:author_url =>
|
|
8
|
-
expect(oembed.author_uri).to be_a URI
|
|
9
|
-
expect(oembed.author_uri.to_s).to eq(
|
|
5
|
+
describe '#author_uri' do
|
|
6
|
+
it 'returns a URI when the author_url is set' do
|
|
7
|
+
oembed = Twitter::OEmbed.new(:author_url => 'https://twitter.com/sferik')
|
|
8
|
+
expect(oembed.author_uri).to be_a Addressable::URI
|
|
9
|
+
expect(oembed.author_uri.to_s).to eq('https://twitter.com/sferik')
|
|
10
10
|
end
|
|
11
|
-
it
|
|
11
|
+
it 'returns nil when the author_uri is not set' do
|
|
12
12
|
oembed = Twitter::OEmbed.new
|
|
13
13
|
expect(oembed.author_uri).to be_nil
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
describe
|
|
18
|
-
it
|
|
19
|
-
oembed = Twitter::OEmbed.new(:author_url =>
|
|
17
|
+
describe '#author_uri?' do
|
|
18
|
+
it 'returns true when the author_url is set' do
|
|
19
|
+
oembed = Twitter::OEmbed.new(:author_url => 'https://twitter.com/sferik')
|
|
20
20
|
expect(oembed.author_uri?).to be true
|
|
21
21
|
end
|
|
22
|
-
it
|
|
22
|
+
it 'returns false when the author_uri is not set' do
|
|
23
23
|
oembed = Twitter::OEmbed.new
|
|
24
24
|
expect(oembed.author_uri?).to be false
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
describe
|
|
29
|
-
it
|
|
30
|
-
oembed = Twitter::OEmbed.new(:author_name =>
|
|
31
|
-
expect(oembed.author_name).to eq(
|
|
28
|
+
describe '#author_name' do
|
|
29
|
+
it 'returns the author name' do
|
|
30
|
+
oembed = Twitter::OEmbed.new(:author_name => 'Erik Michaels-Ober')
|
|
31
|
+
expect(oembed.author_name).to eq('Erik Michaels-Ober')
|
|
32
32
|
end
|
|
33
|
-
it
|
|
33
|
+
it 'returns nil when not set' do
|
|
34
34
|
author_name = Twitter::OEmbed.new.author_name
|
|
35
35
|
expect(author_name).to be_nil
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
describe
|
|
40
|
-
it
|
|
41
|
-
oembed = Twitter::OEmbed.new(:cache_age =>
|
|
42
|
-
expect(oembed.cache_age).to eq(
|
|
39
|
+
describe '#cache_age' do
|
|
40
|
+
it 'returns the cache_age' do
|
|
41
|
+
oembed = Twitter::OEmbed.new(:cache_age => '31536000000')
|
|
42
|
+
expect(oembed.cache_age).to eq('31536000000')
|
|
43
43
|
end
|
|
44
|
-
it
|
|
44
|
+
it 'returns nil when not set' do
|
|
45
45
|
cache_age = Twitter::OEmbed.new.cache_age
|
|
46
46
|
expect(cache_age).to be_nil
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
-
describe
|
|
51
|
-
it
|
|
50
|
+
describe '#height' do
|
|
51
|
+
it 'returns the height' do
|
|
52
52
|
oembed = Twitter::OEmbed.new(:height => 200)
|
|
53
53
|
expect(oembed.height).to eq(200)
|
|
54
54
|
end
|
|
55
|
-
it
|
|
55
|
+
it 'returns it as an Integer' do
|
|
56
56
|
oembed = Twitter::OEmbed.new(:height => 200)
|
|
57
57
|
expect(oembed.height).to be_an Integer
|
|
58
58
|
end
|
|
59
|
-
it
|
|
59
|
+
it 'returns nil when not set' do
|
|
60
60
|
height = Twitter::OEmbed.new.height
|
|
61
61
|
expect(height).to be_nil
|
|
62
62
|
end
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
-
describe
|
|
66
|
-
it
|
|
67
|
-
oembed = Twitter::OEmbed.new(:html =>
|
|
68
|
-
expect(oembed.html).to eq(
|
|
65
|
+
describe '#html' do
|
|
66
|
+
it 'returns the html' do
|
|
67
|
+
oembed = Twitter::OEmbed.new(:html => '<blockquote>all my <b>witty tweet</b> stuff here</blockquote>')
|
|
68
|
+
expect(oembed.html).to eq('<blockquote>all my <b>witty tweet</b> stuff here</blockquote>')
|
|
69
69
|
end
|
|
70
|
-
it
|
|
70
|
+
it 'returns nil when not set' do
|
|
71
71
|
html = Twitter::OEmbed.new.html
|
|
72
72
|
expect(html).to be_nil
|
|
73
73
|
end
|
|
74
74
|
end
|
|
75
75
|
|
|
76
|
-
describe
|
|
77
|
-
it
|
|
78
|
-
oembed = Twitter::OEmbed.new(:provider_name =>
|
|
79
|
-
expect(oembed.provider_name).to eq(
|
|
76
|
+
describe '#provider_name' do
|
|
77
|
+
it 'returns the provider_name' do
|
|
78
|
+
oembed = Twitter::OEmbed.new(:provider_name => 'Twitter')
|
|
79
|
+
expect(oembed.provider_name).to eq('Twitter')
|
|
80
80
|
end
|
|
81
|
-
it
|
|
81
|
+
it 'returns nil when not set' do
|
|
82
82
|
provider_name = Twitter::OEmbed.new.provider_name
|
|
83
83
|
expect(provider_name).to be_nil
|
|
84
84
|
end
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
-
describe
|
|
88
|
-
it
|
|
89
|
-
oembed = Twitter::OEmbed.new(:provider_url =>
|
|
90
|
-
expect(oembed.provider_uri).to be_a URI
|
|
91
|
-
expect(oembed.provider_uri.to_s).to eq(
|
|
87
|
+
describe '#provider_uri' do
|
|
88
|
+
it 'returns a URI when the provider_url is set' do
|
|
89
|
+
oembed = Twitter::OEmbed.new(:provider_url => 'http://twitter.com')
|
|
90
|
+
expect(oembed.provider_uri).to be_a Addressable::URI
|
|
91
|
+
expect(oembed.provider_uri.to_s).to eq('http://twitter.com')
|
|
92
92
|
end
|
|
93
|
-
it
|
|
93
|
+
it 'returns nil when the provider_uri is not set' do
|
|
94
94
|
oembed = Twitter::OEmbed.new
|
|
95
95
|
expect(oembed.provider_uri).to be_nil
|
|
96
96
|
end
|
|
97
97
|
end
|
|
98
98
|
|
|
99
|
-
describe
|
|
100
|
-
it
|
|
101
|
-
oembed = Twitter::OEmbed.new(:provider_url =>
|
|
99
|
+
describe '#provider_uri?' do
|
|
100
|
+
it 'returns true when the provider_url is set' do
|
|
101
|
+
oembed = Twitter::OEmbed.new(:provider_url => 'https://twitter.com/sferik')
|
|
102
102
|
expect(oembed.provider_uri?).to be true
|
|
103
103
|
end
|
|
104
|
-
it
|
|
104
|
+
it 'returns false when the provider_uri is not set' do
|
|
105
105
|
oembed = Twitter::OEmbed.new
|
|
106
106
|
expect(oembed.provider_uri?).to be false
|
|
107
107
|
end
|
|
108
108
|
end
|
|
109
109
|
|
|
110
|
-
describe
|
|
111
|
-
it
|
|
112
|
-
oembed = Twitter::OEmbed.new(:type =>
|
|
113
|
-
expect(oembed.type).to eq(
|
|
110
|
+
describe '#type' do
|
|
111
|
+
it 'returns the type' do
|
|
112
|
+
oembed = Twitter::OEmbed.new(:type => 'rich')
|
|
113
|
+
expect(oembed.type).to eq('rich')
|
|
114
114
|
end
|
|
115
|
-
it
|
|
115
|
+
it 'returns nil when not set' do
|
|
116
116
|
type = Twitter::OEmbed.new.type
|
|
117
117
|
expect(type).to be_nil
|
|
118
118
|
end
|
|
119
119
|
end
|
|
120
120
|
|
|
121
|
-
describe
|
|
122
|
-
it
|
|
121
|
+
describe '#width' do
|
|
122
|
+
it 'returns the width' do
|
|
123
123
|
oembed = Twitter::OEmbed.new(:width => 550)
|
|
124
124
|
expect(oembed.width).to eq(550)
|
|
125
125
|
end
|
|
126
|
-
it
|
|
126
|
+
it 'returns it as an Integer' do
|
|
127
127
|
oembed = Twitter::OEmbed.new(:width => 550)
|
|
128
128
|
expect(oembed.width).to be_an Integer
|
|
129
129
|
end
|
|
130
|
-
it
|
|
130
|
+
it 'returns nil when not set' do
|
|
131
131
|
width = Twitter::OEmbed.new.width
|
|
132
132
|
expect(width).to be_nil
|
|
133
133
|
end
|
|
134
134
|
end
|
|
135
135
|
|
|
136
|
-
describe
|
|
137
|
-
it
|
|
138
|
-
oembed = Twitter::OEmbed.new(:url =>
|
|
139
|
-
expect(oembed.uri).to be_a URI
|
|
140
|
-
expect(oembed.uri.to_s).to eq(
|
|
136
|
+
describe '#uri' do
|
|
137
|
+
it 'returns a URI when the url is set' do
|
|
138
|
+
oembed = Twitter::OEmbed.new(:url => 'https://twitter.com/twitterapi/status/133640144317198338')
|
|
139
|
+
expect(oembed.uri).to be_a Addressable::URI
|
|
140
|
+
expect(oembed.uri.to_s).to eq('https://twitter.com/twitterapi/status/133640144317198338')
|
|
141
141
|
end
|
|
142
|
-
it
|
|
142
|
+
it 'returns nil when the url is not set' do
|
|
143
143
|
oembed = Twitter::OEmbed.new
|
|
144
144
|
expect(oembed.uri).to be_nil
|
|
145
145
|
end
|
|
146
146
|
end
|
|
147
147
|
|
|
148
|
-
describe
|
|
149
|
-
it
|
|
150
|
-
oembed = Twitter::OEmbed.new(:url =>
|
|
148
|
+
describe '#uri?' do
|
|
149
|
+
it 'returns true when the url is set' do
|
|
150
|
+
oembed = Twitter::OEmbed.new(:url => 'https://twitter.com/twitterapi/status/133640144317198338')
|
|
151
151
|
expect(oembed.uri?).to be true
|
|
152
152
|
end
|
|
153
|
-
it
|
|
153
|
+
it 'returns false when the url is not set' do
|
|
154
154
|
oembed = Twitter::OEmbed.new
|
|
155
155
|
expect(oembed.uri?).to be false
|
|
156
156
|
end
|
|
157
157
|
end
|
|
158
158
|
|
|
159
|
-
describe
|
|
160
|
-
it
|
|
161
|
-
oembed = Twitter::OEmbed.new(:version =>
|
|
162
|
-
expect(oembed.version).to eq(
|
|
159
|
+
describe '#version' do
|
|
160
|
+
it 'returns the version' do
|
|
161
|
+
oembed = Twitter::OEmbed.new(:version => '1.0')
|
|
162
|
+
expect(oembed.version).to eq('1.0')
|
|
163
163
|
end
|
|
164
|
-
it
|
|
164
|
+
it 'returns nil when not set' do
|
|
165
165
|
version = Twitter::OEmbed.new.version
|
|
166
166
|
expect(version).to be_nil
|
|
167
167
|
end
|