Permalink
Browse files

Allow track() to be passed an array of values

- tested and passes
  • Loading branch information...
1 parent e5ecb9e commit e23e948b3730b5bb78a552e599df18dbaf6a94c5 @vrish88 vrish88 committed Feb 18, 2010
Showing with 6 additions and 1 deletion.
  1. +1 −1 lib/tweetstream/client.rb
  2. +5 −0 spec/tweetstream/client_spec.rb
@@ -104,7 +104,7 @@ def follow(*user_ids, &block)
def filter(query_params = {}, &block)
[:follow, :track].each do |param|
if query_params[param].is_a?(Array)
- query_params[param] = query_params[param].collect{|q| q.to_s}.join(',')
+ query_params[param] = query_params[param].flatten.collect{|q| q.to_s}.join(',')
elsif query_params[param]
query_params[param] = query_params[param].to_s
end
@@ -176,6 +176,11 @@
@client.track('foo', 'bar', 'baz')
end
+ it '#track should comma-join an array of arguments' do
+ @client.should_receive(:start).once.with('statuses/filter', :track => 'foo,bar,baz', :method => :post)
+ @client.track(['foo','bar','baz'])
+ end
+
it '#follow should make a call to start with "statuses/filter" and a follow query parameter' do
@client.should_receive(:start).once.with('statuses/filter', :follow => '123', :method => :post)
@client.follow(123)

0 comments on commit e23e948

Please sign in to comment.