Simply Rails 2 Stuck on page 192
I am working through the pdf version of the book since I haven't received my book yet of Simply Rails 2. Everything has worked fine until I got to page 192 and ran the rake test code. All test work until it gets to the test_should_add_story section of the test. The error it gives says, "NameError: undefined local variable or method 'assert_redirected_to_stories_path' for (etc). I double checked all my other files and compared them against the code archive. They are all identical. Not sure how to fix this problem.
Here is my code from my stories_controller_test.rb
Code Ruby:
require 'test_helper'
class StoriesControllerTest < ActionController::TestCase
def test_should_show_index
get :index
assert_response :success
assert_template 'index'
assert_not_nil assigns(:story)
end
def test_should_show_new
get :new
assert_response :success
assert_template 'new'
assert_not_nil assigns(:story)
end
def test_should_show_new_form
get :new
assert_select 'form p', :count => 3
end
def test_should_add_story
post :create, :story => {
:name => 'test story', :link => 'http://www.test.com/'
}
assert ! assigns(:story).new_record?
assert_redirected_to_stories_path
assert_not_nil flash[:notice]
end
def test_should_reject_missing_story_attribute
post :create, :story => { :name => 'story without a link' }
assert assigns(:story).errors.on(:link)
end
end