tweetstream 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of tweetstream might be problematic. Click here for more details.
- data/README.md +12 -11
- data/lib/tweetstream/client.rb +158 -199
- data/lib/tweetstream/version.rb +1 -1
- data/spec/fixtures/delete.json +8 -0
- data/spec/fixtures/favorite.json +150 -0
- data/spec/fixtures/limit.json +5 -0
- data/spec/fixtures/scrub_geo.json +8 -0
- data/spec/fixtures/status_withheld.json +7 -0
- data/spec/fixtures/user_withheld.json +6 -0
- data/spec/spec_helper.rb +10 -12
- data/spec/tweetstream/client_authentication_spec.rb +2 -2
- data/spec/tweetstream/client_site_stream_spec.rb +5 -5
- data/spec/tweetstream/client_spec.rb +52 -63
- data/spec/tweetstream/client_userstream_spec.rb +16 -5
- data/tweetstream.gemspec +1 -1
- metadata +121 -34
data/lib/tweetstream/version.rb
CHANGED
@@ -0,0 +1,150 @@
|
|
1
|
+
{"target":
|
2
|
+
{"id": 598914668,
|
3
|
+
"verified": false,
|
4
|
+
"id_str": "598914668",
|
5
|
+
"profile_background_tile": false,
|
6
|
+
"location": "",
|
7
|
+
"profile_sidebar_fill_color": "DDEEF6",
|
8
|
+
"contributors_enabled": false,
|
9
|
+
"notifications": false,
|
10
|
+
"geo_enabled": false,
|
11
|
+
"profile_image_url_https": "https://si0.twimg.com/profile_images/2276724218/raf46pju0mijc6ixm6ke_normal.jpeg",
|
12
|
+
"utc_offset": null,
|
13
|
+
"default_profile": true,
|
14
|
+
"statuses_count": 151,
|
15
|
+
"name": "dev4sns",
|
16
|
+
"profile_background_color": "C0DEED",
|
17
|
+
"friends_count": 15,
|
18
|
+
"show_all_inline_media": false,
|
19
|
+
"protected": false,
|
20
|
+
"follow_request_sent": false,
|
21
|
+
"screen_name": "dev4sns",
|
22
|
+
"listed_count": 0,
|
23
|
+
"profile_background_image_url": "http://a0.twimg.com/images/themes/theme1/bg.png",
|
24
|
+
"lang": "ko",
|
25
|
+
"profile_link_color": "0084B4",
|
26
|
+
"time_zone": null,
|
27
|
+
"description": "Dev 계정입니다.",
|
28
|
+
"is_translator": false,
|
29
|
+
"profile_use_background_image": true,
|
30
|
+
"url": null,
|
31
|
+
"profile_text_color": "333333",
|
32
|
+
"created_at": "Mon Jun 04 04:07:27 +0000 2012",
|
33
|
+
"default_profile_image": false,
|
34
|
+
"profile_background_image_url_https":
|
35
|
+
"https://si0.twimg.com/images/themes/theme1/bg.png",
|
36
|
+
"favourites_count": 0,
|
37
|
+
"profile_sidebar_border_color": "C0DEED",
|
38
|
+
"profile_image_url":
|
39
|
+
"http://a0.twimg.com/profile_images/2276724218/raf46pju0mijc6ixm6ke_normal.jpeg",
|
40
|
+
"following": true,
|
41
|
+
"followers_count": 5},
|
42
|
+
"target_object":
|
43
|
+
{"id_str": "228029422597443584",
|
44
|
+
"in_reply_to_user_id": null,
|
45
|
+
"truncated": false,
|
46
|
+
"contributors": null,
|
47
|
+
"retweet_count": 0,
|
48
|
+
"possibly_sensitive_editable": true,
|
49
|
+
"favorited": false,
|
50
|
+
"coordinates": null,
|
51
|
+
"geo": null,
|
52
|
+
"possibly_sensitive": false,
|
53
|
+
"user":
|
54
|
+
{"id": 598914668,
|
55
|
+
"verified": false,
|
56
|
+
"id_str": "598914668",
|
57
|
+
"profile_background_tile": false,
|
58
|
+
"location": "",
|
59
|
+
"profile_sidebar_fill_color": "DDEEF6",
|
60
|
+
"contributors_enabled": false,
|
61
|
+
"notifications": false,
|
62
|
+
"geo_enabled": false,
|
63
|
+
"profile_image_url_https":
|
64
|
+
"https://si0.twimg.com/profile_images/2276724218/raf46pju0mijc6ixm6ke_normal.jpeg",
|
65
|
+
"utc_offset": null,
|
66
|
+
"default_profile": true,
|
67
|
+
"statuses_count": 151,
|
68
|
+
"name": "dev4sns",
|
69
|
+
"profile_background_color": "C0DEED",
|
70
|
+
"friends_count": 15,
|
71
|
+
"show_all_inline_media": false,
|
72
|
+
"protected": false,
|
73
|
+
"follow_request_sent": false,
|
74
|
+
"screen_name": "dev4sns",
|
75
|
+
"listed_count": 0,
|
76
|
+
"profile_background_image_url":
|
77
|
+
"http://a0.twimg.com/images/themes/theme1/bg.png",
|
78
|
+
"lang": "ko",
|
79
|
+
"profile_link_color": "0084B4",
|
80
|
+
"time_zone": null,
|
81
|
+
"description": "Dev 계정입니다.",
|
82
|
+
"is_translator": false,
|
83
|
+
"profile_use_background_image": true,
|
84
|
+
"url": null,
|
85
|
+
"profile_text_color": "333333",
|
86
|
+
"created_at": "Mon Jun 04 04:07:27 +0000 2012",
|
87
|
+
"default_profile_image": false,
|
88
|
+
"profile_background_image_url_https":
|
89
|
+
"https://si0.twimg.com/images/themes/theme1/bg.png",
|
90
|
+
"favourites_count": 0,
|
91
|
+
"profile_sidebar_border_color": "C0DEED",
|
92
|
+
"profile_image_url":
|
93
|
+
"http://a0.twimg.com/profile_images/2276724218/raf46pju0mijc6ixm6ke_normal.jpeg",
|
94
|
+
"following": true,
|
95
|
+
"followers_count": 5},
|
96
|
+
"in_reply_to_status_id_str": null,
|
97
|
+
"in_reply_to_screen_name": null,
|
98
|
+
"source": "<a href=\"http://www.a2m.co.kr\" rel=\"nofollow\">Dev Acct</a>",
|
99
|
+
"in_reply_to_user_id_str": null,
|
100
|
+
"retweeted": false,
|
101
|
+
"in_reply_to_status_id": null,
|
102
|
+
"id": 228029422597443584,
|
103
|
+
"place": null,
|
104
|
+
"text": "asdf http://t.co/CRX3fCRa",
|
105
|
+
"created_at": "Wed Jul 25 07:30:25 +0000 2012"},
|
106
|
+
"source":
|
107
|
+
{"id": 459909498,
|
108
|
+
"verified": false,
|
109
|
+
"id_str": "459909498",
|
110
|
+
"profile_background_tile": false,
|
111
|
+
"location": "",
|
112
|
+
"profile_sidebar_fill_color": "DDEEF6",
|
113
|
+
"contributors_enabled": false,
|
114
|
+
"notifications": false,
|
115
|
+
"geo_enabled": false,
|
116
|
+
"profile_image_url_https":
|
117
|
+
"https://si0.twimg.com/sticky/default_profile_images/default_profile_6_normal.png",
|
118
|
+
"utc_offset": null,
|
119
|
+
"default_profile": true,
|
120
|
+
"statuses_count": 124,
|
121
|
+
"name": "Brian Park",
|
122
|
+
"profile_background_color": "C0DEED",
|
123
|
+
"friends_count": 3,
|
124
|
+
"show_all_inline_media": false,
|
125
|
+
"protected": false,
|
126
|
+
"follow_request_sent": false,
|
127
|
+
"screen_name": "bdares",
|
128
|
+
"listed_count": 0,
|
129
|
+
"profile_background_image_url":
|
130
|
+
"http://a0.twimg.com/images/themes/theme1/bg.png",
|
131
|
+
"lang": "en",
|
132
|
+
"profile_link_color": "0084B4",
|
133
|
+
"time_zone": null,
|
134
|
+
"description": "",
|
135
|
+
"is_translator": false,
|
136
|
+
"profile_use_background_image": true,
|
137
|
+
"url": null,
|
138
|
+
"profile_text_color": "333333",
|
139
|
+
"created_at": "Tue Jan 10 05:33:52 +0000 2012",
|
140
|
+
"default_profile_image": true,
|
141
|
+
"profile_background_image_url_https":
|
142
|
+
"https://si0.twimg.com/images/themes/theme1/bg.png",
|
143
|
+
"favourites_count": 14,
|
144
|
+
"profile_sidebar_border_color": "C0DEED",
|
145
|
+
"profile_image_url":
|
146
|
+
"http://a0.twimg.com/sticky/default_profile_images/default_profile_6_normal.png",
|
147
|
+
"following": false,
|
148
|
+
"followers_count": 1},
|
149
|
+
"event": "favorite",
|
150
|
+
"created_at": "Mon Aug 06 02:24:16 +0000 2012"}
|
data/spec/spec_helper.rb
CHANGED
@@ -13,24 +13,22 @@ require 'webmock/rspec'
|
|
13
13
|
require 'yajl'
|
14
14
|
require 'json'
|
15
15
|
|
16
|
+
def samples(fixture)
|
17
|
+
samples = []
|
18
|
+
Yajl::Parser.parse(fixture(fixture), :symbolize_keys => true) do |hash|
|
19
|
+
samples << hash
|
20
|
+
end
|
21
|
+
samples
|
22
|
+
end
|
23
|
+
|
16
24
|
def sample_tweets
|
17
25
|
return @tweets if @tweets
|
18
|
-
|
19
|
-
@tweets = []
|
20
|
-
Yajl::Parser.parse(fixture('statuses.json'), :symbolize_keys => true) do |hash|
|
21
|
-
@tweets << hash
|
22
|
-
end
|
23
|
-
@tweets
|
26
|
+
@tweets = samples('statuses.json')
|
24
27
|
end
|
25
28
|
|
26
29
|
def sample_direct_messages
|
27
30
|
return @direct_messages if @direct_messages
|
28
|
-
|
29
|
-
@direct_messages = []
|
30
|
-
Yajl::Parser.parse(fixture('direct_messages.json'), :symbolize_keys => true) do |hash|
|
31
|
-
@direct_messages << hash
|
32
|
-
end
|
33
|
-
@direct_messages
|
31
|
+
@direct_messages = samples('direct_messages.json')
|
34
32
|
end
|
35
33
|
|
36
34
|
def fixture_path
|
@@ -31,7 +31,7 @@ describe TweetStream::Client do
|
|
31
31
|
|
32
32
|
it 'should try to connect via a JSON stream with basic auth' do
|
33
33
|
EM::Twitter::Client.should_receive(:connect).with(
|
34
|
-
:path =>
|
34
|
+
:path => '/1/statuses/filter.json',
|
35
35
|
:method => 'POST',
|
36
36
|
:user_agent => TweetStream::Configuration::DEFAULT_USER_AGENT,
|
37
37
|
:on_inited => nil,
|
@@ -61,7 +61,7 @@ describe TweetStream::Client do
|
|
61
61
|
|
62
62
|
it 'should try to connect via a JSON stream with oauth' do
|
63
63
|
EM::Twitter::Client.should_receive(:connect).with(
|
64
|
-
:path =>
|
64
|
+
:path => '/1/statuses/filter.json',
|
65
65
|
:method => 'POST',
|
66
66
|
:user_agent => TweetStream::Configuration::DEFAULT_USER_AGENT,
|
67
67
|
:on_inited => nil,
|
@@ -34,27 +34,27 @@ describe TweetStream::Client do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
it "uses the sitestream uri" do
|
37
|
-
|
37
|
+
@client.should_receive(:start).once.with('/2b/site.json', an_instance_of(Hash)).and_return(@stream)
|
38
38
|
@client.sitestream
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'supports "with followings" when followings set as a boolean' do
|
42
|
-
@client.should_receive(:start).once.with('', hash_including(:with => 'followings')).and_return(@stream)
|
42
|
+
@client.should_receive(:start).once.with('/2b/site.json', hash_including(:with => 'followings')).and_return(@stream)
|
43
43
|
@client.sitestream(['115192457'], :followings => true)
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'supports "with followings" when followings set as an option' do
|
47
|
-
@client.should_receive(:start).once.with('', hash_including(:with => 'followings')).and_return(@stream)
|
47
|
+
@client.should_receive(:start).once.with('/2b/site.json', hash_including(:with => 'followings')).and_return(@stream)
|
48
48
|
@client.sitestream(['115192457'], :with => 'followings')
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'supports "with user"' do
|
52
|
-
@client.should_receive(:start).once.with('', hash_including(:with => 'user')).and_return(@stream)
|
52
|
+
@client.should_receive(:start).once.with('/2b/site.json', hash_including(:with => 'user')).and_return(@stream)
|
53
53
|
@client.sitestream(['115192457'], :with => 'user')
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'supports "replies all"' do
|
57
|
-
@client.should_receive(:start).once.with('', hash_including(:replies => 'all')).and_return(@stream)
|
57
|
+
@client.should_receive(:start).once.with('/2b/site.json', hash_including(:replies => 'all')).and_return(@stream)
|
58
58
|
@client.sitestream(['115192457'], :replies => 'all')
|
59
59
|
end
|
60
60
|
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
1
|
describe TweetStream::Client do
|
4
2
|
before(:each) do
|
5
3
|
TweetStream.configure do |config|
|
@@ -11,42 +9,6 @@ describe TweetStream::Client do
|
|
11
9
|
@client = TweetStream::Client.new
|
12
10
|
end
|
13
11
|
|
14
|
-
describe '#build_uri' do
|
15
|
-
it 'should return a URI' do
|
16
|
-
@client.send(:build_uri, '').should be_kind_of(URI)
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should have the specified path with the version prefix and a json extension' do
|
20
|
-
@client.send(:build_uri, 'awesome').path.should == '/1/awesome.json'
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should add on a query string if such parameters are specified' do
|
24
|
-
@client.send(:build_uri, 'awesome', :q => 'abc').query.should == 'q=abc'
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe '#build_post_body' do
|
29
|
-
it 'should return a blank string if passed a nil value' do
|
30
|
-
@client.send(:build_post_body, nil).should == ''
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'should return a blank string if passed an empty hash' do
|
34
|
-
@client.send(:build_post_body, {}).should == ''
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'should add a query parameter for a key' do
|
38
|
-
@client.send(:build_post_body, {:query => 'abc'}).should == 'query=abc'
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'should escape characters in the value' do
|
42
|
-
@client.send(:build_post_body, {:query => 'awesome guy'}).should == 'query=awesome+guy'
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'should join multiple pairs together' do
|
46
|
-
['a=b&c=d','c=d&a=b'].include?(@client.send(:build_post_body, {:a => 'b', :c => 'd'})).should be_true
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
12
|
describe '#start' do
|
51
13
|
before do
|
52
14
|
@stream = stub("EM::Twitter::Client",
|
@@ -76,6 +38,12 @@ describe TweetStream::Client do
|
|
76
38
|
@client.track('abc')
|
77
39
|
end
|
78
40
|
|
41
|
+
it 'warns when callbacks are passed as options' do
|
42
|
+
@stream.stub(:each).and_yield(nil)
|
43
|
+
Kernel.should_receive(:warn).with(/Passing callbacks via the options hash is deprecated and will be removed in TweetStream 3.0/)
|
44
|
+
@client.track('abc', :inited => Proc.new { })
|
45
|
+
end
|
46
|
+
|
79
47
|
describe '#each' do
|
80
48
|
it 'calls the appropriate parser' do
|
81
49
|
@client = TweetStream::Client.new
|
@@ -84,9 +52,9 @@ describe TweetStream::Client do
|
|
84
52
|
@client.track('abc','def')
|
85
53
|
end
|
86
54
|
|
87
|
-
it 'yields a Twitter::
|
55
|
+
it 'yields a Twitter::Tweet' do
|
88
56
|
@stream.should_receive(:each).and_yield(sample_tweets[0].to_json)
|
89
|
-
@client.track('abc'){|s| s.should be_kind_of(Twitter::
|
57
|
+
@client.track('abc'){|s| s.should be_kind_of(Twitter::Tweet)}
|
90
58
|
end
|
91
59
|
|
92
60
|
it 'yields the client if a block with arity 2 is given' do
|
@@ -108,8 +76,7 @@ describe TweetStream::Client do
|
|
108
76
|
end
|
109
77
|
|
110
78
|
it 'should call the on_scrub_geo callback if specified' do
|
111
|
-
|
112
|
-
@stream.should_receive(:each).and_yield(scrub_geo)
|
79
|
+
@stream.should_receive(:each).and_yield(fixture('scrub_geo.json'))
|
113
80
|
@client.on_scrub_geo do |up_to_status_id, user_id|
|
114
81
|
up_to_status_id.should == 9876
|
115
82
|
user_id.should == 1234
|
@@ -117,8 +84,7 @@ describe TweetStream::Client do
|
|
117
84
|
end
|
118
85
|
|
119
86
|
it 'calls the on_delete callback' do
|
120
|
-
|
121
|
-
@stream.should_receive(:each).and_yield(delete)
|
87
|
+
@stream.should_receive(:each).and_yield(fixture('delete.json'))
|
122
88
|
@client.on_delete do |id, user_id|
|
123
89
|
id.should == 1234
|
124
90
|
user_id.should == 3
|
@@ -126,11 +92,33 @@ describe TweetStream::Client do
|
|
126
92
|
end
|
127
93
|
|
128
94
|
it 'calls the on_limit callback' do
|
129
|
-
limit =
|
130
|
-
@stream.should_receive(:each).and_yield(limit)
|
131
|
-
@client.on_limit do |
|
132
|
-
|
95
|
+
limit = nil
|
96
|
+
@stream.should_receive(:each).and_yield(fixture('limit.json'))
|
97
|
+
@client.on_limit do |l|
|
98
|
+
limit = l
|
133
99
|
end.track('abc')
|
100
|
+
|
101
|
+
limit.should eq(1234)
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'calls the on_status_withheld callback' do
|
105
|
+
status = nil
|
106
|
+
@stream.should_receive(:each).and_yield(fixture('status_withheld.json'))
|
107
|
+
@client.on_status_withheld do |s|
|
108
|
+
status = s
|
109
|
+
end.track('abc')
|
110
|
+
|
111
|
+
status[:user_id].should eq(123456)
|
112
|
+
end
|
113
|
+
|
114
|
+
it 'calls the on_user_withheld callback' do
|
115
|
+
status = nil
|
116
|
+
@stream.should_receive(:each).and_yield(fixture('user_withheld.json'))
|
117
|
+
@client.on_user_withheld do |s|
|
118
|
+
status = s
|
119
|
+
end.track('abc')
|
120
|
+
|
121
|
+
status[:id].should eq(123456)
|
134
122
|
end
|
135
123
|
|
136
124
|
context "using on_anything" do
|
@@ -138,11 +126,12 @@ describe TweetStream::Client do
|
|
138
126
|
hash = {:id => 1234}
|
139
127
|
@stream.should_receive(:each).and_yield(hash.to_json)
|
140
128
|
yielded_hash = nil
|
141
|
-
@client.on_anything do |
|
142
|
-
yielded_hash =
|
129
|
+
@client.on_anything do |h|
|
130
|
+
yielded_hash = h
|
143
131
|
end.track('abc')
|
132
|
+
|
144
133
|
yielded_hash.should_not be_nil
|
145
|
-
yielded_hash[:id].should
|
134
|
+
yielded_hash[:id].should eq(1234)
|
146
135
|
end
|
147
136
|
it 'yields itself if block has an arity of 2' do
|
148
137
|
hash = {:id => 1234}
|
@@ -244,7 +233,7 @@ describe TweetStream::Client do
|
|
244
233
|
describe '#on_max_reconnects' do
|
245
234
|
it 'should raise a ReconnectError' do
|
246
235
|
@stream.should_receive(:on_max_reconnects).and_yield(30, 20)
|
247
|
-
lambda{@client.track('abc')}.should raise_error(TweetStream::ReconnectError, "Failed to reconnect after 20 tries.")
|
236
|
+
lambda{ @client.track('abc') }.should raise_error(TweetStream::ReconnectError, "Failed to reconnect after 20 tries.")
|
248
237
|
end
|
249
238
|
end
|
250
239
|
end
|
@@ -252,64 +241,64 @@ describe TweetStream::Client do
|
|
252
241
|
describe 'API methods' do
|
253
242
|
%w(firehose retweet sample links).each do |method|
|
254
243
|
it "##{method} should make a call to start with \"statuses/#{method}\"" do
|
255
|
-
@client.should_receive(:start).once.with('statuses/' + method, {})
|
244
|
+
@client.should_receive(:start).once.with('/1/statuses/' + method + '.json', {})
|
256
245
|
@client.send(method)
|
257
246
|
end
|
258
247
|
end
|
259
248
|
|
260
249
|
describe '#filter' do
|
261
250
|
it 'makes a call to "statuses/filter" with the query params provided' do
|
262
|
-
@client.should_receive(:start).once.with('statuses/filter', :follow => 123, :method => :post)
|
251
|
+
@client.should_receive(:start).once.with('/1/statuses/filter.json', :follow => 123, :method => :post)
|
263
252
|
@client.filter(:follow => 123)
|
264
253
|
end
|
265
254
|
it 'makes a call to "statuses/filter" with the query params provided longitude/latitude pairs, separated by commas ' do
|
266
|
-
@client.should_receive(:start).once.with('statuses/filter', :locations => '-122.75,36.8,-121.75,37.8,-74,40,-73,41', :method => :post)
|
255
|
+
@client.should_receive(:start).once.with('/1/statuses/filter.json', :locations => '-122.75,36.8,-121.75,37.8,-74,40,-73,41', :method => :post)
|
267
256
|
@client.filter(:locations => '-122.75,36.8,-121.75,37.8,-74,40,-73,41')
|
268
257
|
end
|
269
258
|
end
|
270
259
|
|
271
260
|
describe '#follow' do
|
272
261
|
it 'makes a call to start with "statuses/filter" and a follow query parameter' do
|
273
|
-
@client.should_receive(:start).once.with('statuses/filter', :follow => [123], :method => :post)
|
262
|
+
@client.should_receive(:start).once.with('/1/statuses/filter.json', :follow => [123], :method => :post)
|
274
263
|
@client.follow(123)
|
275
264
|
end
|
276
265
|
|
277
266
|
it 'comma-joins multiple arguments' do
|
278
|
-
@client.should_receive(:start).once.with('statuses/filter', :follow => [123,456], :method => :post)
|
267
|
+
@client.should_receive(:start).once.with('/1/statuses/filter.json', :follow => [123,456], :method => :post)
|
279
268
|
@client.follow(123, 456)
|
280
269
|
end
|
281
270
|
end
|
282
271
|
|
283
272
|
describe '#locations' do
|
284
273
|
it 'should call #start with "statuses/filter" with the query params provided longitude/latitude pairs' do
|
285
|
-
@client.should_receive(:start).once.with('statuses/filter', :locations => ['-122.75,36.8,-121.75,37.8,-74,40,-73,41'], :method => :post)
|
274
|
+
@client.should_receive(:start).once.with('/1/statuses/filter.json', :locations => ['-122.75,36.8,-121.75,37.8,-74,40,-73,41'], :method => :post)
|
286
275
|
@client.locations('-122.75,36.8,-121.75,37.8,-74,40,-73,41')
|
287
276
|
end
|
288
277
|
|
289
278
|
it 'should call #start with "statuses/filter" with the query params provided longitude/latitude pairs and additional filter' do
|
290
|
-
@client.should_receive(:start).once.with('statuses/filter', :locations => ['-122.75,36.8,-121.75,37.8,-74,40,-73,41'], :track => 'rock', :method => :post)
|
279
|
+
@client.should_receive(:start).once.with('/1/statuses/filter.json', :locations => ['-122.75,36.8,-121.75,37.8,-74,40,-73,41'], :track => 'rock', :method => :post)
|
291
280
|
@client.locations('-122.75,36.8,-121.75,37.8,-74,40,-73,41', :track => 'rock')
|
292
281
|
end
|
293
282
|
end
|
294
283
|
|
295
284
|
describe '#track' do
|
296
285
|
it 'makes a call to start with "statuses/filter" and a track query parameter' do
|
297
|
-
@client.should_receive(:start).once.with('statuses/filter', :track => ['test'], :method => :post)
|
286
|
+
@client.should_receive(:start).once.with('/1/statuses/filter.json', :track => ['test'], :method => :post)
|
298
287
|
@client.track('test')
|
299
288
|
end
|
300
289
|
|
301
290
|
it 'comma-joins multiple arguments' do
|
302
|
-
@client.should_receive(:start).once.with('statuses/filter', :track => ['foo', 'bar', 'baz'], :method => :post)
|
291
|
+
@client.should_receive(:start).once.with('/1/statuses/filter.json', :track => ['foo', 'bar', 'baz'], :method => :post)
|
303
292
|
@client.track('foo', 'bar', 'baz')
|
304
293
|
end
|
305
294
|
|
306
295
|
it 'comma-joins an array of arguments' do
|
307
|
-
@client.should_receive(:start).once.with('statuses/filter', :track => [['foo','bar','baz']], :method => :post)
|
296
|
+
@client.should_receive(:start).once.with('/1/statuses/filter.json', :track => [['foo','bar','baz']], :method => :post)
|
308
297
|
@client.track(['foo','bar','baz'])
|
309
298
|
end
|
310
299
|
|
311
300
|
it 'should call #start with "statuses/filter" and the provided queries' do
|
312
|
-
@client.should_receive(:start).once.with('statuses/filter', :track => ['rock'], :method => :post)
|
301
|
+
@client.should_receive(:start).once.with('/1/statuses/filter.json', :track => ['rock'], :method => :post)
|
313
302
|
@client.track('rock')
|
314
303
|
end
|
315
304
|
end
|