【发布时间】:2012-03-03 09:27:44
【问题描述】:
如何使用 FactoryGirl 为 ActsAsTaggableOn::tag 创建一个夹具?
我试过了:
/spec/factories/tags.rb
Factory.define ActsAsTaggableOn::Tag do |f|
f.sequence(:name) { |n| "titre#{n}" }
end
/spec/controllers/books_controller.rb
it "should return 2 categories whith books" do
fake_tag = Factory(:tag)
...
end
我明白了:
Failure/Error: fake_tag = Factory(:tag)
ArgumentError:
Factory not registered: tag
感谢您的帮助, 文森特
【问题讨论】:
标签: ruby-on-rails rspec factory-bot acts-as-taggable-on