assert_redirected help

assert_redirected_to category_path(assigns(:category))

this line for example..when i use it in my code

def test_should_create_category     login_as :admin     assert_difference Category, :count, 1 do       post :create, :category => { }     end     assert_redirected_to category_path(assigns(:category))   end

i get an error sayin undefined method category_path

where is this defined??

where should i define it?

assert_redirected_to category_path(assigns(:category))

this line for example..when i use it in my code

def test_should_create_category login_as :admin assert_difference Category, :count, 1 do post :create, :category => { } end assert_redirected_to category_path(assigns(:category)) end

i get an error sayin undefined method category_path

where is this defined??

where should i define it?

category_path and category_url is two methods that will be created by ActionController::Routing if you have defined a named route category like:

  map.category 'category', :controller => 'category', :action => 'index'

thanks for the suggestion..

but now i m getting a new error sayin

5) Error: test_should_create_category(CategoriesControllerTest): TypeError: can't convert Fixnum into String     test/functional/Categories_controller_test.rb:47:in `test_should_create_category'

my test case is

def test_should_create_category1     assert_difference Category.count, 1 do       post :create, :category => {:name => sss,:num_books => 5, :buyin =>5 }     end     assert_redirected_to category_path(assigns(:categories))   end

Check the docs for assert_difference - the first argument should be a string

Fred