Page 94, chapter 3, running $ ruby test/integration/book_test.rb gives:
Expected response to be a <:redirect>, but was <500>
Does anyone know how to fix this problem? TIA.
Page 94, chapter 3, running $ ruby test/integration/book_test.rb gives:
Expected response to be a <:redirect>, but was <500>
Does anyone know how to fix this problem? TIA.
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: Peak Obsession
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.
Cool. That solves the problem that I was having with my project. I will try it out.
I was baffled, when I do curl I see the right page but when I do assert_tag it bombs out!
On page 77, there is a test_destroy method that fails on assert_tag
assert_tag :tag => 'div', :attributes => {:id => 'notice'}, :content => 'Successfully deleted author Joel Spolsky'
I am on Rails 1.2 and the assert_tag has been deprecated. The test was failing so I used assert_select tag:
assert_select "div#notice", 'Successfully deleted author Joel Spolsky'