<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/json/trends.json</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -84,7 +84,7 @@ Dustin Sallings, Dan Croak, Luke Francl, Matt Sanford, Alejandro Crosa, Danny Bu
 
 ## Resources
 
-* [Official Twitter Search API](http://search.twitter.com/api)
+* [Official Twitter Search API](http://apiwiki.twitter.com/Twitter-API-Documentation)
 
 ## License
 </diff>
      <filename>README.markdown</filename>
    </modified>
    <modified>
      <diff>@@ -3,7 +3,7 @@ module TwitterSearch
     VARS = [ :query, :name ]
     attr_reader *VARS
     attr_reader :exclude_hashtags
-    
+
     def initialize(opts)
       @exclude_hashtags = !!opts['exclude_hashtags']
       VARS.each { |each| instance_variable_set &quot;@#{each}&quot;, opts[each.to_s] }
@@ -28,9 +28,9 @@ module TwitterSearch
     def size
       @trends.size
     end
-    
+
     def [](index)
       @trends[index]
     end
   end
-end
\ No newline at end of file
+end</diff>
      <filename>lib/trends.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,25 +7,24 @@ require File.join(File.dirname(__FILE__), 'tweets')
 require File.join(File.dirname(__FILE__), 'trends')
 
 module TwitterSearch
-
   class Client
     TWITTER_SEARCH_API_URL = 'http://search.twitter.com/search.json'
     TWITTER_TRENDS_API_URL = 'http://search.twitter.com/trends/current.json'
-    TWITTER_API_DEFAULT_TIMEOUT = 5
-    
+    DEFAULT_TIMEOUT = 5
+
     attr_accessor :agent
     attr_accessor :timeout
-    
-    def initialize(agent = 'twitter-search', timeout = TWITTER_API_DEFAULT_TIMEOUT)
+
+    def initialize(agent = 'twitter-search', timeout = DEFAULT_TIMEOUT)
       @agent = agent
       @timeout = timeout
     end
-    
+
     def headers
       { &quot;Content-Type&quot; =&gt; 'application/json',
         &quot;User-Agent&quot;   =&gt; @agent }
     end
-    
+
     def query(opts = {})
       url       = URI.parse(TWITTER_SEARCH_API_URL)
       url.query = sanitize_query(opts)
@@ -33,15 +32,15 @@ module TwitterSearch
       req  = Net::HTTP::Get.new(url.path)
       http = Net::HTTP.new(url.host, url.port)
       http.read_timeout = timeout
-      
+
       json = http.start { |http|
         http.get(&quot;#{url.path}?#{url.query}&quot;, headers)
       }.body
       Tweets.new JSON.parse(json)
     end
-    
+
     def trends(opts = {})
-      url       = URI.parse(TWITTER_TRENDS_API_URL)
+      url = URI.parse(TWITTER_TRENDS_API_URL)
       if opts['exclude_hashtags']
         url.query = sanitize_query_hash({ :exclude_hashtags =&gt; opts['exclude_hashtags'] })
       end
@@ -49,7 +48,7 @@ module TwitterSearch
       req  = Net::HTTP::Get.new(url.path)
       http = Net::HTTP.new(url.host, url.port)
       http.read_timeout = timeout
-      
+
       json = http.start { |http|
         http.get(&quot;#{url.path}?#{url.query}&quot;, headers)
       }.body
@@ -60,18 +59,18 @@ module TwitterSearch
 
       def sanitize_query(opts)
         if opts.is_a? String
-          &quot;q=#{CGI.escape(opts)}&quot; 
+          &quot;q=#{CGI.escape(opts)}&quot;
         elsif opts.is_a? Hash
           &quot;#{sanitize_query_hash(opts)}&quot;
         end
       end
 
       def sanitize_query_hash(query_hash)
-        query_hash.collect { |key, value| 
-          &quot;#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}&quot; 
+        query_hash.collect { |key, value|
+          &quot;#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}&quot;
         }.join('&amp;')
       end
-  
+
   end
 
 end</diff>
      <filename>lib/twitter_search.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,42 +4,56 @@ require 'rubygems'
 require 'shoulda'
 require 'yaml'
 
+class String
+  def /(other)
+    File.join(self, other)
+  end
+end
+
+class File
+  def self.here
+    dirname(__FILE__)
+  end
+end
+
 class Test::Unit::TestCase
-  
+
   def self.should_have_default_search_behaviors
     should_find_tweets
     should_have_text_for_all_tweets
     should_return_page 1
     should_return_tweets_in_sets_of 15
   end
-  
+
   def self.should_find_tweets
     should 'find tweets' do
       assert @tweets.any?
     end
   end
-  
+
   def self.should_have_text_for_all_tweets
     should 'have text for all tweets' do
       assert @tweets.all? { |tweet| tweet.text.size &gt; 0 }
     end
   end
-  
+
   def self.should_return_page(number)
     should &quot;return page #{number}&quot; do
       assert_equal number, @tweets.page
     end
   end
-  
+
   def self.should_return_tweets_in_sets_of(number)
     should &quot;return tweets in sets of #{number}&quot; do
       assert_equal number, @tweets.results_per_page
     end
   end
-  
+
   def read_yaml(opts = {})
-    return if opts[:file].nil?
-    YAML.load_file File.join(File.dirname(__FILE__), 'yaml', &quot;#{opts[:file]}.yaml&quot;) 
+    if opts[:file].nil?
+      raise ArgumentError
+    end
+    YAML.load_file(File.here / 'yaml' / &quot;#{opts[:file]}.yaml&quot;)
   end
-  
-end
\ No newline at end of file
+
+end</diff>
      <filename>test/test_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -13,9 +13,9 @@ class TwitterSearchTest &lt; Test::Unit::TestCase # :nodoc:
     setup do
       @tweets = read_yaml :file =&gt; 'obama'
     end
-    
+
     should_have_default_search_behaviors
-    
+
     should 'find tweets containing the single word &quot;Obama&quot;' do
       assert @tweets.all? { |tweet| tweet.text =~ /obama/i }
     end
@@ -46,7 +46,7 @@ class TwitterSearchTest &lt; Test::Unit::TestCase # :nodoc:
   end
 
   # TWITTER SEARCH OPERATORS
-  
+
   context '@client.query :q =&gt; \'&quot;happy hour&quot;\'' do
     setup do
       @tweets = read_yaml :file =&gt; 'happy_hour_exact'
@@ -58,7 +58,7 @@ class TwitterSearchTest &lt; Test::Unit::TestCase # :nodoc:
       assert @tweets.all?{ |t| t.text =~ /happy hour/i }
     end
   end
-  
+
   context &quot;@client.query :q =&gt; 'obama OR hillary'&quot; do
     setup do
       @tweets = read_yaml :file =&gt; 'obama_or_hillary'
@@ -70,7 +70,7 @@ class TwitterSearchTest &lt; Test::Unit::TestCase # :nodoc:
       assert @tweets.all?{ |t| t.text =~ /obama/i || t.text =~ /hillary/i }
     end
   end
-  
+
   context &quot;@client.query :q =&gt; 'beer -root'&quot; do
     setup do
       @tweets = read_yaml :file =&gt; 'beer_minus_root'
@@ -82,7 +82,7 @@ class TwitterSearchTest &lt; Test::Unit::TestCase # :nodoc:
       assert @tweets.all?{ |t| t.text =~ /beer/i || t.text !~ /root/i }
     end
   end
-  
+
   context &quot;@client.query :q =&gt; '#haiku'&quot; do
     setup do
       @tweets = read_yaml :file =&gt; 'hashtag_haiku'
@@ -94,7 +94,7 @@ class TwitterSearchTest &lt; Test::Unit::TestCase # :nodoc:
       assert @tweets.all?{ |t| t.text =~ /#haiku/i }
     end
   end
-  
+
   context &quot;@client.query :q =&gt; 'from: alexiskold'&quot; do
     setup do
       @tweets = read_yaml :file =&gt; 'from_alexiskold'
@@ -106,7 +106,7 @@ class TwitterSearchTest &lt; Test::Unit::TestCase # :nodoc:
       assert @tweets.all?{ |t| t.from_user == 'alexiskold' }
     end
   end
-  
+
   context &quot;@client.query :q =&gt; 'to:techcrunch'&quot; do
     setup do
       @tweets = read_yaml :file =&gt; 'to_techcrunch'
@@ -118,7 +118,7 @@ class TwitterSearchTest &lt; Test::Unit::TestCase # :nodoc:
       assert @tweets.all?{ |t| t.text =~ /^@techcrunch/i }
     end
   end
-  
+
   context &quot;@client.query :q =&gt; '@mashable'&quot; do
     setup do
       @tweets = read_yaml :file =&gt; 'reference_mashable'
@@ -130,7 +130,7 @@ class TwitterSearchTest &lt; Test::Unit::TestCase # :nodoc:
       assert @tweets.all?{ |t| t.text =~ /@mashable/i }
     end
   end
-  
+
   context &quot;@client.query :q =&gt; '\&quot;happy hour\&quot; near:\&quot;san francisco\&quot;'&quot; do
     setup do
       @tweets = read_yaml :file =&gt; 'happy_hour_near_sf'
@@ -141,7 +141,7 @@ class TwitterSearchTest &lt; Test::Unit::TestCase # :nodoc:
       assert ! @tweets.any?
     end
   end
-  
+
   context &quot;@client.query :q =&gt; 'near:NYC within:15mi'&quot; do
     setup do
       @tweets = read_yaml :file =&gt; 'within_15mi_nyc'
@@ -152,7 +152,7 @@ class TwitterSearchTest &lt; Test::Unit::TestCase # :nodoc:
       assert ! @tweets.any?
     end
   end
-  
+
   context &quot;@client.query :q =&gt; 'superhero since:2008-05-01'&quot; do
     setup do
       @tweets = read_yaml :file =&gt; 'superhero_since'
@@ -164,7 +164,7 @@ class TwitterSearchTest &lt; Test::Unit::TestCase # :nodoc:
       assert @tweets.all?{ |t| t.text =~ /superhero/i &amp;&amp; convert_date(t.created_at) &gt; DateTime.new(2008, 5, 1) }
     end
   end
-  
+
   context &quot;@client.query :q =&gt; 'ftw until:2008-05-03'&quot; do
     setup do
       @tweets = read_yaml :file =&gt; 'ftw_until'
@@ -176,7 +176,7 @@ class TwitterSearchTest &lt; Test::Unit::TestCase # :nodoc:
       assert @tweets.all?{ |t| t.text =~ /ftw/i &amp;&amp; convert_date(t.created_at) &lt; DateTime.new(2008, 5, 3, 11, 59) }
     end
   end
-  
+
   context &quot;@client.query :q =&gt; 'movie -scary :)'&quot; do
     setup do
       @tweets = read_yaml :file =&gt; 'movie_positive_tude'
@@ -188,7 +188,7 @@ class TwitterSearchTest &lt; Test::Unit::TestCase # :nodoc:
       assert @tweets.all?{ |t| t.text =~ /movie/i &amp;&amp; t.text !~ /scary/i &amp;&amp; positive_attitude?(t.text) }
     end
   end
-  
+
   context &quot;@client.query :q =&gt; 'flight :('&quot; do
     setup do
       @tweets = read_yaml :file =&gt; 'flight_negative_tude'
@@ -200,7 +200,7 @@ class TwitterSearchTest &lt; Test::Unit::TestCase # :nodoc:
       assert @tweets.all?{ |t| t.text =~ /flight/i &amp;&amp; negative_attitude?(t.text) }
     end
   end
-  
+
   context &quot;@client.query :q =&gt; 'traffic ?'&quot; do
     setup do
       @tweets = read_yaml :file =&gt; 'traffic_question'
@@ -212,7 +212,7 @@ class TwitterSearchTest &lt; Test::Unit::TestCase # :nodoc:
       assert @tweets.all?{ |t| t.text =~ /traffic/i &amp;&amp; t.text.include?('?') }
     end
   end
-  
+
   context &quot;@client.query :q =&gt; 'hilarious filter:links'&quot; do
     setup do
       @tweets = read_yaml :file =&gt; 'hilarious_links'
@@ -224,138 +224,134 @@ class TwitterSearchTest &lt; Test::Unit::TestCase # :nodoc:
       assert @tweets.all?{ |t| t.text =~ /hilarious/i &amp;&amp; hyperlinks?(t.text) }
     end
   end
-  
+
   # USER AGENT
-  
+
   context &quot;A new Client instance&quot; do
     setup do
       @client = TwitterSearch::Client.new
     end
-    
+
     should 'respond to user agent' do
       assert_respond_to @client, :agent
     end
-    
+
     should 'set a default user agent' do
       assert_equal @client.headers['User-Agent'], &quot;twitter-search&quot;
       assert_equal @client.agent, &quot;twitter-search&quot;
     end
-    
+
     should 'set a default timeout for the http request' do
-      assert_equal @client.timeout, TwitterSearch::Client::TWITTER_API_DEFAULT_TIMEOUT
+      assert_equal @client.timeout, TwitterSearch::Client::DEFAULT_TIMEOUT
     end
   end
-  
+
   # FOREIGN LANGUAGES
-  
+
   context &quot;@client.query :q =&gt; 'congratulations', :lang =&gt; 'en'&quot; do
     setup do
       @tweets = read_yaml :file =&gt; 'english'
     end
-    
+
     should_have_default_search_behaviors
-    
+
     should 'find tweets containing &quot;congratulations&quot; and are in English' do
       assert @tweets.all?{ |t| t.text =~ /congratulation/i &amp;&amp; t.language == 'en' }
     end
   end
-  
+
   context &quot;@client.query :q =&gt; '&#1576;&#1575;', :lang =&gt; 'ar'&quot; do
     setup do
       @tweets = read_yaml :file =&gt; 'arabic'
     end
-    
+
     should_have_default_search_behaviors
-    
+
     should 'find tweets containing &quot;&#1576;&#1575;&quot; and are in Arabic' do
       assert @tweets.all?{ |t| t.text.include?('&#1576;&#1575;') &amp;&amp; t.language == 'ar' }
     end
   end
 
   # PAGINATION
-  
+
   context &quot;@client.query :q =&gt; 'Boston Celtics', :rpp =&gt; '30'&quot; do
     setup do
       @tweets = read_yaml :file =&gt; 'results_per_page'
     end
 
-
     should_find_tweets
     should_have_text_for_all_tweets
     should_return_page 1
     should_return_tweets_in_sets_of 30
   end
 
-  context &quot;@client.query :q =&gt; 'a Google(or is it Twitter)whack', :rpp =&gt; '2'&quot; do
+  context &quot;@client.query :q =&gt; 'a Google(or Twitter)whack', :rpp =&gt; '2'&quot; do
     setup do
       @tweets = read_yaml :file =&gt; 'only_one_result'
     end
 
     should 'not be able to get next page of @tweets' do
       assert ! @tweets.has_next_page?
-      #assert_raise Exception, @tweets.next_page
     end
   end
 
-  context &quot;@client.query :q =&gt; 'almost a Google(or is it Twitter)whack', :rpp =&gt; '1'&quot; do
+  context &quot;@client.query :q =&gt; 'almost Google(or Twitter)whack', :rpp =&gt; '1'&quot; do
     setup do
-      @tweets = read_yaml :file =&gt; 'only_two_results'
-      @next_page_of_tweets = read_yaml :file =&gt; 'only_two_results_page_2'
+      @page_one = read_yaml :file =&gt; 'only_two_results'
+      @page_two = read_yaml :file =&gt; 'only_two_results_page_2'
     end
 
     should 'be able to get next page of @tweets' do
-      assert @tweets.has_next_page?
+      assert @page_one.has_next_page?
 
       FakeWeb.register_uri( :get,
                             &quot;#{TwitterSearch::Client::TWITTER_SEARCH_API_URL}?max_id=100&amp;q=almost+a+Google%28or+is+it+Twitter%29whack&amp;rpp=1&amp;page=2&quot;,
                             :string =&gt; '{&quot;results&quot;:[{&quot;text&quot;:&quot;Boston Celtics-Los Angeles Lakers, Halftime http://tinyurl.com/673s24&quot;,&quot;from_user&quot;:&quot;nbatube&quot;,&quot;id&quot;:858836387,&quot;language&quot;:&quot;en&quot;,&quot;created_at&quot;:&quot;Tue, 15 Jul 2008 09:27:57 +0000&quot;}],&quot;since_id&quot;:0,&quot;max_id&quot;:100,&quot;results_per_page&quot;:1,&quot;page&quot;:2,&quot;query&quot;:&quot;almost+a+Google%28or+is+it+Twitter%29whack&quot;}'
                           )
-      next_page = @tweets.get_next_page
-      # It's hard to muck around with objects' .id fields in Ruby, so check other fields instead:
-      assert_equal @next_page_of_tweets[0].created_at, next_page[0].created_at
-      assert_equal @next_page_of_tweets[0].text, next_page[0].text
+      next_page = @page_one.get_next_page
+      assert_equal @page_two[0].created_at, next_page[0].created_at
+      assert_equal @page_two[0].text,       next_page[0].text
     end
   end
 
-
   # HELPERS
-  
+
   context &quot;@tweets[2]&quot; do
     setup do
       @tweets = read_yaml :file =&gt; 'reference_mashable'
     end
-    
+
     should_have_default_search_behaviors
-    
+
     should 'return the third tweet' do
       assert_equal 859152168, @tweets[2].id
     end
   end
 
   protected
-  
+
     def convert_date(date)
       date = date.split(' ')
       DateTime.new(date[3].to_i, convert_month(date[2]), date[1].to_i)
     end
-  
+
     def convert_month(str)
       months = { 'Jan' =&gt; 1, 'Feb' =&gt; 2, 'Mar' =&gt; 3, 'Apr' =&gt; 4,
                  'May' =&gt; 5, 'Jun' =&gt; 6, 'Jul' =&gt; 7, 'Aug' =&gt; 8,
                  'Sep' =&gt; 9, 'Oct' =&gt; 10, 'Nov' =&gt; 11, 'Dec' =&gt; 12 }
       months[str]
     end
-  
-    def positive_attitude?(str)
-      str.include?(':)') || str.include?('=)') || str.include?(':-)') || str.include?(':D')
+
+    def positive_attitude?(string)
+      [&quot;:)&quot;, &quot;=)&quot;, &quot;:-)&quot;, &quot;:D&quot;].any? { |emoticon| string.include?(emoticon) }
     end
-    
-    def negative_attitude?(str)
-      str.include?(':(') || str.include?('=(') || str.include?(':-(') || str.include?(':P')
+
+    def negative_attitude?(string)
+      [&quot;:(&quot;, &quot;=(&quot;, &quot;:-(&quot;, &quot;:P&quot;].any? { |emoticon| string.include?(emoticon) }
     end
-    
+
     def hyperlinks?(str)
       str.include?('http://') || str.include?('https://')
     end
-  
+
 end</diff>
      <filename>test/twitter_search_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -9,9 +9,9 @@ class TwitterSearchTrendsTest &lt; Test::Unit::TestCase # :nodoc:
     setup do
       @trends = read_yaml :file =&gt; 'trends'
     end
-    
+
     should 'find a single trend' do
       assert_equal 1, @trends.size
     end
   end
-end
\ No newline at end of file
+end</diff>
      <filename>test/twitter_search_trends_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>a05f81da006560970ec562be5011bfe4e5e002f0</id>
    </parent>
  </parents>
  <author>
    <name>Dan Croak</name>
    <email>dcroak@thoughtbot.com</email>
  </author>
  <url>http://github.com/dancroak/twitter-search/commit/997c8ee60f8510f93e9dfc6e3cbfb909554da310</url>
  <id>997c8ee60f8510f93e9dfc6e3cbfb909554da310</id>
  <committed-date>2009-05-16T10:25:54-07:00</committed-date>
  <authored-date>2009-05-16T10:25:54-07:00</authored-date>
  <message>refactoring test suite</message>
  <tree>35a3e5da700fd03acaed253968480cb66b69ac3a</tree>
  <committer>
    <name>Dan Croak</name>
    <email>dcroak@thoughtbot.com</email>
  </committer>
</commit>
