Skip to content

Commit

Permalink
Add locale method to Search class
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Sep 24, 2010
1 parent afed8b5 commit 584bcf9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/twitter/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ def lang(lang)
self
end

def locale(locale)
@query[:locale] = locale
self
end

# popular|recent
def result_type(result_type)
@query[:result_type] = result_type
Expand Down
6 changes: 6 additions & 0 deletions test/twitter/search_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ class SearchTest < Test::Unit::TestCase
@search.fetch()
end

should "be able to specify the locale" do
stub_get("http://search.twitter.com/search.json?q=&locale=ja", "search.json")
@search.locale('ja')
@search.fetch()
end

should "be able to specify the number of results per page" do
@search.per_page(25)
@search.class.expects(:get).with('http://search.twitter.com/search.json', :query => {:rpp => 25, :q => ''}, :format => :json, :headers => {'User-Agent' => 'Ruby Twitter Gem'}).returns({'foo' => 'bar'})
Expand Down

0 comments on commit 584bcf9

Please sign in to comment.