diff --git a/lib/twitter/search.rb b/lib/twitter/search.rb index 4fee2a549..d4a0b575e 100644 --- a/lib/twitter/search.rb +++ b/lib/twitter/search.rb @@ -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 diff --git a/test/twitter/search_test.rb b/test/twitter/search_test.rb index c92a63e21..bae02df02 100644 --- a/test/twitter/search_test.rb +++ b/test/twitter/search_test.rb @@ -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'})