twitter 5.11.0 → 5.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -1
  3. data/README.md +7 -5
  4. data/lib/twitter/arguments.rb +1 -0
  5. data/lib/twitter/base.rb +4 -5
  6. data/lib/twitter/basic_user.rb +1 -0
  7. data/lib/twitter/client.rb +10 -9
  8. data/lib/twitter/configuration.rb +4 -2
  9. data/lib/twitter/cursor.rb +3 -2
  10. data/lib/twitter/direct_message.rb +1 -0
  11. data/lib/twitter/entity.rb +1 -0
  12. data/lib/twitter/entity/hashtag.rb +1 -0
  13. data/lib/twitter/entity/symbol.rb +1 -0
  14. data/lib/twitter/entity/user_mention.rb +4 -1
  15. data/lib/twitter/error.rb +22 -19
  16. data/lib/twitter/geo.rb +1 -0
  17. data/lib/twitter/geo_results.rb +3 -2
  18. data/lib/twitter/identity.rb +1 -0
  19. data/lib/twitter/language.rb +1 -0
  20. data/lib/twitter/list.rb +12 -5
  21. data/lib/twitter/media/photo.rb +1 -0
  22. data/lib/twitter/metadata.rb +1 -0
  23. data/lib/twitter/null_object.rb +22 -0
  24. data/lib/twitter/oembed.rb +5 -2
  25. data/lib/twitter/place.rb +4 -1
  26. data/lib/twitter/profile.rb +1 -1
  27. data/lib/twitter/rest/client.rb +4 -4
  28. data/lib/twitter/rest/favorites.rb +4 -3
  29. data/lib/twitter/rest/lists.rb +18 -3
  30. data/lib/twitter/rest/request/multipart_with_file.rb +1 -1
  31. data/lib/twitter/rest/response/parse_json.rb +1 -1
  32. data/lib/twitter/rest/response/raise_error.rb +4 -5
  33. data/lib/twitter/rest/tweets.rb +2 -1
  34. data/lib/twitter/rest/users.rb +10 -7
  35. data/lib/twitter/saved_search.rb +1 -0
  36. data/lib/twitter/search_results.rb +3 -2
  37. data/lib/twitter/settings.rb +7 -3
  38. data/lib/twitter/size.rb +4 -1
  39. data/lib/twitter/streaming/deleted_tweet.rb +1 -0
  40. data/lib/twitter/streaming/event.rb +2 -2
  41. data/lib/twitter/streaming/message_parser.rb +1 -1
  42. data/lib/twitter/suggestion.rb +4 -1
  43. data/lib/twitter/token.rb +1 -0
  44. data/lib/twitter/trend.rb +1 -0
  45. data/lib/twitter/trend_results.rb +3 -2
  46. data/lib/twitter/tweet.rb +9 -6
  47. data/lib/twitter/user.rb +15 -13
  48. data/lib/twitter/utils.rb +2 -6
  49. data/lib/twitter/version.rb +1 -1
  50. data/twitter.gemspec +6 -9
  51. metadata +6 -259
  52. data/Rakefile +0 -37
  53. data/spec/fixtures/already_favorited.json +0 -1
  54. data/spec/fixtures/already_posted.json +0 -1
  55. data/spec/fixtures/already_retweeted.json +0 -1
  56. data/spec/fixtures/bearer_token.json +0 -1
  57. data/spec/fixtures/category.json +0 -1
  58. data/spec/fixtures/configuration.json +0 -1
  59. data/spec/fixtures/contributees.json +0 -1
  60. data/spec/fixtures/count.json +0 -1
  61. data/spec/fixtures/direct_message.json +0 -1
  62. data/spec/fixtures/direct_messages.json +0 -1
  63. data/spec/fixtures/empty.json +0 -0
  64. data/spec/fixtures/followers_list.json +0 -1
  65. data/spec/fixtures/followers_list2.json +0 -1
  66. data/spec/fixtures/following.json +0 -1
  67. data/spec/fixtures/forbidden.json +0 -1
  68. data/spec/fixtures/friends_list.json +0 -1
  69. data/spec/fixtures/friends_list2.json +0 -1
  70. data/spec/fixtures/friendships.json +0 -1
  71. data/spec/fixtures/ids.json +0 -1
  72. data/spec/fixtures/ids_list.json +0 -1
  73. data/spec/fixtures/ids_list2.json +0 -1
  74. data/spec/fixtures/languages.json +0 -1
  75. data/spec/fixtures/list.json +0 -1
  76. data/spec/fixtures/lists.json +0 -1
  77. data/spec/fixtures/locations.json +0 -1
  78. data/spec/fixtures/matching_trends.json +0 -1
  79. data/spec/fixtures/me.jpeg +0 -0
  80. data/spec/fixtures/members.json +0 -1
  81. data/spec/fixtures/memberships.json +0 -1
  82. data/spec/fixtures/memberships2.json +0 -1
  83. data/spec/fixtures/not_following.json +0 -1
  84. data/spec/fixtures/not_found.json +0 -1
  85. data/spec/fixtures/oembed.json +0 -1
  86. data/spec/fixtures/ownerships.json +0 -1
  87. data/spec/fixtures/pbjt.gif +0 -0
  88. data/spec/fixtures/pengwynn.json +0 -1
  89. data/spec/fixtures/place.json +0 -1
  90. data/spec/fixtures/places.json +0 -1
  91. data/spec/fixtures/privacy.json +0 -1
  92. data/spec/fixtures/profile_banner.json +0 -1
  93. data/spec/fixtures/request_token.txt +0 -6
  94. data/spec/fixtures/retweet.json +0 -1
  95. data/spec/fixtures/retweets.json +0 -1
  96. data/spec/fixtures/saved_search.json +0 -1
  97. data/spec/fixtures/saved_searches.json +0 -1
  98. data/spec/fixtures/search.json +0 -1
  99. data/spec/fixtures/search2.json +0 -1
  100. data/spec/fixtures/search_malformed.json +0 -1
  101. data/spec/fixtures/settings.json +0 -1
  102. data/spec/fixtures/sferik.json +0 -1
  103. data/spec/fixtures/status.json +0 -1
  104. data/spec/fixtures/statuses.json +0 -1
  105. data/spec/fixtures/subscriptions.json +0 -1
  106. data/spec/fixtures/subscriptions2.json +0 -1
  107. data/spec/fixtures/suggestions.json +0 -1
  108. data/spec/fixtures/tos.json +0 -1
  109. data/spec/fixtures/track_streaming.json +0 -3
  110. data/spec/fixtures/track_streaming_user.json +0 -6
  111. data/spec/fixtures/upload.json +0 -1
  112. data/spec/fixtures/user_search.json +0 -1
  113. data/spec/fixtures/user_timeline.json +0 -1
  114. data/spec/fixtures/users.json +0 -1
  115. data/spec/fixtures/users_list.json +0 -1
  116. data/spec/fixtures/users_list2.json +0 -1
  117. data/spec/fixtures/we_concept_bg2.png +0 -0
  118. data/spec/fixtures/wildcomet2.jpe +0 -0
  119. data/spec/helper.rb +0 -68
  120. data/spec/twitter/base_spec.rb +0 -39
  121. data/spec/twitter/basic_user_spec.rb +0 -23
  122. data/spec/twitter/configuration_spec.rb +0 -17
  123. data/spec/twitter/cursor_spec.rb +0 -30
  124. data/spec/twitter/direct_message_spec.rb +0 -232
  125. data/spec/twitter/entity/uri_spec.rb +0 -75
  126. data/spec/twitter/error_spec.rb +0 -52
  127. data/spec/twitter/geo/point_spec.rb +0 -41
  128. data/spec/twitter/geo/polygon_spec.rb +0 -29
  129. data/spec/twitter/geo_factory_spec.rb +0 -19
  130. data/spec/twitter/geo_results_spec.rb +0 -35
  131. data/spec/twitter/geo_spec.rb +0 -29
  132. data/spec/twitter/identifiable_spec.rb +0 -29
  133. data/spec/twitter/list_spec.rb +0 -88
  134. data/spec/twitter/media/photo_spec.rb +0 -151
  135. data/spec/twitter/media_factory_spec.rb +0 -15
  136. data/spec/twitter/oembed_spec.rb +0 -170
  137. data/spec/twitter/place_spec.rb +0 -168
  138. data/spec/twitter/profile_banner_spec.rb +0 -13
  139. data/spec/twitter/rate_limit_spec.rb +0 -59
  140. data/spec/twitter/relationship_spec.rb +0 -49
  141. data/spec/twitter/rest/client_spec.rb +0 -217
  142. data/spec/twitter/rest/direct_messages_spec.rb +0 -133
  143. data/spec/twitter/rest/favorites_spec.rb +0 -188
  144. data/spec/twitter/rest/friends_and_followers_spec.rb +0 -667
  145. data/spec/twitter/rest/geo_spec.rb +0 -68
  146. data/spec/twitter/rest/help_spec.rb +0 -68
  147. data/spec/twitter/rest/lists_spec.rb +0 -910
  148. data/spec/twitter/rest/media_spec.rb +0 -54
  149. data/spec/twitter/rest/oauth_spec.rb +0 -63
  150. data/spec/twitter/rest/saved_searches_spec.rb +0 -98
  151. data/spec/twitter/rest/search_spec.rb +0 -42
  152. data/spec/twitter/rest/spam_reporting_spec.rb +0 -25
  153. data/spec/twitter/rest/suggested_users_spec.rb +0 -59
  154. data/spec/twitter/rest/timelines_spec.rb +0 -138
  155. data/spec/twitter/rest/trends_spec.rb +0 -68
  156. data/spec/twitter/rest/tweets_spec.rb +0 -614
  157. data/spec/twitter/rest/undocumented_spec.rb +0 -103
  158. data/spec/twitter/rest/users_spec.rb +0 -797
  159. data/spec/twitter/saved_search_spec.rb +0 -45
  160. data/spec/twitter/search_results_spec.rb +0 -30
  161. data/spec/twitter/settings_spec.rb +0 -27
  162. data/spec/twitter/size_spec.rb +0 -28
  163. data/spec/twitter/source_user_spec.rb +0 -23
  164. data/spec/twitter/streaming/client_spec.rb +0 -123
  165. data/spec/twitter/streaming/connection_spec.rb +0 -32
  166. data/spec/twitter/streaming/deleted_tweet_spec.rb +0 -23
  167. data/spec/twitter/streaming/event_spec.rb +0 -43
  168. data/spec/twitter/streaming/friend_list_spec.rb +0 -11
  169. data/spec/twitter/streaming/message_parser_spec.rb +0 -54
  170. data/spec/twitter/streaming/response_spec.rb +0 -21
  171. data/spec/twitter/suggestion_spec.rb +0 -40
  172. data/spec/twitter/target_user_spec.rb +0 -23
  173. data/spec/twitter/token_spec.rb +0 -16
  174. data/spec/twitter/trend_results_spec.rb +0 -89
  175. data/spec/twitter/trend_spec.rb +0 -51
  176. data/spec/twitter/tweet_spec.rb +0 -456
  177. data/spec/twitter/user_spec.rb +0 -447
  178. data/spec/twitter/utils_spec.rb +0 -34
@@ -1,15 +0,0 @@
1
- require 'helper'
2
-
3
- describe Twitter::MediaFactory do
4
-
5
- describe '.new' do
6
- it 'generates a Photo' do
7
- media = Twitter::MediaFactory.new(:id => 1, :type => 'photo')
8
- expect(media).to be_a Twitter::Media::Photo
9
- end
10
- it 'raises an IndexError when type is not specified' do
11
- expect { Twitter::MediaFactory.new }.to raise_error(IndexError)
12
- end
13
- end
14
-
15
- end
@@ -1,170 +0,0 @@
1
- require 'helper'
2
-
3
- describe Twitter::OEmbed do
4
-
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_an Addressable::URI
9
- expect(oembed.author_uri.to_s).to eq('https://twitter.com/sferik')
10
- end
11
- it 'returns nil when the author_uri is not set' do
12
- oembed = Twitter::OEmbed.new
13
- expect(oembed.author_uri).to be_nil
14
- end
15
- end
16
-
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
- expect(oembed.author_uri?).to be true
21
- end
22
- it 'returns false when the author_uri is not set' do
23
- oembed = Twitter::OEmbed.new
24
- expect(oembed.author_uri?).to be false
25
- end
26
- end
27
-
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
- end
33
- it 'returns nil when not set' do
34
- author_name = Twitter::OEmbed.new.author_name
35
- expect(author_name).to be_nil
36
- end
37
- end
38
-
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
- end
44
- it 'returns nil when not set' do
45
- cache_age = Twitter::OEmbed.new.cache_age
46
- expect(cache_age).to be_nil
47
- end
48
- end
49
-
50
- describe '#height' do
51
- it 'returns the height' do
52
- oembed = Twitter::OEmbed.new(:height => 200)
53
- expect(oembed.height).to eq(200)
54
- end
55
- it 'returns it as an Integer' do
56
- oembed = Twitter::OEmbed.new(:height => 200)
57
- expect(oembed.height).to be_an Integer
58
- end
59
- it 'returns nil when not set' do
60
- height = Twitter::OEmbed.new.height
61
- expect(height).to be_nil
62
- end
63
- end
64
-
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
- end
70
- it 'returns nil when not set' do
71
- html = Twitter::OEmbed.new.html
72
- expect(html).to be_nil
73
- end
74
- end
75
-
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
- end
81
- it 'returns nil when not set' do
82
- provider_name = Twitter::OEmbed.new.provider_name
83
- expect(provider_name).to be_nil
84
- end
85
- end
86
-
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_an Addressable::URI
91
- expect(oembed.provider_uri.to_s).to eq('http://twitter.com')
92
- end
93
- it 'returns nil when the provider_uri is not set' do
94
- oembed = Twitter::OEmbed.new
95
- expect(oembed.provider_uri).to be_nil
96
- end
97
- end
98
-
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
- expect(oembed.provider_uri?).to be true
103
- end
104
- it 'returns false when the provider_uri is not set' do
105
- oembed = Twitter::OEmbed.new
106
- expect(oembed.provider_uri?).to be false
107
- end
108
- end
109
-
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
- end
115
- it 'returns nil when not set' do
116
- type = Twitter::OEmbed.new.type
117
- expect(type).to be_nil
118
- end
119
- end
120
-
121
- describe '#width' do
122
- it 'returns the width' do
123
- oembed = Twitter::OEmbed.new(:width => 550)
124
- expect(oembed.width).to eq(550)
125
- end
126
- it 'returns it as an Integer' do
127
- oembed = Twitter::OEmbed.new(:width => 550)
128
- expect(oembed.width).to be_an Integer
129
- end
130
- it 'returns nil when not set' do
131
- width = Twitter::OEmbed.new.width
132
- expect(width).to be_nil
133
- end
134
- end
135
-
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_an Addressable::URI
140
- expect(oembed.uri.to_s).to eq('https://twitter.com/twitterapi/status/133640144317198338')
141
- end
142
- it 'returns nil when the url is not set' do
143
- oembed = Twitter::OEmbed.new
144
- expect(oembed.uri).to be_nil
145
- end
146
- end
147
-
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
- expect(oembed.uri?).to be true
152
- end
153
- it 'returns false when the url is not set' do
154
- oembed = Twitter::OEmbed.new
155
- expect(oembed.uri?).to be false
156
- end
157
- end
158
-
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
- end
164
- it 'returns nil when not set' do
165
- version = Twitter::OEmbed.new.version
166
- expect(version).to be_nil
167
- end
168
- end
169
-
170
- end
@@ -1,168 +0,0 @@
1
- require 'helper'
2
-
3
- describe Twitter::Place do
4
-
5
- describe '.new' do
6
- it 'raises an IndexError when id or woeid is not specified' do
7
- expect { Twitter::Place.new(:id => 1) }.not_to raise_error
8
- expect { Twitter::Place.new(:woeid => 1) }.not_to raise_error
9
- expect { Twitter::Place.new }.to raise_error(IndexError)
10
- end
11
- end
12
-
13
- describe '#eql?' do
14
- it 'returns true when objects WOE IDs are the same' do
15
- place = Twitter::Place.new(:woeid => 1, :name => 'foo')
16
- other = Twitter::Place.new(:woeid => 1, :name => 'bar')
17
- expect(place).to eql(other)
18
- end
19
- it 'returns false when objects WOE IDs are different' do
20
- place = Twitter::Place.new(:woeid => 1)
21
- other = Twitter::Place.new(:woeid => 2)
22
- expect(place).not_to eql(other)
23
- end
24
- it 'returns false when classes are different' do
25
- place = Twitter::Place.new(:woeid => 1)
26
- other = Twitter::Base.new(:woeid => 1)
27
- expect(place).not_to eql(other)
28
- end
29
- end
30
-
31
- describe '#bounding_box' do
32
- it 'returns a Twitter::Geo when bounding_box is set' do
33
- place = Twitter::Place.new(:woeid => '247f43d441defc03', :bounding_box => {:type => 'Polygon', :coordinates => [[[-122.40348192, 37.77752898], [-122.387436, 37.77752898], [-122.387436, 37.79448597], [-122.40348192, 37.79448597]]]})
34
- expect(place.bounding_box).to be_a Twitter::Geo::Polygon
35
- end
36
- it 'returns nil when not bounding_box is not set' do
37
- place = Twitter::Place.new(:woeid => '247f43d441defc03')
38
- expect(place.bounding_box).to be_nil
39
- end
40
- end
41
-
42
- describe '#==' do
43
- it 'returns true when objects WOE IDs are the same' do
44
- place = Twitter::Place.new(:woeid => 1, :name => 'foo')
45
- other = Twitter::Place.new(:woeid => 1, :name => 'bar')
46
- expect(place == other).to be true
47
- end
48
- it 'returns false when objects WOE IDs are different' do
49
- place = Twitter::Place.new(:woeid => 1)
50
- other = Twitter::Place.new(:woeid => 2)
51
- expect(place == other).to be false
52
- end
53
- it 'returns false when classes are different' do
54
- place = Twitter::Place.new(:woeid => 1)
55
- other = Twitter::Base.new(:woeid => 1)
56
- expect(place == other).to be false
57
- end
58
- end
59
-
60
- describe '#bounding_box' do
61
- it 'returns a Twitter::Geo when bounding_box is set' do
62
- place = Twitter::Place.new(:woeid => '247f43d441defc03', :bounding_box => {:type => 'Polygon', :coordinates => [[[-122.40348192, 37.77752898], [-122.387436, 37.77752898], [-122.387436, 37.79448597], [-122.40348192, 37.79448597]]]})
63
- expect(place.bounding_box).to be_a Twitter::Geo::Polygon
64
- end
65
- it 'returns nil when not bounding_box is not set' do
66
- place = Twitter::Place.new(:woeid => '247f43d441defc03')
67
- expect(place.bounding_box).to be_nil
68
- end
69
- end
70
-
71
- describe '#bounding_box?' do
72
- it 'returns true when bounding_box is set' do
73
- place = Twitter::Place.new(:woeid => '247f43d441defc03', :bounding_box => {:type => 'Polygon', :coordinates => [[[-122.40348192, 37.77752898], [-122.387436, 37.77752898], [-122.387436, 37.79448597], [-122.40348192, 37.79448597]]]})
74
- expect(place.bounding_box?).to be true
75
- end
76
- it 'returns false when bounding_box is not set' do
77
- place = Twitter::Place.new(:woeid => '247f43d441defc03')
78
- expect(place.bounding_box?).to be false
79
- end
80
- end
81
-
82
- describe '#contained_within' do
83
- it 'returns a Twitter::Place when contained_within is set' do
84
- place = Twitter::Place.new(:woeid => '247f43d441defc03', :contained_within => {:woeid => '247f43d441defc04'})
85
- expect(place.contained_within).to be_a Twitter::Place
86
- end
87
- it 'returns nil when not contained_within is not set' do
88
- place = Twitter::Place.new(:woeid => '247f43d441defc03')
89
- expect(place.contained_within).to be_nil
90
- end
91
- end
92
-
93
- describe '#contained_within?' do
94
- it 'returns true when contained_within is set' do
95
- place = Twitter::Place.new(:woeid => '247f43d441defc03', :contained_within => {:woeid => '247f43d441defc04'})
96
- expect(place.contained?).to be true
97
- end
98
- it 'returns false when contained_within is not set' do
99
- place = Twitter::Place.new(:woeid => '247f43d441defc03')
100
- expect(place.contained?).to be false
101
- end
102
- end
103
-
104
- describe '#country_code' do
105
- it 'returns a country code when set with country_code' do
106
- place = Twitter::Place.new(:woeid => '247f43d441defc03', :country_code => 'US')
107
- expect(place.country_code).to eq('US')
108
- end
109
- it 'returns a country code when set with countryCode' do
110
- place = Twitter::Place.new(:woeid => '247f43d441defc03', :countryCode => 'US') # rubocop:disable SymbolName
111
- expect(place.country_code).to eq('US')
112
- end
113
- it 'returns nil when not set' do
114
- place = Twitter::Place.new(:woeid => '247f43d441defc03')
115
- expect(place.country_code).to be_nil
116
- end
117
- end
118
-
119
- describe '#parent_id' do
120
- it 'returns a parent ID when set with parentid' do
121
- place = Twitter::Place.new(:woeid => '247f43d441defc03', :parentid => 1)
122
- expect(place.parent_id).to eq(1)
123
- end
124
- it 'returns nil when not set' do
125
- place = Twitter::Place.new(:woeid => '247f43d441defc03')
126
- expect(place.parent_id).to be_nil
127
- end
128
- end
129
-
130
- describe '#place_type' do
131
- it 'returns a place type when set with place_type' do
132
- place = Twitter::Place.new(:woeid => '247f43d441defc03', :place_type => 'city')
133
- expect(place.place_type).to eq('city')
134
- end
135
- it 'returns a place type when set with placeType[name]' do
136
- place = Twitter::Place.new(:woeid => '247f43d441defc03', :placeType => {:name => 'Town'}) # rubocop:disable SymbolName
137
- expect(place.place_type).to eq('Town')
138
- end
139
- it 'returns nil when not set' do
140
- place = Twitter::Place.new(:woeid => '247f43d441defc03')
141
- expect(place.place_type).to be_nil
142
- end
143
- end
144
-
145
- describe '#uri' do
146
- it 'returns a URI when the url is set' do
147
- place = Twitter::Place.new(:woeid => '247f43d441defc03', :url => 'https://api.twitter.com/1.1/geo/id/247f43d441defc03.json')
148
- expect(place.uri).to be_an Addressable::URI
149
- expect(place.uri.to_s).to eq('https://api.twitter.com/1.1/geo/id/247f43d441defc03.json')
150
- end
151
- it 'returns nil when the url is not set' do
152
- place = Twitter::Place.new(:woeid => '247f43d441defc03')
153
- expect(place.uri).to be_nil
154
- end
155
- end
156
-
157
- describe '#uri?' do
158
- it 'returns true when the url is set' do
159
- place = Twitter::Place.new(:woeid => '247f43d441defc03', :url => 'https://api.twitter.com/1.1/geo/id/247f43d441defc03.json')
160
- expect(place.uri?).to be true
161
- end
162
- it 'returns false when the url is not set' do
163
- place = Twitter::Place.new(:woeid => '247f43d441defc03')
164
- expect(place.uri?).to be false
165
- end
166
- end
167
-
168
- end
@@ -1,13 +0,0 @@
1
- require 'helper'
2
-
3
- describe Twitter::ProfileBanner do
4
-
5
- describe '#sizes' do
6
- it 'returns a hash of Sizes when sizes is set' do
7
- sizes = Twitter::ProfileBanner.new(: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
8
- expect(sizes).to be_a Hash
9
- expect(sizes[:small]).to be_a Twitter::Size
10
- end
11
- end
12
-
13
- end
@@ -1,59 +0,0 @@
1
- require 'helper'
2
-
3
- describe Twitter::RateLimit do
4
-
5
- describe '#limit' do
6
- it 'returns an Integer when x-rate-limit-limit header is set' do
7
- rate_limit = Twitter::RateLimit.new('x-rate-limit-limit' => '150')
8
- expect(rate_limit.limit).to be_an Integer
9
- expect(rate_limit.limit).to eq(150)
10
- end
11
- it 'returns nil when x-rate-limit-limit header is not set' do
12
- rate_limit = Twitter::RateLimit.new
13
- expect(rate_limit.limit).to be_nil
14
- end
15
- end
16
-
17
- describe '#remaining' do
18
- it 'returns an Integer when x-rate-limit-remaining header is set' do
19
- rate_limit = Twitter::RateLimit.new('x-rate-limit-remaining' => '149')
20
- expect(rate_limit.remaining).to be_an Integer
21
- expect(rate_limit.remaining).to eq(149)
22
- end
23
- it 'returns nil when x-rate-limit-remaining header is not set' do
24
- rate_limit = Twitter::RateLimit.new
25
- expect(rate_limit.remaining).to be_nil
26
- end
27
- end
28
-
29
- describe '#reset_at' do
30
- it 'returns a Time when x-rate-limit-reset header is set' do
31
- rate_limit = Twitter::RateLimit.new('x-rate-limit-reset' => '1339019097')
32
- expect(rate_limit.reset_at).to be_a Time
33
- expect(rate_limit.reset_at).to eq(Time.at(1_339_019_097))
34
- end
35
- it 'returns nil when x-rate-limit-reset header is not set' do
36
- rate_limit = Twitter::RateLimit.new
37
- expect(rate_limit.reset_at).to be_nil
38
- end
39
- end
40
-
41
- describe '#reset_in' do
42
- before do
43
- Timecop.freeze(Time.utc(2012, 6, 6, 17, 22, 0))
44
- end
45
- after do
46
- Timecop.return
47
- end
48
- it 'returns an Integer when x-rate-limit-reset header is set' do
49
- rate_limit = Twitter::RateLimit.new('x-rate-limit-reset' => '1339019097')
50
- expect(rate_limit.reset_in).to be_an Integer
51
- expect(rate_limit.reset_in).to eq(15_777)
52
- end
53
- it 'returns nil when x-rate-limit-reset header is not set' do
54
- rate_limit = Twitter::RateLimit.new
55
- expect(rate_limit.reset_in).to be_nil
56
- end
57
- end
58
-
59
- end
@@ -1,49 +0,0 @@
1
- require 'helper'
2
-
3
- describe Twitter::Relationship do
4
-
5
- describe '#source' do
6
- it 'returns a User when source is set' do
7
- relationship = Twitter::Relationship.new(:relationship => {:source => {:id => 7_505_382}})
8
- expect(relationship.source).to be_a Twitter::SourceUser
9
- end
10
- it 'returns nil when source is not set' do
11
- relationship = Twitter::Relationship.new(:relationship => {})
12
- expect(relationship.source).to be_nil
13
- end
14
- end
15
-
16
- describe '#source?' do
17
- it 'returns true when source is set' do
18
- relationship = Twitter::Relationship.new(:relationship => {:source => {:id => 7_505_382}})
19
- expect(relationship.source?).to be true
20
- end
21
- it 'returns false when source is not set' do
22
- relationship = Twitter::Relationship.new(:relationship => {})
23
- expect(relationship.source?).to be false
24
- end
25
- end
26
-
27
- describe '#target' do
28
- it 'returns a User when target is set' do
29
- relationship = Twitter::Relationship.new(:relationship => {:target => {:id => 7_505_382}})
30
- expect(relationship.target).to be_a Twitter::TargetUser
31
- end
32
- it 'returns nil when target is not set' do
33
- relationship = Twitter::Relationship.new(:relationship => {})
34
- expect(relationship.target).to be_nil
35
- end
36
- end
37
-
38
- describe '#target?' do
39
- it 'returns true when target is set' do
40
- relationship = Twitter::Relationship.new(:relationship => {:target => {:id => 7_505_382}})
41
- expect(relationship.target?).to be true
42
- end
43
- it 'returns false when target is not set' do
44
- relationship = Twitter::Relationship.new(:relationship => {})
45
- expect(relationship.target?).to be false
46
- end
47
- end
48
-
49
- end