Skip to content

Commit

Permalink
Allow track() to be passed an array of values
Browse files Browse the repository at this point in the history
- tested and passes
  • Loading branch information
vrish88 committed Feb 18, 2010
1 parent e5ecb9e commit e23e948
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/tweetstream/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions spec/tweetstream/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e23e948

Please sign in to comment.