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
care about.

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.

~ jf
--
John Feminella
Principal Consultant, BitsBuilder
LI: http://www.linkedin.com/in/fjsquared
SO: http://stackoverflow.com/users/75170/
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to