<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,8 @@
+== 2.0 / June 24, 2008
+
+* Slim down assert_select_in based on http://gist.github.com/52976 by TJ Stankus
+
+
 == 1.0 / June 24, 2008
 
 * Initial Release</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 name: Helper Me Test
 author: Brian Landau
 company: Viget Labs
-version: 1.0
+version: 2.0
 description: Providing quick and easy ways to create and write tests for your Rails helpers.
 url: http://github.com/vigetlabs/helper_me_test
 install: git://github.com/vigetlabs/helper_me_test.git</diff>
      <filename>about.yml</filename>
    </modified>
    <modified>
      <diff>@@ -3,7 +3,7 @@ require 'action_controller'
 require 'action_view'
 require 'action_view/test_case'
 require 'rexml/document'
-require 'html/document'
+require 'action_controller/vendor/html-scanner'
 
 begin
   require 'hpricot'
@@ -248,125 +248,8 @@ module HelperMeTest
           target = args.shift
           root = HTML::Document.new(target, false, false).root
         end
-        
-        # Then get mandatory selector.
-        arg = args.shift
-        
-        # string and we pass all remaining arguments.
-        # Array and we pass the argument. Also accepts selector itself.
-        case arg
-          when String
-            selector = HTML::Selector.new(arg, args)
-          when Array
-            selector = HTML::Selector.new(*arg)
-          when HTML::Selector
-            selector = arg
-          else raise ArgumentError, &quot;Expecting a selector as the first argument&quot;
-        end
-        
-        # Next argument is used for equality tests.
-        equals = {}
-        case arg = args.shift
-          when Hash
-            equals = arg
-          when String, Regexp
-            equals[:text] = arg
-          when Integer
-            equals[:count] = arg
-          when Range
-            equals[:minimum] = arg.begin
-            equals[:maximum] = arg.end
-          when FalseClass
-            equals[:count] = 0
-          when NilClass, TrueClass
-            equals[:minimum] = 1
-          else raise ArgumentError, &quot;I don't understand what you're trying to match&quot;
-        end
-
-        # By default we're looking for at least one match.
-        if equals[:count]
-          equals[:minimum] = equals[:maximum] = equals[:count]
-        else
-          equals[:minimum] = 1 unless equals[:minimum]
-        end
-
-        # Last argument is the message we use if the assertion fails.
-        message = args.shift
-        #- message = &quot;No match made with selector #{selector.inspect}&quot; unless message
-        if args.shift
-          raise ArgumentError, &quot;Not expecting that last argument, you either have too many arguments, or they're the wrong type&quot;
-        end
-        
-        matches = selector.select(root)
-        
-        # If text/html, narrow down to those elements that match it.
-        content_mismatch = nil
-        if match_with = equals[:text]
-          matches.delete_if do |match|
-            text = &quot;&quot;
-            text.force_encoding(match_with.encoding) if text.respond_to?(:force_encoding)
-            stack = match.children.reverse
-            while node = stack.pop
-              if node.tag?
-                stack.concat node.children.reverse
-              else
-                content = node.content
-                content.force_encoding(match_with.encoding) if content.respond_to?(:force_encoding)
-                text &lt;&lt; content
-              end
-            end
-            text.strip! unless NO_STRIP.include?(match.name)
-            unless match_with.is_a?(Regexp) ? (text =~ match_with) : (text == match_with.to_s)
-              content_mismatch ||= build_message(message, &quot;&lt;?&gt; expected but was\n&lt;?&gt;.&quot;, match_with, text)
-              true
-            end
-          end
-        elsif match_with = equals[:html]
-          matches.delete_if do |match|
-            html = match.children.map(&amp;:to_s).join
-            html.strip! unless NO_STRIP.include?(match.name)
-            unless match_with.is_a?(Regexp) ? (html =~ match_with) : (html == match_with.to_s)
-              content_mismatch ||= build_message(message, &quot;&lt;?&gt; expected but was\n&lt;?&gt;.&quot;, match_with, html)
-              true
-            end
-          end
-        end
-        # Expecting foo found bar element only if found zero, not if
-        # found one but expecting two.
-        message ||= content_mismatch if matches.empty?
-        # Test minimum/maximum occurrence.
-        min, max = equals[:minimum], equals[:maximum]
-        message = message || %(Expected #{count_description(min, max)} matching &quot;#{selector.to_s}&quot;, found #{matches.size}.)
-        assert matches.size &gt;= min, message if min
-        assert matches.size &lt;= max, message if max
-        
-        # If a block is given call that block. Set @selected to allow
-        # nested assert_select, which can be nested several levels deep.
-        if block_given? &amp;&amp; !matches.empty?
-          begin
-            in_scope, @selected = @selected, matches
-            yield matches
-          ensure
-            @selected = in_scope
-          end
-        end
-
-        # Returns all matches elements.
-        matches
+        assert_select(*args.unshift(root), &amp;block)
       end
-      
-      private
-        def count_description(min, max) #:nodoc:
-          pluralize = lambda {|word, quantity| word &lt;&lt; (quantity == 1 ? '' : 's')}
-
-          if min &amp;&amp; max &amp;&amp; (max != min)
-            &quot;between #{min} and #{max} elements&quot;
-          elsif min &amp;&amp; !(min == 1 &amp;&amp; max == 1)
-            &quot;at least #{min} #{pluralize['element', min]}&quot;
-          elsif max
-            &quot;at most #{max} #{pluralize['element', max]}&quot;
-          end
-        end
     end
     
   end</diff>
      <filename>lib/helper_me_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -8,7 +8,7 @@ require 'active_support'
 require 'active_support/test_case'
 require File.join(PLUGIN_ROOT, 'lib/helper_me_test.rb')
 
-class TagAssertionsTest &lt; ActiveSupport::TestCase
+class TagAssertionsTest &lt; ActionView::TestCase
   include HelperMeTest::Assertions::TagAssertions
   
   context 'testing with assert_tag_* statements' do
@@ -40,7 +40,7 @@ class TagAssertionsTest &lt; ActiveSupport::TestCase
 end
 
 
-class HpricotAssertionsTest &lt; ActiveSupport::TestCase
+class HpricotAssertionsTest &lt; ActionView::TestCase
   include HelperMeTest::Assertions::HpricotAssertions
   
   context 'hpricot assertions' do
@@ -54,7 +54,7 @@ class HpricotAssertionsTest &lt; ActiveSupport::TestCase
 end
 
 
-class SelectorAssertionsTest &lt; ActiveSupport::TestCase
+class SelectorAssertionsTest &lt; ActionView::TestCase
   include HelperMeTest::Assertions::SelectorAssertions
   
   context 'selector assertions' do</diff>
      <filename>test/assertions_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>3e1c54dd6cb1a994fa21127b759c90cd04821c88</id>
    </parent>
  </parents>
  <author>
    <name>Brian Landau</name>
    <email>brianjlandau@gmail.com</email>
  </author>
  <url>http://github.com/vigetlabs/helper_me_test/commit/ee339bbedfa7b36859503b28008497ba9afc6837</url>
  <id>ee339bbedfa7b36859503b28008497ba9afc6837</id>
  <committed-date>2009-02-03T16:43:43-08:00</committed-date>
  <authored-date>2009-02-03T16:43:43-08:00</authored-date>
  <message>Slim down assert_select_in</message>
  <tree>7b4d585e2cea68b730626b131f45676cedab51b5</tree>
  <committer>
    <name>Brian Landau</name>
    <email>brianjlandau@gmail.com</email>
  </committer>
</commit>
