title: How "assert_select" works in Rails
body: <p>I was trying the following test in my Rails app:</p>
  
  <pre><code>test "markup need for store.js.coffee is in place" do
    get :index
    assert_select '.store .entry &gt; img', 3
    assert_select '.entry input[type=submit]', 3
  end
  </code></pre>
  
  <p>The test is all ok, I haven't failures or errors, but I can't understand what assert_selects are looking for in my HTML.<br>
  I will try to explain myself in a better way: is <code>assert_select '.entry input[type=submit]', 3</code> looking for exact 3 fields of input type=submit inside the <code>.entry</code> element? and What is the first asser_select looking for?</p>
  
  <p>This is the HTML where assert_selects act</p>
  
  <pre><code>&lt;body class="store"&gt;
  &lt;div id="columns"&gt;
  &lt;div id="main"&gt;
  &lt;h1&gt;Your Pragmatic Catalog&lt;/h1&gt;
  
  &lt;div class="entry"&gt;
  &lt;img height="95px" src="/assets/cs.jpg" alt="Cs"&gt;
  &lt;h3&gt;CoffeeScript&lt;/h3&gt;
  &lt;p&gt; CoffeeScript is JavaScript done right. It provides all of JavaScript's functionality                 wrapped in a cleaner, more succinct syntax. In the first book on this exciting new language, CoffeeScript guru Trevor Burnham shows you how to hold onto all the power and flexibility of JavaScript while writing clearer, cleaner, and safer code. &lt;/p&gt;
  &lt;div class="price_line"&gt;
  &lt;span class="price"&gt;$36.00&lt;/span&gt;
  &lt;form class="button_to" method="post" data-remote="true" action="/line_items?product_id=2"&gt;
  &lt;div&gt;
  &lt;input type="submit" value="Add to Cart"&gt;
  &lt;input type="hidden" value="H5APP93C0onJsfliaMRqww+ER0u/hTZAjvGIeMluHIo=" name="authenticity_token"&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class="entry"&gt;
  &lt;img height="95px" src="/assets/hp.jpg" alt="Hp"&gt;
  &lt;h3&gt;Harry Potter&lt;/h3&gt;
  &lt;p&gt;Mago&lt;/p&gt;
  &lt;div class="price_line"&gt;
  &lt;span class="price"&gt;$15.00&lt;/span&gt;
  &lt;form class="button_to" method="post" data-remote="true" action="/line_items?product_id=5"&gt;
  &lt;div&gt;
  &lt;input type="submit" value="Add to Cart"&gt;
  &lt;input type="hidden" value="H5APP93C0onJsfliaMRqww+ER0u/hTZAjvGIeMluHIo=" name="authenticity_token"&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class="entry"&gt;
  &lt;img height="95px" src="/assets/ruby.jpg" alt="Ruby"&gt;
  &lt;h3&gt;Programming Ruby 1.9 &amp; 2.0&lt;/h3&gt;
  &lt;p&gt; Ruby is the fastest growing and most exciting dynamic language out there. If you need to get working programs delivered fast, you should add Ruby to your toolbox. &lt;/p&gt;
  &lt;div class="price_line"&gt;
  &lt;span class="price"&gt;$49.95&lt;/span&gt;
  &lt;form class="button_to" method="post" data-remote="true" action="/line_items?product_id=3"&gt;
  &lt;div&gt;
  &lt;input type="submit" value="Add to Cart"&gt;
  &lt;input type="hidden" value="H5APP93C0onJsfliaMRqww+ER0u/hTZAjvGIeMluHIo=" name="authenticity_token"&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class="entry"&gt;
  &lt;img height="95px" src="/assets/rtp.jpg" alt="Rtp"&gt;
  &lt;h3&gt;Rails Test Prescriptions&lt;/h3&gt;
  &lt;p&gt;
  &lt;em&gt;Rails Test Prescriptions&lt;/em&gt;
  is a comprehensive guide to testing Rails applications, covering Test-Driven Development    from both a theoretical perspective (why to test) and from a practical perspective (how to test effectively). It covers the core Rails testing tools and procedures for Rails 2 and Rails 3, and introduces popular add-ons, including Cucumber, Shoulda, Machinist, Mocha, and Rcov.
  &lt;/p&gt;
  &lt;div class="price_line"&gt;
  &lt;span class="price"&gt;$34.95&lt;/span&gt;
  &lt;form class="button_to" method="post" data-remote="true" action="/line_items?product_id=4"&gt;
  &lt;div&gt;
  &lt;input type="submit" value="Add to Cart"&gt;
  &lt;input type="hidden" value="H5APP93C0onJsfliaMRqww+ER0u/hTZAjvGIeMluHIo=" name="authenticity_token"&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>