Factorygirl 无法在数据库中为 javascript 步骤创建工厂
我有这样的 rspec 场景:
background do
Factory.create(:project, :name => "NAME", :url_name => "url name")
end
scenario "A not logged in user with no cookies goes to the root url and chooses a project", :js => true do
visit root_path
#^ this fires up a browser
...
end
当我在 root_path 命中的控制器操作中调用调试器时,不存在 Project
。当我删除 :js =>; true
,该项目确实存在。有什么建议吗?
我将 Rails 3 与 jquery 和factory_girl_rails 1.0 一起使用
I have this rspec scenario:
background do
Factory.create(:project, :name => "NAME", :url_name => "url name")
end
scenario "A not logged in user with no cookies goes to the root url and chooses a project", :js => true do
visit root_path
#^ this fires up a browser
...
end
When I call the debugger in the controller action that gets hit for the root_path, no Project
s exist. When I remove the :js => true
, the project does exist. Any suggestions?
I'm using rails 3 with jquery and factory_girl_rails 1.0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要禁用事务装置。请参阅https://github.com/lailsonbm/contact_manager_app
You need to disable transactional fixtures. See https://github.com/lailsonbm/contact_manager_app