I have a User model that belongs to a Group. Group must have unique name attribute. User factory and group factory are defined as: Factory.define :user do |f| f.association :group, :factory => :group # ... end Factory.define :group do |f| f.name "default" end When the first user is created a new group is created too. When I try to create a second user it fails because it wants to create same group