I'm attempting to run the test for the Full Test Suite in Chapter 7 of the Build Your Own Ruby On Rails book and I'm getting the following two errors:
1) Error:
test_should_show_story(StoryControllerTest):
ActionView::TemplateError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.to_formatted_s
On line #1 of app/views/story/_vote.rhtml
2) Error:
test_should_show_story_vote_elements(StoryControllerTest):
ActionView::TemplateError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.to_formatted_s
On line #1 of app/views/story/_vote.rhtml
I've checked the code and run the code from the code archive for both the story_controller_test.rb and _vote.rthml files, but I'm still getting these errors.
Any ideas as to what could be wrong? Here's the code I have for the test_should_show_story and test_should_show_vote_elements:
def test_should_show_story
get :show,ermalink => 'my-shiny-weblog'
assert_response :success
assert_template 'show'
assert_equal storiesanother), assigns
story)
end
def test_should_show_story_vote_elements
get :show,ermalink => 'my-shiny-weblog'
assert_select 'h2 span#vote_score'
assert_select 'ul#vote_history li', :count => 2
assert_select 'div#vote_link'
end
Also, I'm seeing the following deprecation warning:
....DEPRECATION WARNING: votes_count See http://www.rubyonrails.org/deprecation for details. (called from votes_count at /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/deprecated_associations.rb:7)
Any help, ideas? Thanks!


ermalink => 'my-shiny-weblog'
another), assigns





Bookmarks