在黄瓜中使用factory_girl构建工厂的更好方法
我在 Rails 2.3.9 项目中使用 Cucumber 和 Factory_girl 。
这是我的一篇文章中的给定内容之一。
Given a user with first_name "Mary" and last_name "Jane"
我开始构建正则表达式,我可以在其中捕获以下项目。
model = user
first_name = "Mary"
last_name = "Jane"
Factory(:user, :first_name => 'Mary', :last_name => "Jane")
鉴于 Cucumber 和 Factory_girl 如此受欢迎,我确信一定有更好的方法,而不是我重新发明轮子。
有什么好的解决办法呢?
I am using cucumber and factory_girl in a rails 2.3.9 project.
Here is one of the givens in one of my features.
Given a user with first_name "Mary" and last_name "Jane"
I started building the regex where I could capture following items.
model = user
first_name = "Mary"
last_name = "Jane"
Factory(:user, :first_name => 'Mary', :last_name => "Jane")
Given how popular cucumber and factory_girl are, I'm sure there must be a better way rather than me reinventing the wheel.
What's a good solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
明白了
http://robots.thoughtbot.com/post/284805810/gimme-三步走
Got it
http://robots.thoughtbot.com/post/284805810/gimme-three-steps