search for: dont_destroy_homepag

Displaying 1 result from an estimated 1 matches for "dont_destroy_homepag".

Did you mean: dont_destroy_homepage
2006 Jul 18
2
Testing which RuntimeError is raised
...that it rails for the specific reason I have in my model. How can I get more specific? Am I going to have to create my own exception class so I have a named exception to check for? What I have a the moment is: In my model file: # don''t destroy the home page (id = 1) before_destroy :dont_destroy_homepage def dont_destroy_homepage raise "You can''t delete the home page or you will get rid of your entire site" if id == 1 end Then in my test file: def test_cant_destroy_homepage homepage = pages(:homepage) assert_equal homepage.id, 1 # I would really love to...