[rspec-users] What should I test/specify?
johnf at distb.net
Sat Oct 30 12:47:43 EDT 2010
If you're writing a unit test for a method, the general rule of thumb
is to test what the method itself does. That sounds tautological, but
it's meant to define the boundary of what you should and shouldn't
In this case, you only care about the fact that `YAML::load_file` is
called, and that `BehaviorTreeCreator.new` is then called with the
result of that, and that *that* result has `create` invoked on it.
That's it: if those three things happen, then this method is working
as you expect.
Your unit tests for BehaviorTreeCreator.new and .create will probably be richer.
Principal Consultant, BitsBuilder
More information about the rspec-users