> If the > implementation of a model is > wrong it isn't the job of the controller spec to > report the failure. > It's the job of the model spec or an integration > test (if its an > integration related issue) to report the failure.
It seems that it would be very easy to change a model, thereby breaking the controller, and not realize it. Let's say that we decide to change the implementation of a model, how do you then go about finding the controllers that need to be updated? I know this is the classic argument between classicists and mockists, but I don't see the benefit of this type of strict mocking. If the integration test is required then what benefit are we getting from the mock and is it worth the cost? > > Also, controllers can achieve a better level of > programming toward the > "interface" rather then a concrete class by using > dependency > injection. I don't see any reason to use DI in a dynamic language like ruby. I also see no reason in this specific case. Let's assume we're working on a rails social networking site. If we have a Blog controller and a Blog model class there is no reason to use DI to inject the blog model in the blog controller. It isn't removing unneeded coupling, it's adding unneeded complexity. In java this injection is necessary to make things like testing easier, but it is wholly unnecessary in a language like ruby. > If you don't > isolate then you end > up with a lot of little integration tests. Now when > one implementation > is wrong you get 100 test failures rather then 1 or > 2, which can be a > headache when you're trying to find out why > something failed. This has never been a headache for me. If you run your tests often you'll know what was changed recently and it's trivial to find the problem. Also, if you run localized tests frequently you'll see the error without seeing the failures that it causes through out the test suite and you still get the benefit of mini integration tests ;) In all honesty I'm trying to ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users