Re: Beginning Ruby on Rails E-Commerce : Errata Help

Nick Coyne
2006-12-03T11:05:40Z

Finally solved this mystery -

The first problem was that the newly created book wasn''t being saved,
so
the ''new'' page was being displayed instead of
''create''. The cause of
this was the date. When I changed

:published_at => Time.now

to

:published_at => ''2006-11-01''

then things were saved correctly and we ended up on the correct page.

Next problem was that assert_tag wasn''t passing, even though I could
see
the new book in the raw html. On
http://wiki.marklunds.com/index.php?title=Test_Driven_Development_with_Ruby
I found that assert_tag doesn''t work with integration tests unless you
make this change in test_process.rb

     def html_document
-      @html_document ||= HTML::Document.new(@response.body)
+      HTML::Document.new(@response.body)
     end

Once I changed that then the integration test passed no problem.

Nick.



Bala Paranj wrote:
> Following table might help:
>
>     *  :success (status code is 200)
>     * :redirect (status code is within 300..399)
>     * :missing (status code is 404)
>     * :error (status code is within 500..599)
>     * any number (to specifically reference a particular status code)
>
> assert_response :success      # page rendered ok
> assert_response :redirect     # we''ve been redirected
> assert_response :missing      # not found
> assert_response 505           # status code was 505
>
> For more check out: http://manuals.rubyonrails.com/read/chapter/28
>
> You may also want to use curl on the command line to see the response
> from the server. It also helps to write assert_tag and other
> assertions.


--
Posted via http://www.ruby-forum.com/.