I am trying to run functional tests using stories_controller_test as explained in
Simply Rails 2 p. 186 the code is below. The second test fails. Any ideas why?
This is the test
This is the errorCode: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 end
And this is what happens in the terminal when you go to the relevant pagesCode:Started .F.. Finished in 0.074679 seconds. 1) Failure: test_should_show_new(StoriesControllerTest) [/test/functional/stories_controller_test.rb:12]: Expected response to be a <:success>, but was <302> 4 tests, 6 assertions, 1 failures, 0 errors
Code:Processing storiesController#index (for 127.0.0.1 at 2010-01-19 15:21:15) [GET] User Load (0.6ms) SELECT * FROM "users" WHERE ("users"."id" = 1) LIMIT 1 Entry Load (1.6ms) SELECT * FROM "stories" Rendering template within layouts/application Rendering stories/index CACHE (0.0ms) SELECT * FROM "users" WHERE ("users"."id" = 1) LIMIT 1 Completed in 44ms (View: 22, DB: 2) | 200 OK [http://localhost/stories/] Processing storiesController#new (for 127.0.0.1 at 2010-01-19 15:22:56) [GET] User Load (0.6ms) SELECT * FROM "users" WHERE ("users"."id" = 1) LIMIT 1 Rendering template within layouts/application Rendering stories/new CACHE (0.0ms) SELECT * FROM "users" WHERE ("users"."id" = 1) LIMIT 1 Completed in 24ms (View: 5, DB: 1) | 200 OK [http://localhost/stories/new]




Bookmarks