ruby on rails ecommerce tests are failing, but why?

i am working through the Beginning Ruby on Rails Ecommerce book and on
page 101 where it is talking about integration tests, i run
test/integration/book_test.rb and it fails giving me the following
error message:

  1) Failure:
test_book_administration(BookTest)
    [test/integration/book_test.rb:45:in `add_book'
     test/integration/book_test.rb:11:in `test_book_administration'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/integration.rb:431:in
`run']:
expected tag, but no tag found matching {:content=>"Ruby for Dummies",
:tag=>"td"} in:
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0
Transitional//EN\"\n\t\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html
xmlsn=\"http://www.w3.org/1999/xhtml\">\n\t<head>\n\t\t<title>Emporium</title>\n\t\t<link
href=\"/stylesheets/style.css?1164206463\" media=\"screen\"
rel=\"Stylesheet\" type=\"text/css\" />\n\t</head>\n\t<body>\n\t\t<div
id=\"header\">\n\t\t\t<h1 id=\"logo\">Emporium&trade;</h1>\n\t\t\t<h2
id=\"slogan\">Books on Rails</h2>\n\t\t</div>\n\n\t\t<div
id=\"menu\">\n\t\t\t<ul>\n\t\t\t\t<li><a
href=\"/admin/author\">Authors</a>&nbsp;|&nbsp;</li>\n\t\t\t\t<li><a
href=\"/admin/publisher\">Publishers</a>&nbsp;|&nbsp;</li>\n\t\t\t\t<li><a
href=\"/admin/book\">Books</a>&nbsp;|&nbsp;</li>\n\t\t\t\t<li><a
href=\"/\">Catalog</a>&nbsp;|&nbsp;</li>\n\t\t\t\t<li><a
href=\"/about\">About</a>&nbsp;</li>\n\t\t\t</ul>\n\t\t</div>\n\n\t\t<div
id=\"content\">\n\t\t\t\n\t\t\t\n\t\t\t\t<div
id=\"notice\">\n\t\t\t\tBook was successfully
created.\n\t\t\t\t</div>\n\t\t\t\n\t\t\t<h1>Listing
books</h1>\n\n<table>\n <tr>\n \n <th>Title</th>\n \n
<th>Published at</th>\n \n <th>Isbn</th>\n \n <th>Blurb</th>\n
\n <th>Price</th>\n \n <th>Created at</th>\n \n
<th>Updated at</th>\n \n </tr>\n \n\n <tr>\n \n <td>Ruby for
Dummies</td>\n \n <td>Mon Dec 04 09:27:30 CST 2006</td>\n \n
<td>123-123-123-X</td>\n \n <td>The best book released since
&quot;Eating for Dummies&quot;</td>\n \n <td>40.4</td>\n \n
<td>Mon Dec 04 09:27:30 CST 2006</td>\n \n <td>Mon Dec 04 09:27:30
CST 2006</td>\n \n <td><a
href=\"/admin/book/show/9\">Show</a></td>\n <td><a
href=\"/admin/book/edit/9\">Edit</a></td>\n <td><a
href=\"/admin/book/destroy/9\" onclick=\"if (confirm('Are you sure?'))
{ var f = document.createElement('form');
this.parentNode.appendChild(f); f.method = 'POST'; f.action =
this.href; f.submit(); };return false;\">Destroy</a></td>\n
</tr>\n\n</table>\n\n\n \n\n<br />\n\n<a href=\"/admin/book/new\">New
book</a>\n\n\t\t</div>\n\n\t\t<div id=\"footer\">&copy; 1995-2006
Emporium</div>\n\t</body>\n</html>\n".
<nil> is not true.

looking through the code, i clearly see that "Ruby for Dummies" is in
fact in there and I also see that it is wrapped inside of "td" html
tags... so why is this test failing? i thought there might have been a
typo in my code somewhere, so i downloaded the sample code from the
site and i still got the same error message.

i'm new to TDD so i'm not really sure where to start troubleshooting this

The assert_tag is broken in Rails, you must edit the

vendor/rails/actionpack/lib/action_controller/test_process.rb file and change the implementation of html_document as follows:
 def html_document
@html_document ||= HTML::Document.new(@response.body)
HTML::Document.new(@response.body)
end

From Mark Lund’s website: http://wiki.marklunds.com/index.php?title=Test_Driven_Development_with_Ruby

Is this for the latest version of rails though? i'm not running edge or anything, just 1.1.6

Oops, my bad. Overlooked the - and + there. Try the fix for 1.1.6 and see if it works. If it does not you can always revert back to the old code.

The latest version has deprecated the assert_tag, assert_select is the replacement. So I don’t think that fix is for latest version.