使用 Spork 时如何加载机械师的蓝图?
使用 Spork 时如何加载 Machinist 的蓝图?
宝石:
- mongoid (2.0.0.rc.6)
- capybara (0.4.1.1)
- Steak (1.1.0)
- spork (0.9.0.rc2)
- rspec (2.4.0)
- machinist (2.0.0.beta2)
我收到此错误在每个验收测试中:
Machinist::NoBlueprintError:
No master blueprint defined for class School
所有测试都失败,因为它找不到任何蓝图。我在 V2 上遇到了一些错误(我仍然得到了一些 No master blueprint..),但我也得到了另一个错误:
Professor Create a new professor
Failure/Error: click_link("Profesores")
RangeError:
0x000000821461e4 is recycled object
我在这个测试环境中得到了 config.cache_classes = false 。
两个spec_helper版本:
How do you load Machinist's blueprints when using Spork?
Gems:
- mongoid (2.0.0.rc.6)
- capybara (0.4.1.1)
- steak (1.1.0)
- spork (0.9.0.rc2)
- rspec (2.4.0)
- machinist (2.0.0.beta2)
I get this error in every acceptance test:
Machinist::NoBlueprintError:
No master blueprint defined for class School
All test fail, because it doesn't find any blueprint. I some of these errors on V2(I still get a couple of No master blueprint..), but I get another error too:
Professor Create a new professor
Failure/Error: click_link("Profesores")
RangeError:
0x000000821461e4 is recycled object
I got config.cache_classes = false in test environment for this one.
Both spec_helper versions:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只是为了排除明显的情况,您是否在 application.rb 文件中包含了类似的内容:
另外,您是否在以下位置设置了蓝图文件:
并确保您已将: 包含
在蓝图的顶部。
另外,当您启动并运行它时,还要注意一下。 Machinist 缓存了大量对象以使其运行速度更快,但当不断尝试清除数据库时,它有时可能会让您出错。如果遇到问题,您可以通过将其添加到 config/environments/test.rb 文件来关闭 Machinists 缓存:
Just to rule out the obvious have you included something like this in your application.rb file:
Also have you set up your blueprints files in:
and made sure you've included:
in the top of your blueprints.
Also just on another note for when you get it up and running. Machinist caches a lot of objects to make it run faster, but it may occasionally trip you up when constantly trying to clear out the database. If you run into problems you can turn off Machinists caching by adding this to your config/environments/test.rb file: