How can i create a fixture for ActsAsTaggableOn::tag Using FactoryGirl ?
I tried :
/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
I get :
Failure/Error: fake_tag = Factory(:tag)
ArgumentError:
Factory not registered: tag
Thanks for your help, Vincent
I guess you're using a quite old version of factory girl. I encourage you to switch to the latest version if you're able to.
Answering your question, I think you need something like:
Factory.define :tag, :class => ActsAsTaggableOn::Tag do |f|
f.sequence(:name) { |n| "titre#{n}" }
end
Check the Factory 1.3 doc here. But as I told you before. Try to switch to a newer version.