如何使用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
谢谢你的帮助,
文森特