【发布时间】:2015-01-09 19:02:32
【问题描述】:
在Factory Girl getting started documentation 中,它说要像这样包含帮助程序模块:
# RSpec
# spec/support/factory_girl.rb
RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
end
在 RSpec 配置块内。但这对我不起作用。我只是将模块包含放在rails_helper.rb 的开头,它工作正常。
我的问题是为什么文档说要把它放在配置块中?那应该工作吗?我会遇到方法冲突吗?我是否违背了最佳实践?
【问题讨论】:
标签: ruby-on-rails rspec factory-bot rspec-rails