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\"w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlsn=\"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™</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> | </li>\n\t\t\t\t<li><a href=\"/admin/publisher\">Publishers</a> | </li>\n\t\t\t\t<li><a href=\"/admin/book\">Books</a> | </li>\n\t\t\t\t<li><a href=\"/\">Catalog</a> | </li>\n\t\t\t\t<li><a href=\"/about\">About</a> </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 "Eating for Dummies"</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\">© 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Joshua Kieschnick
2006-Dec-04 15:36 UTC
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\"w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlsn=\"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™</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> | </li>\n\t\t\t\t<li><a href=\"/admin/publisher\">Publishers</a> | </li>\n\t\t\t\t<li><a href=\"/admin/book\">Books</a> | </li>\n\t\t\t\t<li><a href=\"/\">Catalog</a> | </li>\n\t\t\t\t<li><a href=\"/about\">About</a> </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 "Eating for Dummies"</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\">© 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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: wiki.marklunds.com/index.php?title=Test_Driven_Development_with_Ruby On 12/4/06, Joshua Kieschnick <jjkiesch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > 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'' >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Justin Mazzi
2006-Dec-04 16:17 UTC
Re: ruby on rails ecommerce tests are failing, but why?
Bala Paranj wrote:> 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: > wiki.marklunds.com/index.php?title=Test_Driven_Development_with_RubyActually, the patch removes the @html line. it should read def html_document HTML::Document.new(@response.body) end wiki.marklunds.com/index.php?title=Test_Driven_Development_with_Ruby#Integration_tests -- Posted via ruby-forum.com. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Josh Kieschnick
2006-Dec-04 16:20 UTC
Re: ruby on rails ecommerce tests are failing, but why?
Is this for the latest version of rails though? i''m not running edge or anything, just 1.1.6 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. On 12/4/06, Josh Kieschnick <jjkiesch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Is this for the latest version of rails though? i''m not running edge > or anything, just 1.1.6 > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---