aboutsummaryrefslogtreecommitdiffstats
path: root/railties/doc/guides/html/testing_rails_applications.html
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2009-01-11 19:22:19 +0000
committerPratik Naik <pratiknaik@gmail.com>2009-01-11 19:22:19 +0000
commit55c18cfb28a69b73e4f720a61498ffe73fd6c22b (patch)
tree76a987ed3b5729df4ec9e6df103e63e5d9fc5b61 /railties/doc/guides/html/testing_rails_applications.html
parentbda787e9b10141c841ba3d86146d42b8c1e62a1b (diff)
downloadrails-55c18cfb28a69b73e4f720a61498ffe73fd6c22b.tar.gz
rails-55c18cfb28a69b73e4f720a61498ffe73fd6c22b.tar.bz2
rails-55c18cfb28a69b73e4f720a61498ffe73fd6c22b.zip
- Add 'Performance test environment' to Performance guide
- Add rake middleware and Josh's chat log to Rack guide - Remove long changelog from Active Record Finders guides
Diffstat (limited to 'railties/doc/guides/html/testing_rails_applications.html')
-rw-r--r--railties/doc/guides/html/testing_rails_applications.html19
1 files changed, 17 insertions, 2 deletions
diff --git a/railties/doc/guides/html/testing_rails_applications.html b/railties/doc/guides/html/testing_rails_applications.html
index ac6ecc73b9..457f93f622 100644
--- a/railties/doc/guides/html/testing_rails_applications.html
+++ b/railties/doc/guides/html/testing_rails_applications.html
@@ -1157,7 +1157,7 @@ by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>assert_select <span style="color: #FF0000">'title'</span><span style="color: #990000">,</span> <span style="color: #FF0000">"Welcome to Rails Testing Guide"</span></tt></pre></div></div>
-<div class="paragraph"><p>You can also use nested <tt>assert_select</tt> blocks. In this case the inner <tt>assert_select</tt> will run the assertion on each element selected by the outer <tt>assert_select</tt> block:</p></div>
+<div class="paragraph"><p>You can also use nested <tt>assert_select</tt> blocks. In this case the inner <tt>assert_select</tt> runs the assertion on the complete collection of elements selected by the outer <tt>assert_select</tt> block:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 2.9
by Lorenzo Bettini
@@ -1166,7 +1166,22 @@ http://www.gnu.org/software/src-highlite -->
<pre><tt>assert_select <span style="color: #FF0000">'ul.navigation'</span> <span style="font-weight: bold"><span style="color: #0000FF">do</span></span>
assert_select <span style="color: #FF0000">'li.menu_item'</span>
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
-<div class="paragraph"><p>The <tt>assert_select</tt> assertion is quite powerful. For more advanced usage, refer to its <a href="http://api.rubyonrails.com/classes/ActionController/Assertions/SelectorAssertions.html#M000749">documentation</a>.</p></div>
+<div class="paragraph"><p>Alternatively the collection of elements selected by the outer <tt>assert_select</tt> may be iterated through so that <tt>assert_select</tt> may be called separately for each element. Suppose for example that the response contains two ordered lists, each with four list elements then the following tests will both pass.</p></div>
+<div class="listingblock">
+<div class="content"><!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>assert_select <span style="color: #FF0000">"ol"</span> <span style="font-weight: bold"><span style="color: #0000FF">do</span></span> <span style="color: #990000">|</span>elements<span style="color: #990000">|</span>
+ elements<span style="color: #990000">.</span>each <span style="font-weight: bold"><span style="color: #0000FF">do</span></span> <span style="color: #990000">|</span>element<span style="color: #990000">|</span>
+ assert_select element<span style="color: #990000">,</span> <span style="color: #FF0000">"li"</span><span style="color: #990000">,</span> <span style="color: #993399">4</span>
+ <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
+<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
+
+assert_select <span style="color: #FF0000">"ol"</span> <span style="font-weight: bold"><span style="color: #0000FF">do</span></span>
+ assert_select <span style="color: #FF0000">"li"</span><span style="color: #990000">,</span> <span style="color: #993399">8</span>
+<span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
+<div class="paragraph"><p>The <tt>assert_select</tt> assertion is quite powerful. For more advanced usage, refer to its <a href="http://api.rubyonrails.com/classes/ActionController/Assertions/SelectorAssertions.html">documentation</a>.</p></div>
<h4 id="_additional_view_based_assertions">4.6.1. Additional View-based Assertions</h4>
<div class="paragraph"><p>There are more assertions that are primarily used in testing views:</p></div>
<div class="tableblock">