From 55c18cfb28a69b73e4f720a61498ffe73fd6c22b Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Sun, 11 Jan 2009 19:22:19 +0000 Subject: - 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 --- .../doc/guides/html/testing_rails_applications.html | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'railties/doc/guides/html/testing_rails_applications.html') 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 -->
assert_select 'title', "Welcome to Rails Testing Guide"
-

You can also use nested assert_select blocks. In this case the inner assert_select will run the assertion on each element selected by the outer assert_select block:

+

You can also use nested assert_select blocks. In this case the inner assert_select runs the assertion on the complete collection of elements selected by the outer assert_select block:

assert_select 'ul.navigation' do
   assert_select 'li.menu_item'
 end
-

The assert_select assertion is quite powerful. For more advanced usage, refer to its documentation.

+

Alternatively the collection of elements selected by the outer assert_select may be iterated through so that assert_select 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.

+
+
+
assert_select "ol" do |elements|
+  elements.each do |element|
+    assert_select element, "li", 4
+  end
+end
+
+assert_select "ol" do
+  assert_select "li", 8
+end
+

The assert_select assertion is quite powerful. For more advanced usage, refer to its documentation.

4.6.1. Additional View-based Assertions

There are more assertions that are primarily used in testing views:

-- cgit v1.2.3