The heart of my question is the seemingly chicken-and-egg-like nature of testing many models that work together. I now have two flavors of tests: tests that keep the models honest (computations and returns values are consistent and accurate) and tests that operate at the macro level as you suggest. All in all, I am pretty happy with the BDD stuff, as I am finding edge cases and bugs, and I have some baseline to fall back on when I go ripping out code.
If there are more suggestions about interoperable model testing, please send.
On Sep 17, 2008, at 7:14 PM, [EMAIL PROTECTED] wrote:
"Testing a model" or "testing a relationship" doesn't mean much (it can mean anything). I recommend you focus your testing efforts on the desired *behaviour* of your system, not its implementation. This is a very central tenet of BDD. If your Message class doesn't have any behaviour (code in addition to the relationships) there isn't really much about it to test. You should assume ActiveRecord works. I suppose those relationships are there for a reason. Some other code uses these relationships. What is that code? Start by testing that code. This code is probably on the "outside" of your model, i.e. it depends on your model. Typically a controller and/or a view - probably both. Nowadays I usually recommend people start by writing a test for the system as seen from the outside. This is called "outside in" and is what you'd use Cucumber or the story runner for. Or if you don't use it, at least write some kind of end to end test. Then, when you discover edge cases, drop down to a lower level (specs that talk to the model). I have a feeling I might have confused you more than helped you. Maybe you can explain a little more about what the system's behaviour? It would help set the context so we can recommend a good practice ;-)
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users