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,135 +3,135 @@ require 'helper'
|
|
|
3
3
|
describe Twitter::REST::API::Timelines do
|
|
4
4
|
|
|
5
5
|
before do
|
|
6
|
-
@client = Twitter::REST::Client.new(:consumer_key =>
|
|
6
|
+
@client = Twitter::REST::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :access_token => 'AT', :access_token_secret => 'AS')
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe
|
|
9
|
+
describe '#mentions_timeline' do
|
|
10
10
|
before do
|
|
11
|
-
stub_get(
|
|
11
|
+
stub_get('/1.1/statuses/mentions_timeline.json').to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
|
12
12
|
end
|
|
13
|
-
it
|
|
13
|
+
it 'requests the correct resource' do
|
|
14
14
|
@client.mentions_timeline
|
|
15
|
-
expect(a_get(
|
|
15
|
+
expect(a_get('/1.1/statuses/mentions_timeline.json')).to have_been_made
|
|
16
16
|
end
|
|
17
|
-
it
|
|
17
|
+
it 'returns the 20 most recent mentions (status containing @username) for the authenticating user' do
|
|
18
18
|
tweets = @client.mentions_timeline
|
|
19
19
|
expect(tweets).to be_an Array
|
|
20
20
|
expect(tweets.first).to be_a Twitter::Tweet
|
|
21
|
-
expect(tweets.first.text).to eq(
|
|
21
|
+
expect(tweets.first.text).to eq('Happy Birthday @imdane. Watch out for those @rally pranksters!')
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
describe
|
|
26
|
-
context
|
|
25
|
+
describe '#user_timeline' do
|
|
26
|
+
context 'with a screen name passed' do
|
|
27
27
|
before do
|
|
28
|
-
stub_get(
|
|
28
|
+
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:screen_name => 'sferik'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
|
29
29
|
end
|
|
30
|
-
it
|
|
31
|
-
@client.user_timeline(
|
|
32
|
-
expect(a_get(
|
|
30
|
+
it 'requests the correct resource' do
|
|
31
|
+
@client.user_timeline('sferik')
|
|
32
|
+
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:screen_name => 'sferik'})).to have_been_made
|
|
33
33
|
end
|
|
34
|
-
it
|
|
35
|
-
tweets = @client.user_timeline(
|
|
34
|
+
it 'returns the 20 most recent Tweets posted by the user specified by screen name or user id' do
|
|
35
|
+
tweets = @client.user_timeline('sferik')
|
|
36
36
|
expect(tweets).to be_an Array
|
|
37
37
|
expect(tweets.first).to be_a Twitter::Tweet
|
|
38
|
-
expect(tweets.first.text).to eq(
|
|
38
|
+
expect(tweets.first.text).to eq('Happy Birthday @imdane. Watch out for those @rally pranksters!')
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
|
-
context
|
|
41
|
+
context 'without a screen name passed' do
|
|
42
42
|
before do
|
|
43
|
-
stub_get(
|
|
43
|
+
stub_get('/1.1/statuses/user_timeline.json').to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
|
44
44
|
end
|
|
45
|
-
it
|
|
45
|
+
it 'requests the correct resource' do
|
|
46
46
|
@client.user_timeline
|
|
47
|
-
expect(a_get(
|
|
47
|
+
expect(a_get('/1.1/statuses/user_timeline.json')).to have_been_made
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
-
describe
|
|
52
|
+
describe '#retweeted_by_user' do
|
|
53
53
|
before do
|
|
54
|
-
stub_get(
|
|
55
|
-
stub_get(
|
|
54
|
+
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:include_rts => 'true', :screen_name => 'sferik', :count => '200'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
|
55
|
+
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:include_rts => 'true', :screen_name => 'sferik', :count => '200', :max_id => '244102729860009983'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
|
56
56
|
end
|
|
57
|
-
it
|
|
58
|
-
@client.retweeted_by_user(
|
|
59
|
-
expect(a_get(
|
|
60
|
-
expect(a_get(
|
|
57
|
+
it 'requests the correct resource' do
|
|
58
|
+
@client.retweeted_by_user('sferik')
|
|
59
|
+
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:include_rts => 'true', :screen_name => 'sferik', :count => '200'})).to have_been_made
|
|
60
|
+
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:include_rts => 'true', :screen_name => 'sferik', :count => '200', :max_id => '244102729860009983'})).to have_been_made.times(3)
|
|
61
61
|
end
|
|
62
|
-
it
|
|
63
|
-
tweets = @client.retweeted_by_user(
|
|
62
|
+
it 'returns the 20 most recent retweets posted by the authenticating user' do
|
|
63
|
+
tweets = @client.retweeted_by_user('sferik')
|
|
64
64
|
expect(tweets).to be_an Array
|
|
65
65
|
expect(tweets.first).to be_a Twitter::Tweet
|
|
66
|
-
expect(tweets.first.text).to eq(
|
|
66
|
+
expect(tweets.first.text).to eq('RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k')
|
|
67
67
|
end
|
|
68
68
|
end
|
|
69
69
|
|
|
70
|
-
describe
|
|
70
|
+
describe '#retweeted_by_me' do
|
|
71
71
|
before do
|
|
72
|
-
stub_get(
|
|
73
|
-
stub_get(
|
|
72
|
+
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:include_rts => 'true', :count => '200'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
|
73
|
+
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:include_rts => 'true', :count => '200', :max_id => '244102729860009983'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
|
74
74
|
end
|
|
75
|
-
it
|
|
75
|
+
it 'requests the correct resource' do
|
|
76
76
|
@client.retweeted_by_me
|
|
77
|
-
expect(a_get(
|
|
78
|
-
expect(a_get(
|
|
77
|
+
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:include_rts => 'true', :count => '200'})).to have_been_made
|
|
78
|
+
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:include_rts => 'true', :count => '200', :max_id => '244102729860009983'})).to have_been_made.times(3)
|
|
79
79
|
end
|
|
80
|
-
it
|
|
80
|
+
it 'returns the 20 most recent retweets posted by the authenticating user' do
|
|
81
81
|
tweets = @client.retweeted_by_me
|
|
82
82
|
expect(tweets).to be_an Array
|
|
83
83
|
expect(tweets.first).to be_a Twitter::Tweet
|
|
84
|
-
expect(tweets.first.text).to eq(
|
|
84
|
+
expect(tweets.first.text).to eq('RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k')
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
87
|
|
|
88
|
-
describe
|
|
88
|
+
describe '#home_timeline' do
|
|
89
89
|
before do
|
|
90
|
-
stub_get(
|
|
90
|
+
stub_get('/1.1/statuses/home_timeline.json').to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
|
91
91
|
end
|
|
92
|
-
it
|
|
92
|
+
it 'requests the correct resource' do
|
|
93
93
|
@client.home_timeline
|
|
94
|
-
expect(a_get(
|
|
94
|
+
expect(a_get('/1.1/statuses/home_timeline.json')).to have_been_made
|
|
95
95
|
end
|
|
96
|
-
it
|
|
96
|
+
it 'returns the 20 most recent Tweets, including retweets if they exist, posted by the authenticating user and the users they follow' do
|
|
97
97
|
tweets = @client.home_timeline
|
|
98
98
|
expect(tweets).to be_an Array
|
|
99
99
|
expect(tweets.first).to be_a Twitter::Tweet
|
|
100
|
-
expect(tweets.first.text).to eq(
|
|
100
|
+
expect(tweets.first.text).to eq('Happy Birthday @imdane. Watch out for those @rally pranksters!')
|
|
101
101
|
end
|
|
102
102
|
end
|
|
103
103
|
|
|
104
|
-
describe
|
|
104
|
+
describe '#retweeted_to_me' do
|
|
105
105
|
before do
|
|
106
|
-
stub_get(
|
|
107
|
-
stub_get(
|
|
106
|
+
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:include_rts => 'true', :count => '200'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
|
107
|
+
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:include_rts => 'true', :count => '200', :max_id => '244102729860009983'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
|
108
108
|
end
|
|
109
|
-
it
|
|
109
|
+
it 'requests the correct resource' do
|
|
110
110
|
@client.retweeted_to_me
|
|
111
|
-
expect(stub_get(
|
|
112
|
-
expect(stub_get(
|
|
111
|
+
expect(stub_get('/1.1/statuses/home_timeline.json').with(:query => {:include_rts => 'true', :count => '200'})).to have_been_made
|
|
112
|
+
expect(stub_get('/1.1/statuses/home_timeline.json').with(:query => {:include_rts => 'true', :count => '200', :max_id => '244102729860009983'})).to have_been_made.times(3)
|
|
113
113
|
end
|
|
114
|
-
it
|
|
114
|
+
it 'returns the 20 most recent retweets posted by users the authenticating user follow' do
|
|
115
115
|
tweets = @client.retweeted_to_me
|
|
116
116
|
expect(tweets).to be_an Array
|
|
117
117
|
expect(tweets.first).to be_a Twitter::Tweet
|
|
118
|
-
expect(tweets.first.text).to eq(
|
|
118
|
+
expect(tweets.first.text).to eq('RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k')
|
|
119
119
|
end
|
|
120
120
|
end
|
|
121
121
|
|
|
122
|
-
describe
|
|
122
|
+
describe '#retweets_of_me' do
|
|
123
123
|
before do
|
|
124
|
-
stub_get(
|
|
124
|
+
stub_get('/1.1/statuses/retweets_of_me.json').to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
|
125
125
|
end
|
|
126
|
-
it
|
|
126
|
+
it 'requests the correct resource' do
|
|
127
127
|
@client.retweets_of_me
|
|
128
|
-
expect(a_get(
|
|
128
|
+
expect(a_get('/1.1/statuses/retweets_of_me.json')).to have_been_made
|
|
129
129
|
end
|
|
130
|
-
it
|
|
130
|
+
it 'returns the 20 most recent tweets of the authenticated user that have been retweeted by others' do
|
|
131
131
|
tweets = @client.retweets_of_me
|
|
132
132
|
expect(tweets).to be_an Array
|
|
133
133
|
expect(tweets.first).to be_a Twitter::Tweet
|
|
134
|
-
expect(tweets.first.text).to eq(
|
|
134
|
+
expect(tweets.first.text).to eq('Happy Birthday @imdane. Watch out for those @rally pranksters!')
|
|
135
135
|
end
|
|
136
136
|
end
|
|
137
137
|
|
|
@@ -3,65 +3,65 @@ require 'helper'
|
|
|
3
3
|
describe Twitter::REST::API::Trends do
|
|
4
4
|
|
|
5
5
|
before do
|
|
6
|
-
@client = Twitter::REST::Client.new(:consumer_key =>
|
|
6
|
+
@client = Twitter::REST::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :access_token => 'AT', :access_token_secret => 'AS')
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe
|
|
10
|
-
context
|
|
9
|
+
describe '#trends' do
|
|
10
|
+
context 'with woeid passed' do
|
|
11
11
|
before do
|
|
12
|
-
stub_get(
|
|
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'})
|
|
13
13
|
end
|
|
14
|
-
it
|
|
15
|
-
@client.trends(
|
|
16
|
-
expect(a_get(
|
|
14
|
+
it 'requests the correct resource' do
|
|
15
|
+
@client.trends(2_487_956)
|
|
16
|
+
expect(a_get('/1.1/trends/place.json').with(:query => {:id => '2487956'})).to have_been_made
|
|
17
17
|
end
|
|
18
|
-
it
|
|
19
|
-
matching_trends = @client.trends(
|
|
18
|
+
it 'returns the top 10 trending topics for a specific WOEID' do
|
|
19
|
+
matching_trends = @client.trends(2_487_956)
|
|
20
20
|
expect(matching_trends).to be_a Twitter::TrendResults
|
|
21
21
|
expect(matching_trends.first).to be_a Twitter::Trend
|
|
22
|
-
expect(matching_trends.first.name).to eq(
|
|
22
|
+
expect(matching_trends.first.name).to eq('#sevenwordsaftersex')
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
|
-
context
|
|
25
|
+
context 'without arguments passed' do
|
|
26
26
|
before do
|
|
27
|
-
stub_get(
|
|
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'})
|
|
28
28
|
end
|
|
29
|
-
it
|
|
29
|
+
it 'requests the correct resource' do
|
|
30
30
|
@client.trends
|
|
31
|
-
expect(a_get(
|
|
31
|
+
expect(a_get('/1.1/trends/place.json').with(:query => {:id => '1'})).to have_been_made
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
describe
|
|
36
|
+
describe '#trends_available' do
|
|
37
37
|
before do
|
|
38
|
-
stub_get(
|
|
38
|
+
stub_get('/1.1/trends/available.json').to_return(:body => fixture('locations.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
|
39
39
|
end
|
|
40
|
-
it
|
|
40
|
+
it 'requests the correct resource' do
|
|
41
41
|
@client.trends_available
|
|
42
|
-
expect(a_get(
|
|
42
|
+
expect(a_get('/1.1/trends/available.json')).to have_been_made
|
|
43
43
|
end
|
|
44
|
-
it
|
|
44
|
+
it 'returns the locations that Twitter has trending topic information for' do
|
|
45
45
|
locations = @client.trends_available
|
|
46
46
|
expect(locations).to be_an Array
|
|
47
47
|
expect(locations.first).to be_a Twitter::Place
|
|
48
|
-
expect(locations.first.name).to eq(
|
|
48
|
+
expect(locations.first.name).to eq('Ireland')
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
-
describe
|
|
52
|
+
describe '#trends_closest' do
|
|
53
53
|
before do
|
|
54
|
-
stub_get(
|
|
54
|
+
stub_get('/1.1/trends/closest.json').to_return(:body => fixture('locations.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
|
55
55
|
end
|
|
56
|
-
it
|
|
56
|
+
it 'requests the correct resource' do
|
|
57
57
|
@client.trends_closest
|
|
58
|
-
expect(a_get(
|
|
58
|
+
expect(a_get('/1.1/trends/closest.json')).to have_been_made
|
|
59
59
|
end
|
|
60
|
-
it
|
|
60
|
+
it 'returns the locations that Twitter has trending topic information for' do
|
|
61
61
|
locations = @client.trends_closest
|
|
62
62
|
expect(locations).to be_an Array
|
|
63
63
|
expect(locations.first).to be_a Twitter::Place
|
|
64
|
-
expect(locations.first.name).to eq(
|
|
64
|
+
expect(locations.first.name).to eq('Ireland')
|
|
65
65
|
end
|
|
66
66
|
end
|
|
67
67
|
|