On 1 Sep 2009, at 21:11, Jeremy Hageman wrote:
As someone relatively new to rspec, I am interested in hearing the wisdom of the group in the area of using a fixture replacement gem (such as machinist or factory girl) instead of mocking the model. To me it seems that using a fixture replacement, instead of a mock, would circumvent some of rspec's framework in a bad way. Or perhaps there are certain places where a fixture replacement can be beneficial, and certain places where only a mock will do? Do many of you guys in the group use a fixture replacement?
Yes, I do. My advice is: use mocks when you can, fixture replacements when you must. Tests using mocks are much faster (and therefore fun) to run, but sometimes ActiveRecord makes it pretty hard for you to separate the persistable behaviour of your model class from the business logic, meaning it's simpler (and therefore more fun) just to give it up and hit the database.
Fixture replacements are also invaluable for writing acceptance tests in Cucumber.
cheers, Matt _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users