error in my code

hello all,

i am new to the RoR programming and em struck with the exception code. Can someone please verify my code:

def test_show_failure get:show.{:id=>@first_id},{:user=>@user_id,:division=>@division_id}

assert_respose:failure rescue NoMethodError

end

Thanx a lot in advance.

Regards, cutelucks

According to the API there is no assert_response: failure

http://api.rubyonrails.org/

:success - Status code was 200 :redirect - Status code was in the 300-399 range :missing - Status code was 404 :error - Status code was in the 500-599 range

That help?

Can you describe the function that you are testing?

I would normally test this by testing the redirect (assuming you are redirecting users that do not have permission)

If someone does not have permission to view a page, I normally redirect to another page and show a flash notice

so in the test I would say

def test_should_not_show_page_without_permission   get :show, :id => @first_id, :user => @user_id, :division => @division_id     assert_redirected_to notice_path # => specify your path here     assert_not_nil flash[:warning] end

As a tip - when naming tests, it's good practice to use the term "should" or "should not" This helps you clearly define the behavior you are testing for.

example/ def test_login_page_should_render_with_login_form end

etc