class Category < ActiveRecord::Base
acts_as_tree
end
How to test that acts_as_tree gets called? Or that any other in class body method gets called?
class Category < ActiveRecord::Base
acts_as_tree
end
How to test that acts_as_tree gets called? Or that any other in class body method gets called?
Why would you want to test that it gets called? Of course it gets called!
What you really should be doing is testing that your application behaves the way you want it to behave. You write test cases illustrating how you want your application to behave, and then you run the test cases to check that the application does indeed behave that way.
You can write test cases checking that Category
instances have parents and children, that you can retrieve the list of children given a parent, that you can create a new Category
instance and add it to some pre-existing Category
instance's list of children, or various other behaviors important to your application.