开发者

Factory_girl or machinist? [closed]

It's difficult to tell what is being开发者_如何学Go asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

Are you using factory_girl or machinist for stubbing/mocking in Rails tests?


No. Those libraries are not stubbing/mocking libraries*.

Both Machinist and Factory Girl are libraries that help you instantiate objects in your tests without the fuss of fixtures. After you've instantiated an object using one of these libraries, you might then mock or stub methods on that object, but Factory Girl and Machinist wouldn't have anything to do with that.

Check out Mocha for stubbing/mocking.

*Factory Girl has a stubbing feature that's specifically for stubbing models, but nothing for general stubbing/mocking.


I'm using factory_girl. I haven't tried machinist so I can't compare the two, but I'm quite happy with factory_girl.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜