what's the difference?
This is an additional note to the question "Factory Girl - what's the purpose?"
I'm not sure whether my question is counted as a repetitive one, but I'm simply still not very clear after reading that post, since I think my doubt is still different.
Alright, so now that we can always use User.create() in before(:each) block in a Rspec test, why do we still bother using Factory Girl then?
This whole confuse occurred to me when I'm reading Michael Hartl's "Rails 3 tutorial", when he suddenly jumped into Factory Girl but used User.create() to build a User instance all the way through before that.
I wish someone can clarify this point for me, thx a lot!
You are correct but gems like factory girl and fabrication allow for significantly less code duplication across clases and within different tests when you need to test large sets of data that require different attribute values due to uniqueness requirements. It mixes in methods to easily "manufacture" many different objects for these types of tests.
链接地址: http://www.djcxy.com/p/55250.html上一篇: Erlang进程与Java线程
下一篇: 有什么不同?